OpenCms Days 2014 - Updating to OpenCms 9.5
Post on 13-Jul-2015
326 Views
Preview:
Transcript
● 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
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
● 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
● 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
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
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
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
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
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
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
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
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
● 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
● 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
● 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
● 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;
● 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"
● 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
25
API changes – Solr PostProcessor
SOLR
Handler SOLR
Post
Processor
(Access
Check)
Custom
Post
Processor
Query
Result
Query
Result
● 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();
● 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;
}
}
● 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
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
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
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
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
● 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
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>
[…]
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
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>
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>
top related