opencms days 2012 - opencms 8.5: accessing the vfs repository using cmis
DESCRIPTION
Content Management Interoperability Services (CMIS) is an open standard that defines an abstraction layer for controlling various document management systems and repositories using web protocols. By integrating Apache Chemistry, OpenCms 8.5 has become a CMIS server. This means there is now a simple, web service oriented interface to read content from and write content to the OpenCms VFS "on the fly". Accessing the OpenCms repository was easy enough using the native API before, but with CMIS you can access the repository even from a remote server. Georg will introduce the CMIS standard to you and show how it has been integrated in OpenCms 8.5. He will explain the most common use cases and point out the possibilities and limitations of this powerful new interface in OpenCms.TRANSCRIPT
Georg Westenberger and Michael Emmerich,
Alkacon Software
Workshop track
Accessing the VFS repository
using CMIS
25.09.2012
● 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
● 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?
● WebDAV
● Already supported by OpenCms
● JCR (Content Repository API for Java)
● Complex
● Java-centric
4
Previous standards
● 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
● Live Demo
6
Live Demo: Uploading Files
Demo
Demo Demo
Demo
デモ
● 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
● Protocols for accessing CMIS repositories:
● SOAP
● AtomPub
In principle accessible using any programming
language
8
Service bindings
● 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
● 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
● 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
● 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
● 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
● Live Demo
14
Live Demo: Fetching resources from OpenCms
Demo
Demo Demo
Demo
デモ
● 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
● 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
● 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
● 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
● Live Demo
19
Live Demo: Searching with CMIS
Demo
Demo Demo
Demo
デモ
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
● Any Questions?
21
Any Questions?
Fragen? Questions ?
Questiones?
¿Preguntas? 質問
Georg Westenberger
Michael Emmerich
Alkacon Software GmbH
http://www.alkacon.com
http://www.opencms.org
Thank you very much for your
attention! 22