Top Banner
Michael Emmerich, Alkacon Software Workshop track Updating to OpenCms 9.5 03.11.2014
42

OpenCms Days 2014 - Updating to OpenCms 9.5

Jul 13, 2015

Download

Software

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: OpenCms Days 2014 - Updating to OpenCms 9.5

Michael Emmerich, Alkacon Software

Workshop track

Updating to OpenCms 9.5

03.11.2014

Page 2: OpenCms Days 2014 - Updating to OpenCms 9.5

● Update your current OpenCms installation to OpenCms 9.5

● Update OpenCms with OCEE

● API changes

● Content Collectors

● SOLR Postprocessor

● Showcase: Enhancing your Application with OpenCms 9.5 features

2

Agenda

Page 3: OpenCms Days 2014 - Updating to OpenCms 9.5

Update your current OpenCms

installation to OpenCms 9.5 3

Page 4: OpenCms Days 2014 - Updating to OpenCms 9.5

Good news:

Your existing OpenCms 8 or OpenCms 9

webapp will run in OpenCms 9.5 – without

any changes

(At least – in most cases….)

4

Update to OpenCms 9.5

Page 5: OpenCms Days 2014 - Updating to OpenCms 9.5

How to upgrade:

Use the OpenCms update wizard!

5

Update to OpenCms 9.5

Page 6: OpenCms Days 2014 - Updating to OpenCms 9.5

Update OpenCms with OCEE 6

Page 7: OpenCms Days 2014 - Updating to OpenCms 9.5

● Updating OCEE within a major OpenCms

version

● Example: OpenCms 9.0.0 (OCEE 4.0.0) to

OpenCms 9.0.1 (OCEE 4.0.1)

-Very Easy

● Simply install the new OCEE modules

before updating the OpenCms core

7

Updating OpenCms with OCEE

Page 8: OpenCms Days 2014 - Updating to OpenCms 9.5

● Updating OpenCms from one major

version to another in a cluster

● Requires more planning to reduce

downtimes

● Manual work on config files needed

8

Updating OpenCms with OCEE

Page 9: OpenCms Days 2014 - Updating to OpenCms 9.5

9

Updating OpenCms with OCEE

Master

MDB

SDB

Slave 1 Slave 2

● A typical OpenCms/OCEE update scenario

● One master, two slaves, with DB replication

● How to update OpenCms and OCEE?

● Reduce downtime for delivery servers

OC

EE

-Clu

ste

r

OC

EE

-Clu

ste

r

Page 10: OpenCms Days 2014 - Updating to OpenCms 9.5

10

Updating OpenCms with OCEE

Master

MDB

SDB

Slave 1 Slave 2

Step 1

● Content Freeze!

● Disable Cluster & Replication

Content delivery from Slave 1 and Slave 2

Page 11: OpenCms Days 2014 - Updating to OpenCms 9.5

11

Updating OpenCms with OCEE

Master

(9.5)

MDB

Step 2

● Clone Slave DB

● Connect each Slave to its own Database

Content delivery from Slave 1 and Slave 2

SDB 2

Slave 1 Slave 2

SDB

Page 12: OpenCms Days 2014 - Updating to OpenCms 9.5

12

Updating OpenCms with OCEE

Master

(9.5)

MDB

Step 3

● Direct all traffic to Slave 2

● Shutdown Slave 1

● Uninstall OCEE on master server

● Run Update Wizard on Master Server

● Test Master Server

Content delivery Slave 2

Master Server is updated to OpenCms 9.5

SDB 2

Slave 1 Slave 2

SDB

Page 13: OpenCms Days 2014 - Updating to OpenCms 9.5

13

Updating OpenCms with OCEE

Master

(9.5)

MDB

SDB 2

Slave 1 Slave 2

Step 4

● Install new OCEE on master

Content delivery from Slave 2

Master Server is updated to OpenCms 9.5

SDB

Page 14: OpenCms Days 2014 - Updating to OpenCms 9.5

14

Updating OpenCms with OCEE

Master

(9.5)

MDB

SDB 2

Slave 1

(9.5) Slave 2

Step 5

● Replace all .jar Files on Slave 1

● Adjust configuration files on Slave 1 (if required)

