XAOP Labs

Library Overview

Repositories

You make contact with a CMIS repository by connecting to a server, which knows about the repository you want to use.

Another way to connect to a CMIS repository is through the ActiveCMIS.load_config method in combination with a configuration file. The format of the configuration file is fairly simple and well documented.

A CMIS repository can optionally implement certain features of CMIS, the Repository#capabilities method returns a hash with information about the supported (and possibly unsupported) features.

To start browsing a repository you can use the Repository#root_folder method. If you have a specific document you want to retrieve you can use the methods object_by_id and object_by_path.

Querying is done with the Repository#query method, at the moment there is no support for constructing queries through the use of Ruby methods, so you will need to read the CMIS specification. (Querying is an optional capability of repositories, so it may be unavailable)

Types

There are 4 basic types in CMIS, each of these has metadata associated with them:

  1. Documents (with the base type cmis:document), these can be added to folders, can have content and different versions (depending on the repository and the configuration for a particular subtype of cmis:document)
  2. Folders (base type cmis:folder) have to belong to another folder (with 1 exception per repository namely the root folder)
  3. Relationships (base type cmis:relationship) Relationships can't be in a folder and can't have content or versions. A relationship needs to have a source and target object.
  4. Policies (base type cmis:policy)

Every repository needs to know about at least documents and folders, relationships and policies are optional. To know which base types are supported use the method Repository#base_types. This will give you an array with all the base types known by the repository.

There is a basic number of settings that all base types in each repository have to have in common. This knowledge is contained in the classes Document, Folder, Relationship and Policy. However each repository may have certain settings different even for these base types, they may have for example more than the minimal set of attributes. For that reason a new class is automatically generated for each type in each repository. Generated types will have one of our base classes as ancestor, include Type::InstanceMethods and are extended with Type::ClassMethods.

Types that inherit from each other in the CMIS repository definitions then the classes in Ruby will also inherit from each other.

Objects

Objects can be filed in folders with the file/unfile methods. This is not true for documents where the type says they are not fileable.

If the repository allows it documents can remain unfiled (that is without a folder). Filing relationships is not possible on any repository.

All Objects have attributes. Which attributes they have is determined by the property definitions contained by the type. Property definitions are represented by PropertyDefinition objects and can be retrieved from a class by the class method attributes (as opposed to the instance method attributes which merely gives the value for all the properties), they have methods to determine the type they have and whether they are readonly, multi-valued, queryable, ... The type of a property is represented by an AtomicType object (can be a String, Integer, Decimal (floating point number), ...).

Documents

Documents can have several versions. What features are available for older versions is repository specific and documented via the Repository#capabilities method. For example it is be possible to have different versions of the same document in different folders if the repository supports it. Querying for older documents may also be possible or impossible depending on the repository.

Documents can have content and renditions, but renditions are the sole responsibility of the repository (you can't set them with CMIS). When content can be updated can be limited too, once again you should look at the repository info to find this out.

Folders

You can ask for the items in a folder by calling the #items method. This will result in a collection, which will page through all items in the folder collection. Folders can't have content or versions.

Relationships

Relationships can exist between two documents. Creating a relationship does not modify any of the two documents and therefore requires no write access on the documents.

Policies

Policies belong to a document or a folder. It is possible to file policies in folders in certain repositories. Policies can't have content or versions.

Collections

A collection is used in ActiveCMIS wherever CMIS uses paging. It act mostly like an array, but will try to not download everything at the same time if it's not necessary.