Download presentation
Presentation is loading. Please wait.
1
#SummitNow First Steps with CMIS & Alfresco Jeff Potts @jeffpotts01 http://ecmarchitect.com
2
#SummitNow You’ve been handed a project Your Favorite Language/Framework What Goes Here?
3
#SummitNow You’ve been handed a project Your Favorite Language/Framework
4
#SummitNow CMIS gives developers a standard API for working with content repositories like Alfresco
5
#SummitNow Why CMIS? Preferred API for working with Alfresco Open standard, managed by OASIS Many vendors support it Plenty of examples Client libraries for many languages Java, Python,.NET, PHP, Objective-C, Android
6
#SummitNow http://chemistry.apache.org
7
#SummitNow Start with the Workbench
8
#SummitNow Connect with CMIS Workbench
9
#SummitNow Explore the Alfresco repo CRUD objects Inspect/change properties Run queries Run scripts using the Groovy console See the content model
10
#SummitNow The Workbench is great for… Testing queries Inspecting the data dictionary Including whether or not a property is read/write or queryable Can I do _____________ with CMIS?
11
#SummitNow Alfresco CMIS Service URLs by Version Alfresco Version CMIS Service URL 3.2r2 - 3.4http://localhost:8080/alfresco/service/cmishttp://localhost:8080/alfresco/service/cmis (ATOM) http://localhost:8080/alfresco/cmishttp://localhost:8080/alfresco/cmis (SOAP) 4.0http://localhost:8080/alfresco/cmisatom http://localhost:8080/alfresco/cmishttp://localhost:8080/alfresco/cmis (SOAP) 4.2.d/4.2 Enterprise http://localhost:8080/alfresco/api/-default-/cmis/versions/1.0/atom http://localhost:8080/alfresco/api/-default-/cmis/versions/1.1/atom http://localhost:8080/alfresco/api/-default-/cmis/versions/1.1/browser http://localhost:8080/alfresco/cmis http://localhost:8080/alfresco/cmis (SOAP)
12
#SummitNow Set Up Your Dev Environment
13
#SummitNow Let’s set up your environment Could use curl or any other HTTP client, but why? Grab OpenCMIS from Apache Chemistry Maven makes it easy Group: org.apache.chemistry.opencmis Artifact: chemistry-opencmis-client-impl Version: 0.10.0
14
#SummitNow File Loader Example Let’s load some images into Alfresco on- premise Get a session Create a folder Check-in some documents Set some properties https://code.google.com/p/alfresco-api-java-examples/
15
#SummitNow CMIS Works in the Cloud Too! Let’s load some images into Alfresco in the cloud Same CMIS calls, different authentication Register for an API key http://www.alfresco.com/develop
16
#SummitNow Watch Out for Gotchas/Limitations
17
#SummitNow CMIS object IDs are opaque Best not to even look at one!
18
#SummitNow Queries CMIS queries are read-only Do you really need everything? select * from cmis:document Do you really need all rows? Use OperationContext to limit
19
#SummitNow Working with Aspects CMIS 1.0 doesn’t know what an aspect is Must use OpenCMIS Extension CMIS 1.1 calls aspects secondary types Add/remove aspects by setting cmis:secondaryObjectTypeIds For queries, use a join
20
#SummitNow Adding an aspect (CMIS 1.0) if (!doc.hasAspect("P:cm:geographic")) { doc.addAspect("P:cm:geographic"); System.out.println("Added aspect"); } else { System.out.println("Doc already had aspect"); } HashMap props = new HashMap (); props.put("cm:latitude", 52.513871); props.put("cm:longitude", 13.391106); doc.updateProperties(props); parameter.put(SessionParameter.OBJECT_FACTORY_CLASS, "org.alfresco.cmis.client.impl.AlfrescoObjectFactoryImpl");
21
#SummitNow Adding an aspect (CMIS 1.1) List aspects = doc.getProperty("cmis:secondaryObjectTypeIds").getValues(); if (!aspects.contains("P:cm:geographic")) { aspects.add("P:cm:geographic"); HashMap props = new HashMap (); props.put("cmis:secondaryObjectTypeIds", aspects); doc.updateProperties(props); System.out.println("Added aspect"); } else { System.out.println("Doc already had aspect"); } HashMap props = new HashMap (); props.put("cm:latitude", 52.513871); props.put("cm:longitude", 13.391106); doc.updateProperties(props);
22
#SummitNow Query for aspect-based props SELECT D.cmis:name, G.cm:latitude, G.cm:longitude FROM cmis:document as D JOIN cm:geographic as G ON D.cmis:objectId = G.cmis:objectId
23
#SummitNow Working with Relationships Peer associations only Both sides must be instances of cmis:folder or cmis:document or a descendant type
24
#SummitNow Working with ACLs Can manage ACLs Cannot set or un-set ACL inheritance
25
#SummitNow Other Limitations Can only access objects that are descendants of cm:content or cm:folder Cannot create users/groups Cannot create or change types through the API (yet) Cannot work with categories or tags
26
#SummitNow A Word About Interoperability Pay attention to RepositoryInfo Multifiling, search, ACL, etc. may differ between repository vendors Inspect getAllowableActions Look at the type definitions Not all repositories name types the same way
27
#SummitNow Example Apps & Additional Learning Resources
28
#SummitNow Read the Book Everything you need to know about CMIS 1.0 & 1.1 Lots of Groovy and Java examples Also covers Python,.NET, PHP, Android, & iOS 37%-off: 12cmisal
29
#SummitNow Quick Look at The Blend
30
#SummitNow Ask questions in the “Alfresco API” forum!
31
#SummitNow First Steps with CMIS 1.Choose CMIS as your preferred API 2.Use the OpenCMIS Workbench as a learning tool 3.Set up your development environment 4.Watch out for gotchas/limitations 5.Take advantage of additional learning resources
32
#SummitNow
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.