You are here

Hands on CMIS with Alfresco

osCaddie Solution

In our osCaddie solution, one of the core features is the ability to synchronize the content and its metadata change upon request between Drupal and Alfresco. A typical use case is called R-R (Repository to Repository): publishing content from one repository to another. A common scenario is publishing content from Alfresco directly to Drupal systems for publication to the Intra/Internet. In case of performance of document retrieval is a requirement, a solution needs to provide two essential functions:

  • Be able to provide bidirectional document/metatadata synchronization between Drupal and Alfresco. It is vital to support custom content type from Drupal, as well as Alfresco custom content model.
  • Be able to receive change notification between Drupal and Alfresco so that each document can be made aware of what changes (document, metadata upload, update and deletion) have happened in other repositories.


In order for support bidirectional data synchronization, one option is to employ CMIS Alfresco, as I love learning by hands on, my intuition is: why not try it to see what it can accomplish first. cmislib is developed by Jeff Potts (Chief Community Officer at Alfresco) and comes in handy. The beauty of cmislib is a developer can try all sorts of things from command line or favorite IDE and Python is just that elegant to read and write. Even you program in other languages such as PHP/Ruby/Java, the CMIS concepts such as Repository,Document,Folder,Query etc are about the same. Open Chemistry has listed CMIS client for Java, PHP, Python and .NET.

Demo code

I have written some demo code based on an Alfresco out of the box installation.The source code is located at github. "git clone" will get the source code Alfresco Version: 4.0 Enterprise Python: 2.7+ Python CMIS libs: cmislib, cmislibalf The code above will use the out of box demo data is installed as part of : /Sites/swsdp/documentLibrary/Agency Files/Contracts/ As you can play with the above source code, you can learn the following:

  • how to create a CMISClient with login credential. For example, cmisClient = cmislib.CmisClient('localhost:8080/alfresco/s/cmis', 'admin', 'admin') will get us the entry point for Alfresco Repository.
  • how to get the folder and navigate among its children in CMIS
  • how to retrieve the document and its properties (metadata) in CMIS.
  • how to check out and check in the document in CMIS.
  • how to create and query custom content in CMIS. This is nontrivial for integrating with Alfresco's custom content model. It enables Alfresco 's custom content with automated discovery. The custom content mdoel uses what Jeff has shown in Custom Content type. This method can enable not only Drupal integration without Java code changes due to metadata change, also it can be used for any other Repository to Repository (R2R) integration as long as one of the Repository is CMIS compliant. To name but a few, Drupal to Oracle UCM, Joomla to Alfresco or Oracle UCM.
  • how to perform search on custom content in CMIS.
  • how to add/remove contributor role for a group calld "demogrp" for /demo folder. To install cmislib is pretty easy with "pip install cmislib". If you don't have pip installed, "sudo apt-get install pip" will install it on debian/ubuntu linux, otherwise please consult PIP install


Appnovation Technologies