● Enable OCEE Cluster for Master and Slave 1

● Replicate system folder (alternatively: replicate all)

● Rebuild Searchindexes on Slave 1

● Test combination Master and Slave 1

Content delivery from Slave 2

Master Server and Slave 1 are updated to OpenCms 9.5

SDB

Page 15: OpenCms Days 2014 - Updating to OpenCms 9.5

15

Updating OpenCms with OCEE

Master

(9.5)

MDB

Slave 1

(9.5)

Slave 2

(9.5)

Step 6

● Direct all traffic to Slave 1

● Copy Webapplication from Slave 1 to Slave 2

● Adjust configuration files on Slave 2

● Enable OCEE Cluster for all Server

● Reconnect Slave 2 to Slave DB

● Rebuild Searchindexes on Slave 2

● Test combination Master and Slave 2

● Cancel content freeze

Content delivery from Slave 1

All servers are updated to OpenCms 9.5

SDB

Page 16: OpenCms Days 2014 - Updating to OpenCms 9.5

16

Updating OpenCms with OCEE

Master

(9.5)

MDB

Slave 1

(9.5)

Slave 2

(9.5)

Step 7

● Direct all traffic to both

delivery servers

DONE !

SDB

Page 17: OpenCms Days 2014 - Updating to OpenCms 9.5

API Changes 17

Page 18: OpenCms Days 2014 - Updating to OpenCms 9.5

● Containerpages are now locale

independend (like other configuration files)

● Important when using localization &

siblings of containerpages (which you

should not have done !)

18

API changes

Page 19: OpenCms Days 2014 - Updating to OpenCms 9.5

● A few plugable Interfaces have changed in

OpenCms 9.5

● But: Don’t panik!

● Code-Changes are minimal and can be

done in short time

19

API changes

Page 20: OpenCms Days 2014 - Updating to OpenCms 9.5

● Content Collectors collect content items

(e.g. News) to display them in a list view

● New method added to Interface

I_CmsResourceCollector

● Why changes? Enhancements in the ADE

Publish function

20

API changes – Content Collectors

Page 21: OpenCms Days 2014 - Updating to OpenCms 9.5

● How to change my own collectors?

● Add additional getResult Method:

21

API changes - Content Collectors

List<CmsResource> getResults(CmsObject cms,

String collectorName,

String params,

int numResults)

throws CmsException;

Page 22: OpenCms Days 2014 - Updating to OpenCms 9.5

● New function in Content Collectors since

OpenCms 9.0

● The problem so far: Collectors do not show

expired or unreleased content items for editing

● The solution: add the “excludeTimerange” as last

value to the parameter string

22

API changes – Content Collectors

param="${newspath}news_%(number).html|news|150|excludeTimerange"

Page 23: OpenCms Days 2014 - Updating to OpenCms 9.5

23

API changes – Content Collectors

Page 24: OpenCms Days 2014 - Updating to OpenCms 9.5

● The Solr PostProcessor allows to

manipulate Solr results

● New method added to Interface

I_CmsSolrPostSearchProcessor

● Why changes? To allow new options in

post-proccessing

24

API changes – Solr PostProcessor

Page 25: OpenCms Days 2014 - Updating to OpenCms 9.5

25

API changes – Solr PostProcessor

SOLR

Handler SOLR

Post

Processor

(Access

Check)

Custom

Post

Processor

Query

Result

Query

Result

Page 26: OpenCms Days 2014 - Updating to OpenCms 9.5

● How to change my own post processors?

● Add additional init() method:

● The method is called for each new Solr

query

26

API changes – Solr PostProcessor

void init();

Page 27: OpenCms Days 2014 - Updating to OpenCms 9.5

● Example use-case: Do only display one

sibling in search result

27

API changes – Solr PostProcessor

private Set<CmsUUID> m_processedResources;

public void init() {

m_processedResources.clear();

}

public SolrDocument process(CmsObject searchCms, CmsResource resource,

SolrInputDocument document) {

CmsUUID resourceId = resource.getResourceId();

if (!m_processedResources.contains(resourceId)) {

m_processedResources.add(resourceId);

return ClientUtils.toSolrDocument(document);

}

return null;

}

}

