23rd Nov, 2009

New Tutorial: Getting Started with CMIS

I’ve written a new tutorial on the proposed Content Management Interoperability Services (CMIS) standard called, “Getting Started with CMIS“. The tutorial first takes you through an overview of the specification. Then, I do several examples. The examples start out using curl to make GET, PUT, POST, and DELETE calls against Alfresco to perform CRUD functions on folders, documents, and relationships in the repository. If you’ve been dabbling with CMIS and you’ve struggled to find examples, particularly of POSTs, here you go.

I used Alfresco Community built from head, but yesterday, Alfresco pushed a new Community release that supports CMIS 1.0 Committee Draft 04 so you can download that, use the hosted Alfresco CMIS repository, or spin up an EC2 image (once Luis gets it updated with the new Community release). If you don’t want to use Alfresco you should be able to use any CMIS repository that supports 1.0cd04. I tried some, but not all, of the command-line examples against the Apache Chemistry test server.

Once you’ve felt both the joy and the pain of talking directly to the CMIS AtomPub Binding, I take you through some very short examples using JavaScript and Java. For Java I show Apache Abdera, Apache Chemistry, and the Apache Chemistry TCK.

For the Chemistry TCK stuff, I’m using Alfresco’s CMIS Maven Toolkit which Gabriele Columbro and Richard McKnight put together. That inspired me to do my examples with Maven as well (plus, it’s practical–the Abdera and Chemistry clients have a lot of dependencies, and using Maven meant I didn’t have to chase any of those down).

So take a look at the tutorial, try out the examples with your favorite CMIS 1.0 repo, and let me know what you think. If you like it, pass it along to a friend. As with past tutorials, I’ve released it under Creative Commons Attribution-Share Alike.

[Updated to correct typo with Gabriele's name. Sorry, Gab!]

Responses

Couple of things I forgot to mention:

Check out http://cmisdev.org for useful CMIS-related links

Richard and Gab are doing a free, interactive CMIS training session tomorrow, 24 November. See http://www.alfresco.com/about/events/2009/11/cmis_training/ for more details.

Jeff

[...] mentioned in the New York Times. Yes, the New York Times. Secondly, Jeff Potts released his “Getting Started with CMIS” tutorial. And, finally, I had the chance to drink beer and talk shit with the great David [...]

[...] Getting Started with CMIS (Jeff Potts) [...]

[...] Getting Started with CMIS (Jeff Potts) [...]

Thanks for the tutorial. I’m in the process of going through the CMIS spec and it’s nice to see it in practice.

Nice tutorial but are there any known examples or at least clients using the web service binding?

I haven’t seen any clients choose to use the web services binding yet, but it is still early. I’m sure there will be cases where it makes sense.

Jeff

[...] around the time I was putting together the Getting Started with CMIS tutorial, it struck me that there needed to be an API that didn’t have a lot of dependencies [...]

I was trying to get into CMIS and I noticed that there are only XML bindings – is that right? Or is there the option (at least for Alfresco) to get the response in a different format (e.g. JSON)?

Martin,

CMIS compliant servers must implement two bindings. One is the Restful AtomPub Binding. The other is the Web Services binding. The current spec doesn’t provide for any other bindings (such as JSON).

Jeff

Thanks for the Tutorial Jeff. One aspect i am struggling to get working is querying against categories. How do I do this?

From page 475 of the Alfresco Developer Guide…

Category searches use the PATH field, but you construct a path using the classification hierarchy. Suppose that sample-a.pdf is classified under “Languages/German”, and sample-b.pdf is classified under “Languages/German/Swiss-German”. Now consider the following two searches:
PATH:”/cm:categoryRoot/cm:generalclassifiable/cm:Languages/cm:German/*”
PATH:”/cm:categoryRoot/cm:generalclassifiable/cm:Languages/cm:German//*”
The first search will return sample-a.pdf because it is classified as “German” and the “Swiss-German” category. sample-b.pdf won’t be returned because sample-b.pdf is under a subcategory, “Swiss-German”. The second search uses double slashes (”//”) at the end to denote that matches should include “German” as well as anything classified under a subcategory. It returns both documents and the “Swiss-German” subcategory.
So the category searches, as shown above, will return both objects that have been categorized (”members”) and also the category nodes. If what you want are only documents and not categories, you can use “member” as follows:
PATH:”/cm:categoryRoot/cm:generalclassifiable/cm:Languages/cm:German/member”
PATH:”/cm:categoryRoot/cm:generalclassifiable/cm:Languages/cm:German//member”
The first search would return only sample-a.pdf, while the second search would return sample-a.pdf and sample-b.pdf.

A handy little hack to get the Lucene full-text search query syntax is to use the web client to build your search, then save the search, then use the Node Browser to go look at the search string Alfresco saved.

[UPDATE: I just realized you posted this comment regarding the CMIS tutorial so this answer isn't going to help you at all. CMIS queries don't support categories, so, unfortunately, if you're using CMIS, you're out-of-luck for now].

Hope that helps,

Jeff

Leave a response

Your response:

Categories