Transcript
Page 1: OpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMIS

Georg Westenberger and Michael Emmerich,

Alkacon Software

Workshop track

Accessing the VFS repository

using CMIS

25.09.2012

Page 2: OpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMIS

● Introduction to CMIS

● What is CMIS?

● Demo 1: Uploading files

● CMIS Data Model

● OpenCms implementation of CMIS

● CMIS concepts in OpenCms

● Demo 2: Fetching resources from OpenCms

● Limitations of the CMIS implementation

● Demo 3: Searching with CMIS

2

Agenda

Page 3: OpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMIS

● Content Management Interoperability Services

● Standard for accessing content repositories

through a web service interface

● Defined in 2010 by web standards consortium

OASIS

● „Least common denominator“: not meant to

support all possible content repository

operations

3

What is CMIS?

Page 4: OpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMIS

● WebDAV

● Already supported by OpenCms

● JCR (Content Repository API for Java)

● Complex

● Java-centric

4

Previous standards

Page 5: OpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMIS

● Problem: Accessing different CMS repositories

● E.g. for content migration, aggregation

● Normally requires special programming effort for

every CMS repository you want to access

● Using CMIS to access CMS repositories:

Remote access to repositories

Using the same client software for different CMS

implementations

5

Purpose of CMIS

Page 6: OpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMIS

● Live Demo

6

Live Demo: Uploading Files

Demo

Demo Demo

Demo

デモ

Page 7: OpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMIS

● A repository contain objects

● Objects may be:

● Folders and documents arranged in a hierarchy

● Typed relationships between folders/documents (directed „links“)

● Policies

● Objects have a type

● Objects have properties defined by their type

● CMIS standard defines possible operations for reading/writing/creating/deleting these objects, changing properties, etc.

7

CMIS Data Model

Page 8: OpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMIS

● Protocols for accessing CMIS repositories:

● SOAP

● AtomPub

In principle accessible using any programming

language

8

Service bindings

Page 9: OpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMIS

● Uses Apache Chemistry

● Libraries for implementing CMIS clients or servers

● Provides servlets for SOAP and AtomPub bindings

● Service methods are implemented as Java

methods

● Servlets provide access to repositories

configured in opencms-importexport.xml

● Offline repository: read/write access to the Offline

project

● Online repository: read-only access to the Online

project

9

OpenCms CMIS implementation

Page 10: OpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMIS

● All basic CMIS file operations (create, update,

delete, etc.) are supported

● Folder navigation is supported

● The CMIS root folder always corresponds to the

OpenCms root folder

● OpenCms user accounts are used for all CMIS

operations

All changes through CMIS are made in the context

of the authenticated user

10

OpenCms CMIS implementation

Page 11: OpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMIS

● Files and folders have types cmis:document,

cmis:folder

● Standard resource attributes (Last modification

date, etc.) are represented as standard CMIS

properties

11

OpenCms CMIS implementation

cmis:objectId cmis:name

cmis:creationDate cmis:lastModificationDate

cmis:lastModifiedBy cmis:createdBy

cmis:path

Page 12: OpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMIS

● For each OpenCms property, there are two

CMIS properties, e.g. for the template property:

● opencms:template only contains the value directly

set on the resource itself

● opencms-inherited:template contains the property

value that is active for the resource, i.e. it may be

inherited from a parent folder

● The resource type can be read from the

property opencms-special:resource-type

12

OpenCms CMIS implementation

Page 13: OpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMIS

● Relations in OpenCms correspond directly to

CMIS relationships

● One type for every OpenCms relation type, e.g.

opencms:XML_WEAK

● Only relations not defined through XML content

are modifiable

13

OpenCms CMIS implementation

Page 14: OpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMIS

● Live Demo

14

Live Demo: Fetching resources from OpenCms

Demo

Demo Demo

Demo

デモ

Page 15: OpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMIS

● Demo program implemented using Apache Chemistry

● The main part:

Session session = getSession();

Folder origin = (Folder)session.getObjectByPath(cmisPath);

for (CmisObject child : origin.getChildren()) {

//…

if (child instanceof Folder) {

//…

} else if (child instanceof Document) {

Document document = (Document)child;

InputStream input = document.getContentStream().getStream();

writeStreamToFile(input, rfsFile);

}

}

15

Fetching resources from OpenCms

Page 16: OpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMIS

● CMIS has no concept of locking

Resources are implicitly locked/unlocked for each

operation

● The CMIS permission concept does not

translate well to the OpenCms permission

concept

● No negative permissions (deny)

● CMIS defines „allowable actions“ for a

document and the current user

You have to read the „allowable actions“ if you

want to check if you can perform an action

16

Limitations

Page 17: OpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMIS

● No support for multifiling (putting files in

multiple folders)

● Almost like OpenCms siblings, but this doesn‘t

work, since siblings can have different properties

● Versioning not supported

● Offline changes are not versioned, historic

versions are only created on publishing

● No support for search using the CMIS query

language

17

Limitations

Page 18: OpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMIS

● Solr queries can be used instead of the CMIS

query language

● This requires a Solr Index to be configured for

the repository

● Queries support all parameters supported by

the OpenCms Solr integration

● E.g. „fq=type:v8flower “

18

Search

Page 19: OpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMIS

● Live Demo

19

Live Demo: Searching with CMIS

Demo

Demo Demo

Demo

デモ

Page 20: OpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMIS

Session session = getSession();

for (QueryResult result : session.query(query, false)) {

String idString =

(String)(result.getPropertyValueById("cmis:objectId"));

ObjectId id = new ObjectIdImpl(idString);

CmisObject resultObject = session.getObject(id);

if (resultObject instanceof Document) {

Document resultDoc = (Document)resultObject;

//…

writeStreamToFile(resultDoc.getContentStream().getStream()

, new File(filename));

}

}

20

Searching through CMIS using Solr

Page 21: OpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMIS

● Any Questions?

21

Any Questions?

Fragen? Questions ?

Questiones?

¿Preguntas? 質問

Page 22: OpenCms Days 2012 - OpenCms 8.5: Accessing the VFS repository using CMIS

Georg Westenberger

Michael Emmerich

Alkacon Software GmbH

http://www.alkacon.com

http://www.opencms.org

Thank you very much for your

attention! 22


Top Related