Learn how to make CMIS simple for Java client and server developers. Apache Chemistry is the umbrella project for all CMIS (Content Management Interoperability Services) related projects within the Apache Software Foundation and OpenCMIS is a collection of Java libraries, frameworks and tools around CMIS specification.
8. Content Streams
Document * Rendition
• Mime Type • Kind
• Length • Mime Type
Content Stream
• Stream Id
* Maximum length is repository specific
9. Access Control
ACL
Object
ACE
• Principal
• Permissions
• Direct
Permissions
cmis:read
cmis:write
cmis:all
<repository specific>
10. Document Versioning
Document
Repository Vendor May Support
V1 • Version Specific Folder Filing
Minor • Query All Versions
• Create Minor, Major, PWCs
Version Series
V2 checkout
Major
PWC
V3
checkin
Major
12. Change Log
Change Events
Repo Create Update Delete Client
logs discover
Change Event:
• Object Id
• Change Time
• Change Type – created, updated, deleted, security
• Properties – for updated events
* Note: Optional Capability
13. CMIS Query Language
• SELECT and FROM clauses
o Identify which properties from which types to return
• WHERE clause
o Restrict returned rows to those that meet all constraints
o Predicates: comparison, in, like, null, any, is null
o Function Predicates: contains(), in_folder(), in_tree()
o Operators: and, or, not
• ORDER BY clause
o Order results by one or more columns
• Each Type is projected as a Table
14. Do You Understand These Queries?
SELECT cmis:name
FROM cmis:document
WHERE contains('alfresco')
SELECT cmis:name, cmis:lastModificationDate
FROM cmis:document
WHERE cmis:lastModifiedBy = 'admin'
ORDER BY cmis:lastModificationDate DESC
SELECT cmis:name, cmis:contentStreamLength
FROM cmis:document
WHERE IN_TREE('<folderObjectId>')
AND cmis:contentStreamLength > 100000
ORDER BY cmis:contentStreamLength
15. CMIS Services
Browse Inspect Act
Repository Object Object
- Get Server Information - Read Content - Write Content
- Get Type Definitions - Get Properties - Set Properties
- Get ACLs - Create Folder / Doc /
- Get Allowable Actions Relation
- Delete
- Move
- Set ACLs
Navigation Versioning
- Walk Folder / Doc - Walk Version History
Hierarchy
- Get Checked-out
Versioning
- Check-out / In
Relationship - Cancel Check-out
- Traverse Relationship(s) - Delete Version(s)
Discovery
- Issue Query
- Get Change Log Policy Policy
- Get Applied Policies - Apply / Remove
17. CMIS Bindings
• CMIS 1.0 defines two bindings:
o AtomPub binding
o Web Services binding
• CMIS 1.1 will add a new binding:
o Browser binding (JSON)
• Don’t bother …
There are Open Source libraries for that
18. Apache Chemistry
TM
Open Source implementations of
• Apache Chemistry is the umbrella project for all CMIS
related projects within the Apache Software Foundation.
• Apache Chemistry provides libraries and frameworks for
Java, Python, PHP and .NET.
• Website: http://chemistry.apache.org
19. Main Objective
Developers should focus on the CMIS domain model!
• Decreased learning curve: Developers can learn just
the CMIS domain model and ignore the transport details
of all the binding implementations.
• Rapid start. From download to listing the first folder in
minutes.
• Be compliant. Chemistry libraries have been tested
against many, many repositories.
21. Subprojects
• OpenCMIS (Java, server and client)
o very mature
o well tested against all major servers
• cmislib (Python, client)
o mature
o well tested against most major servers
• phpclient (PHP, client)
o basic specification coverage
o used in a few production systems
• DotCMIS (.NET, client)
o an OpenCMIS port (same architecture, similar API)
o works against all tested servers but needs more testing
22. History
May 2009: Started as an incubator project by
Nuxeo and Day (now Adobe)
February 2010: Metaversant contributed cmislib
February 2010: Alfresco, OpenText and SAP contributed
OpenCMIS
May 2010: Alfresco contributed phpclient
January 2011: Alfresco contributed DotCMIS
February 2011: Graduated to a top level project
23. OpenCMIS
OpenCMIS consists of a collection of Java libraries,
frameworks and tools:
• Client library
• Server framework
• Two test repositories (InMemory and FileShare)
• CMIS Browser (web application, AtomPub only)
• CMIS Workbench (desktop application for developers)
• FIT and TCK
24. Get hold of OpenCMIS
OpenCMIS is available
• as source code:
https://svn.apache.org/repos/asf/chemistry/opencmis/trunk/
• as release package with all dependencies:
http://chemistry.apache.org/java/download.html
• via Maven:
http://chemistry.apache.org/java/developing/dev-use-with-maven.html
• Last released version is 0.4.0
26. OpenCMIS Client Library
• Client API
o OO API
You want this API!
o Easy to use
o Build-in caching
• Client Binding API
o Low-level
o Very close to the CMIS specification
o More control, less comfort
29. Aspects, Aspects, Aspects
• CMIS 1.0 has no native support for aspects
• Secondary types (= aspects) will be in CMIS 1.1
• Alfresco provides read and write access to aspects and
aspect properties through CMIS extensions
• Theoretically, every CMIS client can read and write
aspects but that is rather troublesome
30. Alfresco OpenCMIS Extension
• The Alfresco OpenCMIS Extension transparently adds
aspect support to OpenCMIS
• Hosted on Apache Extras (Google Code),
Apache license:
http://apache-extras.org/p/alfresco-opencmis-extension
• See the project page for setup instructions.
It’s really simple.
31. OpenCMIS Sessions
• CMIS is stateless!
• OpenCMIS introduces a session concept to support caching
o It’s all about performance
o Reduce the number of calls to the repository
• OpenCMIS caches:
o Repository infos
o Type definitions
o AtomPub links
o CMIS objects
32. Connect to a repository – Variant 1
// set up session parameters
Map<String, String> parameter = new HashMap<String, String>();
parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
parameter.put(SessionParameter.ATOMPUB_URL,
"http://cmis.alfresco.com/service/cmis");
parameter.put(SessionParameter.REPOSITORY_ID,
"84ccfe80-b325-4d79-ab4d-080a4bdd045b");
parameter.put(SessionParameter.USER, "admin");
parameter.put(SessionParameter.PASSWORD, "admin");
// create the session
SessionFactory factory = SessionFactoryImpl.newInstance();
Session session = factory.createSession(parameter);
33. Connect to a repository – Variant 2
// set up session parameters
Map<String, String> parameter = new HashMap<String, String>();
parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
parameter.put(SessionParameter.ATOMPUB_URL,
"http://cmis.alfresco.com/service/cmis");
parameter.put(SessionParameter.REPOSITORY_ID,
"84ccfe80-b325-4d79-ab4d-080a4bdd045b");
parameter.put(SessionParameter.USER, "admin");
parameter.put(SessionParameter.PASSWORD, "admin");
// get the list of repositories and choose the first one
SessionFactory factory = SessionFactoryImpl.newInstance();
List<Repository> repositories = factory.getRepositories(parameter);
Session session = repositories.get(0).createSession();
34. Using the Session
RepositoryInfo ri = session.getRepositoryInfo();
String id = ri.getId();
String name = ri.getName();
CmisObject object1 = session.getObject("1234567890");!
CmisObject object2 = session.getObjectByPath("/my/path/doc");!
Folder rootFolder = session.getRootFolder();!
String rootFolderId = rootFolder.getId();!
!
for(CmisObject object: rootFolder.getChildren()) {!
String name = object.getName();!
if(object instanceof Document) {!
Document doc = (Document) object;!
long size = doc.getContentStreamLength(); !
}!
}!
43. CMIS Outlook
• The CMIS TC is working on CMIS 1.1
• CMIS 1.1 adds new features
o Type mutability
o Browser Binding
o Secondary Types
o …
• Release date: 2012???
• Will it be backwards compatible?
o We don’t know yet.
o Apache Chemistry will hide binding changes.
44. Apache Chemistry Outlook
• Tests and documentation…
o Make sure it works with as many CMIS servers and
clients as possible
o Make the usage of Apache Chemistry as simple as possible
• Apache Chemistry sandboxes
o Implementations of CMIS 1.1 features
o Feedback for the CMIS TC
45. Alfresco CMIS Outlook
• Alfresco 4.x
o Switch to the OpenCMIS server framework
o Many improvements: speed, memory consumption, compliance
o OpenCMIS client libraries are embedded and available in Web Scripts
o Have a look: http://cmis.alfresco.com
• Tech Talk: Alfresco CMIS
Online webinar, Wednesday, 3 August 2011
o Alfresco CMIS mapping
o CMIS changes in Alfresco 4.x
o CMIS 1.1 browser binding (JSON)
o Performance optimization
o Whatever you want to talk about…