Please see also the OASIS CMIS Documentation: http://docs.oasis-open.org/cmis/CMIS/v1.0/errata-01/os/cmis-spec-v1.0-errata-01-os-complete.html

1. Starting the VB.CMIS service with the sample data provider.

Requirements: .NET Framework 4.0
Supported CMIS standard: AtomPub
Supported CMIS version: 1.0

  1. Download the latest file from the download section (http://vbcmis.codeplex.com/releases)
  2. Unzip the downloaded file
  3. Start the file VBCMISDebug.exe

The service is started as a 'self-hosted WCF service' in a .NET console application. You can also host the CMIS service in your own application. See section 'Hosting the CMIS interface in your own application'.

Problems:

Windows has a special flag that can mark files as 'from an other computer'. If you get an error like this:
„A FileLoadException was thrown while loading the provider dll. Maybe the dll is missing or marked as 'from an other computer'(blocked)“

you have to unblock the data provider dll as shown in the screenshot.

properties.jpg

Go to the „Provider“ folder, right click on the 'CMISTestProvider.dll' file and choose 'Properties'. Then click on the 'Allow' button.

2. Using VB.CMIS with your CMIS Client

The sample provider is not designed for running in a productive CMIS Client. It's only used for demonstrating the CMIS standard and the usage of the 'IProvider' interface.

The Apache Chemistry Workbench is a good client to use with the sample provider You can find the Apache Chemistry Workbench here: http://chemistry.apache.org/java/download.html

You can write your own data provider to full-fill your own purpose and to work with your preferred clients.

2.1 Usage of the Apache Chemistry Workbench

  1. Start the workbench (See the Apache documentation)
  2. In the URL field add the url to the service. You can find the url in the console window. Generally: http://localhost/CMIS/Service/servicedoc
  3. In the „Username“ and „Password“ fields you can enter any values you like. The sample provider doesn't validate the username and password. But the values can't be empty. (You can change this behavior with a configuration setting. See „Service Configuration“)
  4. Click on the buttons „Load Repositories“ and „Login“.

2.2 Service Configuration

There are some configuration settings that you can modify to change the behavior of the repository. To change the settings open the config file 'VBCMISDebug.exe.config' in an editor and modify the 'AppSettings' section.

configFile.jpg

Configuration keys

ProviderDLLPath:
The path of the data provider dll the server should load.
Example: $BaseDirectory/Provider/CMISTestProvider.dll
You can use the placeholder '$BaseDirectory'. It points to the base directory of the service.

ServiceUri:
The HTTP address at which the server is reachable.
Example: http://localhost/CMIS/Service/

ServiceUriHttps:
The HTTPS address at which the server is reachable. See section 'Enable Https'
Example: https://localhost:12345/CMIS/Service/

EnableLogin:
Should the server ask the client for login data?. If true the client MUST provide login data.
Default is true

ParseData:
The client can transfer CMIS objects to the server. If this option is enabled the server tries to parse the incoming data and transfers the parsed data to the data provider.
Default is true

DoCaching:
The RepositoryInfo is often used by the VB.CMIS service. Should the service cache the RepositoryInfo?
Default is true

LogFile:
If you have enabled the parsing of incoming data the server can log parser errors. Here you can specify the path to the log-file.
Default is not set

Debug:
Should the Server return error messages to the client?
Default is true

2.3 Enable Https

To enable https you have to define your preferred https URL in the 'ServiceUriHttps' configuration key. You should also define a port in your url. Example: https://localhost:12345/CMIS/Service/

Now you have to add a certificate to your port. You can do this in the IIS-Manager. Just add a binding with your port and certificate.
bindings.jpg

You can also add a port directly from the console.
Please see: http://msdn.microsoft.com/en-us/library/ms186362(v=sql.105).aspx

3. Hosting the cmis interface in your own application

Add the CMISConnectorLibrary to your application. Now you can open a ServiceHost object in your application and define your own binding.
  • The interface class is 'CMISConnectorLibrary.Services.Interfaces.ICMISMainService'
  • The service class is 'CMISConnectorLibrary.Services.Service'

4. Writing your own data provider

The data provider is a .NET 4.0 class library that implements the 'CMISObjectModel.IProvider' interface.

At first you have to download the VB.CMIS service as shown in 'Starting the VB.CMIS service with the sample data provider.'
  1. To create your own data provider start Visual Studio and create a new 'class library' project.
  2. As framework version choose .NET 4.0.
  3. Now add a reference to the 'CMISObjectModel.dll' file(.NET 4.0 dll). You can find the dll in the downloaded service package.
  4. Create a class file. You can choose any name you like.
  5. Implements the IProvider interface. Write 'ImplementsCMISObjectModel.IProvider' in the first line of your class and press enter.
  6. Fill all implemented functions with your own logic.

4.1 Basic data hierarchie

basicData.jpg

The VB.CMIS Server (CMIS AtomPub binding) mainly returns ATOM feeds or ATOM entries to CMIS client. The ATOM entry encapsulates CMIS Objects/CMIS Types. The CMIS Objects/CMIS Types represents your actual data.

CMIS has two main object types:
  • The CMIS Object(folder, document, relation, policy): The CMIS Object encapsulates your data for the client.
  • The CMIS Type (object): The CMIS Type describes your data. For example what properties your application returns.

So most of the IProvider functions must return an ATOMFeed or an ATOMEntry object. The ATOMFeed object must contain a list of ATOMEntry. The ATOMEntry can contain a CMISObject or a TypeDefinition.

4.2 Functions in the IProvider Interface

IProvider.jpg


ApplyACL

This function adds a ACL object to a specified CMISObject.

ApplyPolicy

This function adds a CMISObject of the type 'Policy' to a specified CMISObject.

CheckOut

This function “checks out “the specified CMISObject. The function should create a Working-Copy object of the specified CMISObject.

CreateOrMoveObject

This function can do different tasks:

If the object is not in the repository the following actions can be performed:
  • createDocument
    • Creates the CMISObject of the type 'Document'
  • createFolder
    • Creates the CMISObject of the type 'Folder'
  • createPolicy
    • Creates the CMISObject of the type 'Policy'

If the object already exists 'moveObject' or 'addObjectToFolder' will be performed.
  • MoveObject
    • Moves the object to the specified folder.
    • Will be performed when the parameter 'sourceFolderId' is set.
  • AddObjectToFolder
    • Adds the existing object to the specified folder.
    • Will be performed when the parameter 'sourceFolderId' is NOT set.
  • If multi-filing is not supported 'MoveObject' is used.

CreateRelationship

Creates a Relationship between 2 CMISObjects.

DeleteContentStream

Removes the content stream from the specified CMISObject

DeleteObject

Deletes the specified CMISObject

DeleteTree

Deletes the specified CMISObject of the type 'Folder' and all of its children.

GetACL

Returns the ACL object of specified CMISObject.

GetAllowableActions

Returns the AllowableActions object of specified CMISObject.

GetAllVersions

Returns all available versions of the specified document.

GetAppliedPolicies

Returns the CMISObjects of the type 'Policy' applied to the specified CMISObject.

GetCheckedOutData

Returns a list of CheckedOut documents the user has access to.

GetChildren

Returns a list of all direct child objects of the specified Folder.

GetContentChanges

Returns a list of content changes

GetContentStream

Returns the content stream of the specified CMISObject.

GetDescendants

Returns a hierarchical tree of the available CMISObjects

GetFolderTree

Returns a hierarchical tree of the available CMISObjects of the type 'Folder'

GetObject

Returns the CMISObject with the specified Id.

GetObjectByPath

Returns the CMISObject with the specified Path.

GetObjectParents

Returns the parent objects of the specified object.

GetObjectRelations

Returns the available Relationships.

GetRepositories

Returns a RepositoryInfo object for all available Repositories

GetRepository

Returns a RepositoryInfo object for specified Repository.

GetTypeChildren

Returns a list of all direct child types of the specified Type.

GetTypeDefinition

Returns the TypeDefinition object for the specified type.

GetTypeDescendants

Returns a hierarchical tree of the available TypeDefinitions.

GetTypeParentId

Returns the Id of the parent TypeDefinition.

GetUnfiled

Returns a list of all unfiled CMISObjects.

Init

Initializes the Provider object.

IsUserValid

Validates the username and password of the user.

Query

Process a CMIS Query: http://docs.oasis-open.org/cmis/CMIS/v1.0/errata-01/os/cmis-spec-v1.0-errata-01-os-complete.html#_Toc243905420

RemoveObjectFromFolder

Removes the CMISObject from the specified folder.

RemovePolicy

Removes the specified policy from the specified CMISObject.

SetContentStream

Replaces the content stream of the specified object.

UpdateProperties

Changes the specified objects and modifies the given properties.

Last edited Oct 12, 2012 at 12:54 PM by BKR, version 9

Comments

No comments yet.