This is a technical comparison of the interfaces and classes present in both Chemistry and OpenCMIS.
Concepts
In Chemistry the session and the Connection
are the same thing. The connection has different implementations depending on the way it's connected to an underlying protocol. The connection implements methods from the high-level API, and also gives access to the low-level SPI implementing different methods.
In OpenCMIS the Session
is a semi-generic context-like object (PersistentSessionImpl
). Eventually, there will be two Session
implementations. In the persistent model (almost) all changes are immediately passed to the repository. In the transient model all changes are cached until save()
is called on the Session
object. A Session
can be "connected" using parameters to instantiate internally a low-level provider (CmisProvider
). The provider holds configuration parameters that enable it to create a low-level SPI through a CmisSpiFactory
. Through the SPI you can get to the various SPI *Service
implementations.
Repository access
In Chemistry you get to a repository instance based on general repository parameters, and from it you can open connections with a username and password. The repository instance can be introspected (types, etc) without opening a session.
In OpenCMIS, you get a session factory, from which you open a session, from which you can get to the repository info (types, etc.). All connection parameters are passed to the createSession()
method, including repository URL.
Registering a repository
- Chemistry:
Map<String, Serializable> params = ...; // URL, optional user, password RepositoryService repositoryService = new APPRepositoryService(url, params); RepositoryManager.getInstance().registerService(repositoryService);
- OpenCMIS
No global registration. A JNDI-based method or dependency injection is suggested but not implemented.
Getting a repository / session factory
- Chemistry
Repository repository = RepositoryManager.getInstance().getRepository("myrepo");
- OpenCMIS
SessionFactory sessionFactory = SessionFactoryImpl.newInstance();
Getting a session / connection
- Chemistry
Map<String, String> params = ...; // user, password Connection conn = repository.getConnection(params);
- OpenCMIS
Map<String, String> params = ...; // URL, user, password Session session = sessionFactory.createSession(parameters);
High-level APIs
From a connection/session you can get the root folder and express high-level operations
- Chemistry
Folder root = conn.getRootFolder(); List<CMISObject> children = root.getChildren();
- OpenCMIS
Folder root = session.getRootFolder(); PagingList<CmisObject> list = root.getChildren(1);
Base object
Contains getters and setters for properties, with convenience methods.
Contains methods like delete()
etc. that pass through to the SPI/provider.
- Chemistry
The base interface isCMISObject
. It flushes changes onsave()
.
- OpenCMIS
The base interface isCmisObject
. It flushes property changes onupdateProperties()
.
Specialized Objects
Implement additional object-oriented methods depending on the interfaces.
- Chemistry
Folder
,Document
,Relationship
,Policy
- OpenCMIS
FileableCmisObject
,Folder
,Document
,Relationship
,Policy
Paging
- Chemistry
ListPage: a page
= List + getHasMoreItems + getNumItems
Implemented by SimpleListPage. This is a data transfert object.
- OpenCMIS
PagingList: a list of pages which are themselves lists
= Iterable<List> + getNumItems + getMaxItemsPerPage + size + get(page)
AbstractPagingList is the base class. This is an active object that can fetch new pages by implementing a fetchPage() method that returns a FetchResult (which is equivalent to Chemistry's ListPage).
Provider APIs
This is called "SPI" in Chemistry, and "Provider" in OpenCMIS.
Services interfaces
- Chemistry
All CMIS services are implemented under the single interfaceSPI
. The SPI uses classes and interfaces designed for Java.
- OpenCMIS
From a provider you get the various CMIS services as different interfaces (RepositoryService
,ObjectService
,NavigationService
, etc.) using getters. The interfaces and classes are generic and mimick the JAXB generated ones.
High-level vs low-level vs implementation
- Chemistry
The high-level and SPI interfaces are mutualized (ex: org.apache.chemistry.RepositoryInfo).
- OpenCMIS
For the same concept OpenCMIS manipulates three different interfaces and their implementations:- the one in the high-level client API (ex:
org.apache.opencmis.client.api.repository.RepositoryInfo
), - the one in the provider (ex:
org.apache.opencmis.commons.provider.RepositoryInfoData
), - the one from JAXB (
CmisRepositoryInfoType
).
- the one in the high-level client API (ex:
Common method parameters
- Chemistry
The SPI bundles together a number of call parameters that are used often together:Inclusion
contains properties and rendition filters, relationship inclusion, flags for allowable actions, policies, acls. AnInclusion
is passed to the relevant SPI methods.
- OpenCMIS
A defaultOperationContext
on the session is used to specify these call parameters. A variant of the high-level methods taking an explicitOperationContext
is also available. In the provider interfaces everything is explicit, following JAXB.
Object data
The base object contains information about one object: properties, allowable actions, relationships, renditions, etc.
- Chemistry
ObjectEntry
is the basic class.
It also contains change info and path segments, depending on how it was retrieved.
- OpenCMIS
ObjectData
is the basic class.
To provide it context, it is used by delegation is more complex constructions:ObjectInFolderData
,ObjectInFolderContainer
,ObjectInFolderList
,ObjectParentData
,ObjectList
, etc. thus mimicking JAXB and allow access to all extension points.
Various enums
Relationship direction:
- Chemistry
Defines them according to best Java use. For instanceRelationshipDirection
can be 'source', 'target', 'either' or null. There is no separateIncludeRelationships
.
- OpenCMIS
Mimicks JAXB.RelationshipDirection
andIncludeRelationships
are different.
Property type:
- Chemistry
PropertyType
is a class allowing definition of new types, for specialized backends.
- OpenCMIS
PropertyType
is an enum following JAXB.
Allowable actions:
- Chemistry
AllowableActions
is a set ofQNames
.
- OpenCMIS
AllowableActions
is a map fromString
(non-namespaced) toBoolean
.