Skip to end of metadata
Go to start of metadata

Description

The CMIS plugin enables the usage of the CMIS specification via Apache Chemistry.

Installation

The current version of griffon-cmis-plugin is 0.2
To install just issue the following command

Usage

Upon installation the plugin will generate the following artifact in $appdir/griffon-app/conf:

  • CmisConfig.groovy - contains the session definitions.

A new dynamic method named withCmis will be injected into all controllers, giving you access to a org.apache.chemistry.opencmis.client.api.Sessionl object, with which you'll be able to make calls to the database. Remember to make all calls to the database off the EDT otherwise your application may appear unresponsive when doing long computations inside the EDT.
This method is aware of multiple datasources. If no dataSourceName is specified when calling it then the default dataSource will be selected. Here are two example usages, the first queries against the default datasource while the second queries a datasource whose name has been configured as 'internal'

This method is also accessible to any component through the singleton griffon.plugins.cmis.CmisConnector. You can inject these methods to non-artifacts via metaclasses. Simply grab hold of a particular metaclass and call CmisConnector.enhance(metaClassInstance).

Configuration

Dynamic method injection

The withCmis() dynamic method will be added to controllers by default. You can change this setting by adding a configuration flag in Config.groovy

Events

The following events will be triggered by this addon

  • CmisConnectStart[config, sessionName] - triggered before connecting to the datastore
  • CmisConnectEnd[sessionName, session] - triggered after connecting to the datastore
  • CmisDisconnectStart[config, sessionName, session] - triggered before disconnecting from the datastore
  • CmisDisconnectEnd[config, sessionName] - triggered after disconnecting from the datastore

Multiple datasources

The config file CmisConfig.groovy defines a default dataSource block. As the name implies this is the dataSource used by default, however you can configure named dataSources by adding a new config block. For example connecting to a dataSource whose name is 'internal' can be done in this way

This block can be used inside the environments() block in the same way as the default session block is used.

Examples

Taken from http://chemistry.apache.org/java/developing/guide.html the following controller assumes the default connection is setup to query an AtomPub repo (http://repo.opencmis.org/inmemory/atom)

The usage of the onReadyEnd event handler is just for demonstration purposes; the method withCmis() can be called from anywhere in the controller.

History

Version

Date

Notes

0.2

10-21-11

Release sync with Griffon 0.9.4

0.1

07-07-11

Initial release

  • No labels