Maven and Chemistry strike back … a Maven archetype as CMIS Labs and toolkit

CMIS is cool indeed, and especially working on it with Open Source tools like Alfresco, Maven and Chemistry can result in quite a bit of fun.

I’ve been working quite a lot lately on producing some sample and training material for the coming Alfresco meetups (tomorrow I’ll be presenting the CMIS Master class  live from Madrid), and so I decided to mix and match the two things I can do best:

  • Using my beloved Apache Maven
  • Using the Chemistry AtomPub TCK (former Alfresco CMIS TCK) that we contributed to ASF to provide high level access to the CMIS ReST API

This effort, which I’ll probably heavily use in the next days Master Classes and training session, turned out to be quite productive as in a couple of days of work I was able to:

  • develop a Labs framework which wraps Chemistry TCK embedded CMISClient
  • provide an easy CMIS 0.62 application(s) scaffolding platform using a Maven multimodule project
  • produce and release a Maven archetype which is now hosted our partner Sourcesense repositories ( big thanks go to this folks for being always supportive with their Maven maven infrastructure) and can be used as CMIS launchpad / labs / toolkit

Trying it is very easy, due to Maven archetypes power, and you can have the full Labs toolkit downloaded and installed on your by just selecting ‘cmis-master-labs-archetype‘ in the options of the command below:

EDIT

mvn archetype:generate 
-DarchetypeCatalog=http://maven.alfresco.com/nexus/content/repositories/releases/archetype-catalog.xml
mvn archetype:generate 
-DarchetypeCatalog=http://repository.sourcesense.com/nexus/content/repositories/alfresco.public.releases/archetype-catalog.xml

mvn archetype:generate -DarchetypeRepository=http://repository.sourcesense.com/nexus/content/repositories/alfresco.public.snapshots -DarchetypeGroupId=org.alfresco.enablement.codecamps.cmis -DarchetypeArtifactId=cmis-master-labs-archetype -DarchetypeVersion=1.0

This will create a multiproject structure ready for use. You’ll just need to configure (in a single sourced fashion for the whole suite)  the CMIS endpoint properties in the main POM, by editing the following properties:

<!-- SINGLE POINT OF CONFIGURATION FOR CMIS ENDPOINT -->
<properties>
<!-- Configure here the CMIS endopoint For the whole suite -->
<cmisserviceurl>http://192.168.154.128:8080/alfresco/service/api/cmis</cmisserviceurl>
<cmisusername>admin</cmisusername>
<cmispassword>admin</cmispassword>
<cmistracerequests>true</cmistracerequests>
<cmisvalidateatom>true</cmisvalidateatom>
</properties>

All the nice tracing and validation features of the Chemistry TCK are exposed, once that you configured the POM to point to a proper CMIS 0.62 compliant server (e.g. Alfresco, and an Ubuntu Alfresco VM is available here for this purpose). Specifically the toolkit offers 3 Maven submodules

  • cmis-support –> Support JAR which wraps Chemistry TCK CMISClient
  • cmis-query-webapp –> Very basic SpringMVC webapp querying a CMIS repository and showing results/entries
  • cmis-lab-atompub-binding –> Learning lab on how to import data in Alfresco (complete class in the solution folders)

and a lab-solutions folder.

Using it is pretty straighforward. A simple

mvn install

will test the support against the provided configuration, while entering the cmis-query-webapp folder and running

mvn jetty:run-exploded

will result in the (quite ugly) but functional CMIS Query interface you can see below:

CMIS Query Webapp

using a simple three tiered architecture like the one that follows:

CMIS Query Webapp architecture

Lastly entering the lab-atompub-binding folder and running

mvn test

will run the sample JUnit empty test for the data import lab. Solution (real Test class) is to be found in the labs-solutions  folder.

It’s a beginning but I believe it’s a very nice tool to overcome the somehow still steep learning curve around CMIS, so I warmly suggest you start installing the VM and the archetype and play around with it, and even use it as start for your integration/contribution projects. Especially if you are going to attend Alfresco meetups this month. I’ll surely post the Labs slides later this month, so stay posted!

EDIT

The CMIS 1.0 Public Review compliant toolkit (working against Chemistry AtomPub TCK Trunk 1.0) is available on the Sourcesense repository and it’s added to the remote catalo mentioned in the previous command.

As a side note, at the moment this toolkit provide support for CMIS 0.62 while http://cmis.alfresco.com is Alfresco supporting CMIS 0.70: I’m planning to update the archetype (just a mere Maven dependency 🙂 ) to use the HEAD version of Chemistry TCK that is supporting 0.70.

Feedback welcome as usual!

Hope this really helps 🙂

4 thoughts on “Maven and Chemistry strike back … a Maven archetype as CMIS Labs and toolkit

  1. Good article!
    I tried it today, but I got the following error after mvn install:
    [INFO] Failed to resolve artifact.

    Missing:
    ———-
    1) org.apache.chemistry:chemistry-tck-atompub:jar:1.0-SNAPSHOT

    Try downloading the file manually from the project website.

    Reply

  2. I can confirm the bug found by Richard.
    The POMs reference version 1.0-SNAPSHOT whereas the files that are actually on the repository have versions like 1.0-20091116.231019-2

    Any chance this can be fixed?
    I would love to reuse the unit tests to check my CMIS server implementation.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *