tech talk live alfresco cmis
DESCRIPTION
Slide deck to accompany Tech Talk Live webinar with Florian Müller and Jeff PottsTRANSCRIPT
Alfresco Florian Müller, Software Architect
Agenda
• Prepared topics o Alfresco CMIS mapping
o CMIS in Alfresco 3.X versus Alfresco 4.X
o CMIS web scripts
o Performance tuning
o CMIS Browser Binding: CMIS via JSON
• Your topics o Share experiences and ask questions
o What is missing in the CMIS specification?
o Which features should be added to the Alfresco OpenCMIS Extension?
Alfresco CMIS mapping 1/4
• Documents o All types derived from cm:content
o CMIS type id: “D:<alfresco type>”
o CMIS query name: “<alfresco type>”
o Exception: “cm:content” “cmis:document”
• Folders o All types derived from cm:folder
o CMIS type id: “F:<alfresco type>”
o CMIS query name: “<alfresco type>”
o Exception: “cm:folder” “cmis:folder”
Alfresco CMIS mapping 2/4
• Relationships o All peer-to-peer relationships
o CMIS type id: “R:<association type>”
o CMIS query name is irrelevant because relationships are not queryable
o CMIS base type “cmis:relationship” has no Alfresco equivalent
o Only relationships with CMIS source and target objects are exposed!
Alfresco CMIS mapping 3/4
• Policies o All aspect types
o CMIS type id: “P:<alfresco type>”
o CMIS query name: “<alfresco type>”
o CMIS base type “cmis:policy” has no Alfresco equivalent
• Any type outside the cm:content and cm:folder hierarchy is not exposed via the CMIS interface!
• http://wiki.alfresco.com/wiki/CMIS_Model_Mapping
Questions
CMIS in Alfresco 4.X 1/4
• New CMIS implementation based on the Apache Chemistry OpenCMIS server framework
• Why has it been re-implemented?
o OpenCMIS is used by several CMIS repositories. Alfresco automatically benefits from all bug fixes and improvements.
o One code base for the AtomPub and the Web Services binding (and the Browser Binding).
o Better CMIS specification compliance.
o Better performance, less memory consumption, handling of big documents.
CMIS in Alfresco 4.X 2/4
• How does this affect CMIS clients?
o New URLs… The old implementation and URLs will be available but are deprecated.
o Specification compliant, generic CMIS clients shouldn’t see a difference.
o Aspects and the Alfresco OpenCMIS Extension work as before.
o If the CMIS Client make any assumptions about the format the object id, it has to change! (See next slides.)
CMIS in Alfresco 4.X 3/4
• Alfresco 3.X Object Ids:
o Current version document id: node ref workspace://SpacesStore/e5787fce-7583-4b74-8836-8dcc94df4493
o Version document id: current version node ref + “;” + version label workspace://SpacesStore/e5787fce-7583-4b74-8836-8dcc94df4493;1.0
o The creation of a new version doesn’t change the current version document id. Not spec compliant!
o A client must not assume that a document id always represents the current version!
CMIS in Alfresco 4.X 4/4
• Alfresco 4.X Object Ids:
o Current version document id: node ref + “;” + version label workspace://SpacesStore/e5787fce-7583-4b74-8836-8dcc94df4493;1.1
o Version document id: current version node ref + “;” + version label workspace://SpacesStore/e5787fce-7583-4b74-8836-8dcc94df4493;1.0
o The creation of a new version changes the current version document id. Spec compliant!
o General advise: Treat the object id as an opaque string.
Questions
CMIS Web Scripts 1/3
• Alfresco 4.X has the OpenCMIS client embedded and available in web scripts
• Use case examples:
o Alfresco Share mashups and federated queries
o Synchronize documents between repositories
o Publishing scenarios
o Simple migration scenarios
CMIS Web Scripts 2/3
• New JavaScript top level object: cmis
o This object manages connections to CMIS servers.
o Three connection types: • Current Alfresco server (uses OpenCMIS local binding if possible) • Preconfigured connection • Web script configured connection
var cmisConnection = cmis.getConnection(myConnectionId); var cmisSession = cmisConnection.getSession();
model.folder = cmisSession.getRootFolder(); model.children = model.folder.getChildren().iterator();
CMIS Web Scripts 3/3
Questions
Performance Tuning 1/4
• CMIS = XML over HTTP over a network
o Whenever you can avoid a call to the CMIS server, avoid it!
o Sensible caching is important.
o OpenCMIS and DotCMIS have first-level caching build in. Make use of it and add your application specific caching.
o OpenCMIS and DotCMIS Operation Context
Performance Tuning 2/4
• Be careful what you ask for…
o Only ask for the properties you need! Some properties are more expensive than others.
o Never do perform “SELECT * FROM …” queries in production code.
o Fetch allowable actions, ACLs, relationships and renditions only if you need them!
o Select sensible page sizes and depths! Only request the objects you need. If you need all, choose a large page size.
o OpenCMIS and DotCMIS Operation Context
Performance Tuning 3/4
• HTTP Keep-Alive
o Many high-level requests consists of a burst of CMIS requests.
o Reusing the same connection makes a difference!
o Make sure HTTP Keep-Alive is turned on.
o Always read content streams to the end and close them!
Performance Tuning 4/4
• Compression
o The CMIS XML compresses very well.
o Compressed CMIS response are usually between 85% and 5% of the original size.
o Whenever network bandwidth is a bottleneck, turn compression on.
o http://wiki.alfresco.com/wiki/CMIS#Compression
o OpenCMIS and DotCMIS Session Parameters
Questions
CMIS Browser Binding: CMIS via JSON
• CMIS 1.1 will introduce a third binding: The Browser Binding.
• Optimized for CMIS application in web browsers.
o Data transport format is JSON.
o Works JavaScript and without a server-side client component.
o Security and authentication designed for web browsers.
• More efficient than the Web Services and the AtomPub binding.
CMIS Browser Binding: CMIS via JSON
• Apache Chemistry OpenCMIS will provide an implementation for CMIS 1.0
o Prototype is available.
o It will be shipped with Alfresco 4.X but deactivated by default.
o Online demo: http://cmis.alfresco.com/
CMIS Web Scripts
Questions