Getting Started with CMIS
January 2012

Jeff Potts
Chief Community Officer
Apache Chemistry cmislib lead
Agenda
• What is CMIS?
  – Brief description
  – Quick overview of the domain model
• First steps using Apache Chemistry
  – Demos using cmislib (Python) and OpenCMIS
    (Java)
  – Demo using OpenCMIS Workbench & the Groovy
    Console
• Tips & Tricks for New CMIS Developers
• Where to learn more
What is CMIS?
• Vendor independent API for working with
  content repositories
• Specification managed by OASIS
  – Domain model
  – Protocol bindings
    • Web Services Binding
    • ATOM Pub Binding
    • Browser (JSON) Binding (Coming in 1.1)
  – CMIS Query Language
The Beauty of CMIS
 Presentation
     Tier

                 REST   SOAP




                               ?
   Content
 Services Tier




  Enterprise
  Apps Tier                        ?
Meet CMIS
  Consumer
                Client


              read   write

              Services
             Domain Model
  Provider




                                      Content
              Vendor                  Management
              Mapping                 Interoperability
                                      Services
               Content
              Repository     CMIS lets you
                             read, search, write, update, delete, version, c
                             ontrol, … content and metadata!
Developed by 30+ ECM Vendors
Implementations Already Available…




                                     Providers
                                     Consumers
Use Cases
                            Content
        Client                                      Client
                           Repository



       Content              Content               Content
                                                   Content
      Repository           Repository            Repository
                                                     Content
                                                  Repository
                                                    Repository


 •   Collaborative Content Creation     •   Workflow & BPM
 •   Portals                            •   Archival
 •   Client Application Integration     •   Virtual Documents
 •   Mashup                             •   DAM / WCM
Types
Document                      Folder
• Content                     • Container
• Renditions                  • Hierarchy
• Version History             • Filing

                     Described by
                    Type Definitions

Relationship                  Policy
• Source Object               • Target Object
• Target Object
Type Definitions
            Object                       Property
            • Type Id                    • Property Id
            • Parent               *     • Display Name
            • Display Name               • Type
            •Queryable                   • Required
            • Controllable               • Default Value
                                         •…



 Document           Folder             Relationship        Policy
 •Versionable                          • Source Types
 • Allow Content                       • Target Types


                             Custom Type
• Open Source implementations of CMIS
• Apache Chemistry is the umbrella project
  for all CMIS related projects within the
  ASF
  – OpenCMIS (Java, client and server)
  – cmislib (Python, client)
  – phpclient (PHP, client)
  – DotCMIS (.NET, client)
• Apache Chemistry started as an incubator
  project in May 2009
  – Graduated to a top level project in February
    2011.
• Backed by
  Adobe, Alfresco, Nuxeo, OpenText, and
  SAP
• OpenCMIS is a de-facto reference for
  CMIS and is also used by the CMIS TC to
  test new CMIS 1.1 features
FIRST STEPS WITH CMIS

Real-world coding examples
Notes on my setup
•   Alfresco 4.0.c Community
•   SomeCo content model (See ecmarchitect.com)
•   Mac OS X, Tomcat, MySQL, Eclipse
•   Java
    – OpenCMIS 0.6*
    – Alfresco OpenCMIS extension 0.2*
    – JDK 1.6.0_29
• Python
    – cmislib 0.5
    – Python 2.6/2.7

                                * Distributed with Alfresco 4 SDK
DEMO
Installing and Using cmislib
Use easy_install to install cmislib. Docs available here.




                                                            :10
DEMO
Using OpenCMIS to create, query, relate, & delete
The code comes from the ecmarchitect.com custom content types
tutorial, available here. Apache Chemistry OpenCMIS lives here.




                                                           :10
DEMO

Using the Groovy Console in the OpenCMIS Workbench




                                                     :05
TIPS & TRICKS

A few tidbits for the developer new to CMIS
Prefix cannot be null or empty
• You may see this error when using the
  Alfresco OpenCMIS extension
• It is due to a dependency problem
• If you are using Maven, see this issue.
• If you are setting an explicit
  classpath, refer to the CMIS classpath set
  in the Ant build file in the content types
  tutorial
Using Alfresco CMIS extension with
OpenCMIS Workbench
• You must do this if you want to set
  properties defined in an aspect
• Copy alfresco-opencmis-extension-0.2.jar
  to workbench/lib
