Book Image

Alfresco CMIS

By : Martin Bergljung
Book Image

Alfresco CMIS

By: Martin Bergljung

Overview of this book

Table of Contents (14 chapters)
Alfresco CMIS
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using CMIS in Groovy scripts


Using OpenCMIS to talk to a CMIS server via Java is quite easy compared to using basic protocol bindings such as the AtomPub binding. But by using the OpenCMIS API via the Groovy scripting language, we can also do the following:

  • Get less code, making the application more readable

  • Run the code without the need to compile it, making a round trip from code change to test quicker

  • Script content updates so we can easily run checks or updates, such as cron jobs

  • Use any Java library as Groovy runs on the JVM

Install Groovy using the following command:

$ sudo apt-get install groovy

If you are not familiar with Groovy, I recommend that you spend 1 to 2 hours reading a tutorial about it before coding anything in this section at http://groovy.codehaus.org/Beginners+Tutorial.

So to get started, create a file named testCMIS.groovy and add the following code to it to import the OpenCMIS classes that we need:

@Grab(group='org.apache.chemistry.opencmis', module='chemistry-opencmis...