Page 28: OpenCms Days 2014 - Updating to OpenCms 9.5

Extending your application with

OpenCms 9.5 features 28

Page 29: OpenCms Days 2014 - Updating to OpenCms 9.5

● Element views and new roles

● Content editors only see editpoints which they are

allowed to see

● PDF-Generation on the fly

● Simple way to produce PDF files from News or

other contents

29

Add OpenCms 9.5 features

Page 30: OpenCms Days 2014 - Updating to OpenCms 9.5

Element views:

● Assign Content Types to Element views

● Assign Users to Element views

Users can only use the Content Types

supported by the selected view

Different users have different edit points

30

Element views and roles

Page 31: OpenCms Days 2014 - Updating to OpenCms 9.5

New OpenCms 9.5 roles:

● So far: Editors had to be “Workplace User”

● Now: Finer subdivision

● Element author

● Editor

● Category Editor

● Gallery Editor

● Workplace user

31

Element views and roles

Page 32: OpenCms Days 2014 - Updating to OpenCms 9.5

Sample use-case

● 2 Views:

● Content View: Edit Articles and branding content

● News View: Edit News

● 3 Editors with different views and roles

● Jeb (Editor): Content View, News View

● Bill (Element author): Content View

● Bob (Element author): News View

32

Element views and roles

Page 33: OpenCms Days 2014 - Updating to OpenCms 9.5

What to do?

● Create the Views

● /elementviews/ folder in Module

● Set permission to views

● Workplace permission dialog

● Assign contents to views

● Module configuration

● Sitemap configuration

33

Element views and roles

Page 34: OpenCms Days 2014 - Updating to OpenCms 9.5

● Live Demo

34

Element views and roles

Demo

Demo Demo

Demo

デモ

Page 35: OpenCms Days 2014 - Updating to OpenCms 9.5

● Create PDF-Files from XmlContents

● Write a special PDF template

● Use HTML/CSS for formating the PDF

layout

● We need:

● Configuration

● PDF Template

● Create the correct link to the PDF

35

PDF generation on the fly

Page 36: OpenCms Days 2014 - Updating to OpenCms 9.5

Step 1: Configuration

● ResourceInitHandler must be configured in

opencms-system.xml

36

PDF generation on the fly

[…]

<resourceinit>

<resourceinithandler class="org.opencms.pdftools.CmsPdfResourceHandler"/>

[…]

</resourceinit>

[…]

Page 37: OpenCms Days 2014 - Updating to OpenCms 9.5

Step 2: “PDF-Template

● A complete HTML template, styled by CSS

● Use <cms:contentload> and

<cms:contentaccess> to access content

● Like a Formatter or old-style detail JSP

37

PDF generation on the fly

Page 38: OpenCms Days 2014 - Updating to OpenCms 9.5

Step 2: “PDF-Template

38

PDF generation on the fly

<html>

<cms:contentload collector="singleFile" param="%(opencms.uri)" >

<cms:contentaccess var="content" />

<head>

[...]

<link rel="stylesheet" href="..." type="text/css" />

[...]

</head>

<body>

[...]

${content.value.myvalue}

[...]

</body>

</cms:contentload>

</html>

Page 39: OpenCms Days 2014 - Updating to OpenCms 9.5

Step 3: Integration

● Add a link by using the <cms:pdf> tag

● format: Path to the PDF Template

● content: Filename of the content (e.g.

${content.filename}

● locale: Locale to be displayed

39

PDF generation on the fly

<a href="<cms:pdf format='...' content='...' locale='...'/>" >PDF</a>

Page 40: OpenCms Days 2014 - Updating to OpenCms 9.5

● Live Demo

40

PDF generation on the fly

Demo

Demo Demo

Demo

デモ

Page 41: OpenCms Days 2014 - Updating to OpenCms 9.5

● Any Questions?

41

Any Questions?

Fragen? Questions ?

Questiones?

¿Preguntas? 質問

Page 42: OpenCms Days 2014 - Updating to OpenCms 9.5

Michael Emmerich

Alkacon Software GmbH

http://www.alkacon.com

http://www.opencms.org

Thank you very much for your

attention! 42