• Set the following on “Expert” tab:
org.apache.chemistry.opencmis.objectfactory.classname=o
rg.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl

• Click “Load Repositories” before leaving
  the expert tab
In Alfresco 4 the CMIS URLs have
changed
• In Alfresco 4, OpenCMIS is now the CMIS
  implementation
  – Use http://localhost:8080/alfresco/cmisatom
    instead of http://localhost:8080/alfresco/s/cmis
  – Consider the CMIS web scripts to be
    deprecated
  – You may see different results b/w the two
    URLs
CMIS in server-side JavaScript*
varcmisConnection = cmis.getConnection();
varcmisSession    = cmisConnection.getSession();
folder = cmisSession.getRootFolder();
print("Children of: " + folder.name + "(" +
folder.id + ")");

variter = folder.getChildren().iterator();
while (iter.hasNext()) {
  print(iter.next().name);
}




                               *Broken in 4.0.c Community
Experimental JSON binding in
 Alfresco 4
 • Alfresco 4 includes an experimental
   implementation of the new browser
   binding
 • http://localhost:8080/alfresco/cmisbrowser
http://localhost:8080/alfresco/cmisbrowser
http://localhost:8080/alfresco/cmisbrowser/{repo id}/root
http://localhost:8080/alfresco/cmisbrowser/{repo
id}/root?includeAllowableActions=true&skipCount=0&maxItems
http://localhost:8080/alfresco/cmisbrowser/{repo
id}/root/cmis-demo
http://localhost:8080/alfresco/cmisbrowser/{repo
id}/root/cmisdemo?selector=children
http://localhost:8080/alfresco/cmisbrowser/{repo
id}/root/cmisdemo?selector=object
Working with permissions
• ACLs are lists of ACEs
• In Alfresco, group identifiers start with
  ”GROUP_”
• You cannot break inheritance through
  CMIS, but you can determine whether an
  ACE is inherited or “direct”
WHERE TO LEARN MORE
CMIS Resources
• cmis.alfresco.com includes a public CMIS server
  and links to CMIS resources
• Read the CMIS specification
• Apache Chemistry site has clients, lightweight
  server, documentation
• Alfresco Extension for OpenCMIS allows you to
  work with aspect-defined properties
• “Getting Started with CMIS” tutorial shows how to
  use cURL to hit ATOM Pub binding directly
• Slideshare has some CMIS related presentations
  from DevConhere and here
QUESTIONS
jeff.potts@alfresco.com
@jeffpotts01 (Twitter & all chat services)
http://ecmarchitect.com

