CMIS Maven Toolkit

From alfrescowiki

Revision as of 07:54, 26 December 2011 by Nicolas Raoul (Talk | contribs)

Jump to: navigation, search

Contents

CMIS Maven Toolkit

Alfresco CMIS Maven toolkit providing samples on working against a CMIS 1.0cd04 Public Server (e.g. http://cmis.alfresco.com) .

Latest Version: 1.0-beta-2

Older Versions:

Query-webapp-arch.png

Purpose

Started up as a CMIS training lab material, this Maven archetype allows you to have a quick start on CMIS. Possible use cases are:

  • Experimenting against a CMIS 1.0 Public Review compiant server (by default the kit is configured to work against cmis.alfresco.com
  • Starting off your CMIS based web POC and sample integration
  • Trying out CMIS SQL via a web interface
  • Learn more the AtomPub protocol binding looking at the Apache Chemistry sources

Architecture

This small toolkit leverages the Apache Chemistry (ex-Alfresco) AtomPub TCK CMIS client to offer a more high object level access to the CMIS services.

It's distributed as a Maven archetype and allows you to have a starter CMIS toolkit composed of:

  • cmis-support: the chemistry-tck-atompub CMISClient wrapper, which is used by the other modules
  • cmis-query-webapp: a sample skinny SpringMVC CMIS SQL Query webapp, allowing you to run queries against a CMIS 1.0 Compliant AtomPub server (see architecture and default ports in the picture)
  • cmis-lab-atompub-binding: a sample JUnit4 test, running a test document / folder import and categorization in a CMIS compliant server.


The whole Maven artifact set is hosted in the Alfresco Community Maven repository.

Installation instructions

One Liner

It's possible to create this toolkit as a project on your local machine by running:

mvn archetype:generate -DarchetypeGroupId=org.alfresco.enablement.codecamps.cmis -DarchetypeArtifactId=cmis-master-labs-archetype -DarchetypeVersion=1.0-beta-2 -DgroupId=com.mycompany  \
-DartifactId=mycmiskit -Dversion=1.0-SNAPSHOT -DarchetypeRepository=http://maven.alfresco.com/nexus/content/repositories/releases -DinteractiveMode=false

Interactive mode

This toolkit can just be created interactively by running a single Maven command like:

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

and then selecting the cmis-labs-archetype option. You will also be asked to fill in Maven groupId, artifactId and version which you can select according to your needs.

Eclipse

You can point and click archetypes on a remote catalog using m2eclipse, installing it in your Eclipse instance.

Detailed usage

More info is provided in this blog post or in the README.txt in the generated archetype

Sample Mvn project creation

Sample commands and shell output on MacOsx (Maven 2.2.1):

zion:workspace mindthegab$ mvn archetype:generate -DarchetypeCatalog=http://repository.sourcesense.com/nexus/content/repositories/alfresco.public.releases/archetype-catalog.xml
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO]    task-segment: [archetype:generate] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] Preparing archetype:generate
[INFO] No goals needed for project - skipping
[INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on => 'false'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] Setting property: resource.manager.logwhenfound => 'false'.
[INFO] [archetype:generate {execution: default-cli}]
[INFO] Generating project in Interactive mode
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
1: http://repository.sourcesense.com/nexus/content/repositories/alfresco.public.releases/archetype-catalog.xml -> maven-alfresco-amp-archetype (Archetype for building Alfresco AMPs with Maven)
2: http://repository.sourcesense.com/nexus/content/repositories/alfresco.public.releases/archetype-catalog.xml -> maven-alfresco-extension-archetype (Archetype for building and run Alfresco Extensions (WARs) with Maven)
3: http://repository.sourcesense.com/nexus/content/repositories/alfresco.public.releases/archetype-catalog.xml -> cmis-master-labs-archetype (CMIS 1.0 Public Review compatible Toolkit using Apache Chemistry AtomPub TCK)
Choose a number:  (1/2/3): 3
Define value for groupId: : org.mycompany
Define value for artifactId: : my-cmis-samples
Define value for version:  1.0-SNAPSHOT: : 
Define value for package:  org.mycompany: : 
Confirm properties configuration:
groupId: org.mycompany
artifactId: my-cmis-samples
version: 1.0-SNAPSHOT
package: org.mycompany
 Y: : 
[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference : template = archetype-resources/pom.xml [line 64,column 22] : ${cmisServiceUrl} is not a valid reference.
[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference : template = archetype-resources/pom.xml [line 68,column 22] : ${cmisUsername} is not a valid reference.
[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference : template = archetype-resources/pom.xml [line 72,column 22] : ${cmisPassword} is not a valid reference.
[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference : template = archetype-resources/pom.xml [line 76,column 22] : ${cmisValidateAtom} is not a valid reference.
[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference : template = archetype-resources/pom.xml [line 80,column 22] : ${cmisTraceRequests} is not a valid reference.
[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference : template = archetype-resources/pom.xml [line 92,column 18] : ${chemistry.tck.version} is not a valid reference.
[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference : template = archetype-resources/cmis-support/pom.xml [line 13,column 12] : ${chemistry.tck.version} is not a valid reference.
[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference : template = archetype-resources/cmis-query-webapp/pom.xml [line 25,column 16] : ${chemistry.tck.version} is not a valid reference.
[WARNING] org.apache.velocity.runtime.exception.ReferenceException: reference : template = archetype-resources/cmis-lab-atompub-binding/pom.xml [line 18,column 34] : ${chemistry.tck.version} is not a valid reference.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27 seconds
[INFO] Finished at: Tue Nov 17 00:27:41 CET 2009
[INFO] Final Memory: 13M/79M
[INFO] ------------------------------------------------------------------------

zion:workspace mindthegab$ cd my-cmis-samples/
zion:my-cmis-samples mindthegab$ mvn install

Future

  • Switch to a consolidated AtomPub client technology (just need to switch a Maven dependency when/if this happens) as CMISClient.java from the Chemistry AtomPub TCK is not production ready
  • Extend the query webapp to a full blown sample
Personal tools
Download and go
© 2014 Alfresco Software, Inc. All Rights Reserved. Legal | Privacy | Accessibility