Getting Started with CMIS

  • 1.
    Getting Started withCMIS January 2012 Jeff Potts Chief Community Officer Apache Chemistry cmislib lead
  • 2.
    Agenda • What isCMIS? – Brief description – Quick overview of the domain model • First steps using Apache Chemistry – Demos using cmislib (Python) and OpenCMIS (Java) – Demo using OpenCMIS Workbench & the Groovy Console • Tips & Tricks for New CMIS Developers • Where to learn more
  • 4.
    What is CMIS? •Vendor independent API for working with content repositories • Specification managed by OASIS – Domain model – Protocol bindings • Web Services Binding • ATOM Pub Binding • Browser (JSON) Binding (Coming in 1.1) – CMIS Query Language
  • 5.
    The Beauty ofCMIS Presentation Tier REST SOAP ? Content Services Tier Enterprise Apps Tier ?
  • 6.
    Meet CMIS Consumer Client read write Services Domain Model Provider Content Vendor Management Mapping Interoperability Services Content Repository CMIS lets you read, search, write, update, delete, version, c ontrol, … content and metadata!
  • 7.
    Developed by 30+ECM Vendors Implementations Already Available… Providers Consumers
  • 8.
    Use Cases Content Client Client Repository Content Content Content Content Repository Repository Repository Content Repository Repository • Collaborative Content Creation • Workflow & BPM • Portals • Archival • Client Application Integration • Virtual Documents • Mashup • DAM / WCM
  • 9.
    Types Document Folder • Content • Container • Renditions • Hierarchy • Version History • Filing Described by Type Definitions Relationship Policy • Source Object • Target Object • Target Object
  • 10.
    Type Definitions Object Property • Type Id • Property Id • Parent * • Display Name • Display Name • Type •Queryable • Required • Controllable • Default Value •… Document Folder Relationship Policy •Versionable • Source Types • Allow Content • Target Types Custom Type
  • 12.
    • Open Sourceimplementations of CMIS • Apache Chemistry is the umbrella project for all CMIS related projects within the ASF – OpenCMIS (Java, client and server) – cmislib (Python, client) – phpclient (PHP, client) – DotCMIS (.NET, client)
  • 13.
    • Apache Chemistrystarted as an incubator project in May 2009 – Graduated to a top level project in February 2011. • Backed by Adobe, Alfresco, Nuxeo, OpenText, and SAP • OpenCMIS is a de-facto reference for CMIS and is also used by the CMIS TC to test new CMIS 1.1 features
  • 14.
    FIRST STEPS WITHCMIS Real-world coding examples
  • 15.
    Notes on mysetup • Alfresco 4.0.c Community • SomeCo content model (See ecmarchitect.com) • Mac OS X, Tomcat, MySQL, Eclipse • Java – OpenCMIS 0.6* – Alfresco OpenCMIS extension 0.2* – JDK 1.6.0_29 • Python – cmislib 0.5 – Python 2.6/2.7 * Distributed with Alfresco 4 SDK
  • 16.
    DEMO Installing and Usingcmislib Use easy_install to install cmislib. Docs available here. :10
  • 17.
    DEMO Using OpenCMIS tocreate, query, relate, & delete The code comes from the ecmarchitect.com custom content types tutorial, available here. Apache Chemistry OpenCMIS lives here. :10
  • 18.
    DEMO Using the GroovyConsole in the OpenCMIS Workbench :05
  • 19.
    TIPS & TRICKS Afew tidbits for the developer new to CMIS
  • 20.
    Prefix cannot benull or empty • You may see this error when using the Alfresco OpenCMIS extension • It is due to a dependency problem • If you are using Maven, see this issue. • If you are setting an explicit classpath, refer to the CMIS classpath set in the Ant build file in the content types tutorial
  • 21.
    Using Alfresco CMISextension with OpenCMIS Workbench • You must do this if you want to set properties defined in an aspect • Copy alfresco-opencmis-extension-0.2.jar to workbench/lib • Set the following on “Expert” tab: org.apache.chemistry.opencmis.objectfactory.classname=o rg.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl • Click “Load Repositories” before leaving the expert tab
  • 22.
    In Alfresco 4the CMIS URLs have changed • In Alfresco 4, OpenCMIS is now the CMIS implementation – Use http://localhost:8080/alfresco/cmisatom instead of http://localhost:8080/alfresco/s/cmis – Consider the CMIS web scripts to be deprecated – You may see different results b/w the two URLs
  • 23.
    CMIS in server-sideJavaScript* varcmisConnection = cmis.getConnection(); varcmisSession = cmisConnection.getSession(); folder = cmisSession.getRootFolder(); print("Children of: " + folder.name + "(" + folder.id + ")"); variter = folder.getChildren().iterator(); while (iter.hasNext()) { print(iter.next().name); } *Broken in 4.0.c Community
  • 24.
    Experimental JSON bindingin Alfresco 4 • Alfresco 4 includes an experimental implementation of the new browser binding • http://localhost:8080/alfresco/cmisbrowser http://localhost:8080/alfresco/cmisbrowser http://localhost:8080/alfresco/cmisbrowser/{repo id}/root http://localhost:8080/alfresco/cmisbrowser/{repo id}/root?includeAllowableActions=true&skipCount=0&maxItems http://localhost:8080/alfresco/cmisbrowser/{repo id}/root/cmis-demo http://localhost:8080/alfresco/cmisbrowser/{repo id}/root/cmisdemo?selector=children http://localhost:8080/alfresco/cmisbrowser/{repo id}/root/cmisdemo?selector=object
  • 25.
    Working with permissions •ACLs are lists of ACEs • In Alfresco, group identifiers start with ”GROUP_” • You cannot break inheritance through CMIS, but you can determine whether an ACE is inherited or “direct”
  • 26.
  • 27.
    CMIS Resources • cmis.alfresco.comincludes a public CMIS server and links to CMIS resources • Read the CMIS specification • Apache Chemistry site has clients, lightweight server, documentation • Alfresco Extension for OpenCMIS allows you to work with aspect-defined properties • “Getting Started with CMIS” tutorial shows how to use cURL to hit ATOM Pub binding directly • Slideshare has some CMIS related presentations from DevConhere and here
  • 28.
    QUESTIONS [email protected] @jeffpotts01 (Twitter &all chat services) http://ecmarchitect.com