Return-Path: Delivered-To: apmail-incubator-chemistry-commits-archive@minotaur.apache.org Received: (qmail 79787 invoked from network); 17 Feb 2011 17:18:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 17 Feb 2011 17:18:37 -0000 Received: (qmail 60620 invoked by uid 500); 17 Feb 2011 17:18:37 -0000 Delivered-To: apmail-incubator-chemistry-commits-archive@incubator.apache.org Received: (qmail 60550 invoked by uid 500); 17 Feb 2011 17:18:35 -0000 Mailing-List: contact chemistry-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: chemistry-dev@incubator.apache.org Delivered-To: mailing list chemistry-commits@incubator.apache.org Received: (qmail 60533 invoked by uid 99); 17 Feb 2011 17:18:34 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Feb 2011 17:18:34 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Feb 2011 17:18:31 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 4B4AC2388C16; Thu, 17 Feb 2011 17:18:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r785594 [5/10] - in /websites/staging/chemistry/trunk/content: ./ images/ resources/ Date: Thu, 17 Feb 2011 17:18:08 -0000 To: chemistry-commits@incubator.apache.org From: buildbot@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110217171811.4B4AC2388C16@eris.apache.org> Added: websites/staging/chemistry/trunk/content/opencmis-browser.html ============================================================================== --- websites/staging/chemistry/trunk/content/opencmis-browser.html (added) +++ websites/staging/chemistry/trunk/content/opencmis-browser.html Thu Feb 17 17:18:07 2011 @@ -0,0 +1,223 @@ + + + + + + + + + + +Apache Chemistry - OpenCMIS Browser + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
   
  +
+ +
+
+ + + + + +
+
+ +Home » OpenCMIS » OpenCMIS Browser + +
+
+
+ +

License Site Map

+ +
+
+
+
 
  + + + + + +
+
+
+
+ +
+
+
+
+ +

+

OpenCMIS Browser

+

The CMIS Browser is a simple web based tool to browse CMIS enabled +repositories that support the AtomPub binding. It sits between the web +browser of the end-user and the CMIS repository. It applies stylesheets to +the Atom entries and feeds that repository returns and creates HTML pages +that enable the end-user to navigate through the repository.

+

The CMIS Browser consists of a small WAR file that doesn't require any +configuration. Deploy it to a servlet engine and type +http:////browse in your web browser. Enter the URL of +the AtomPub service document into the input box and start browsing.

+

+

Build and Deploy the CMIS Browser

+
    +
  1. Build OpenCMIS +.
  2. +
  3. A ready-to-use WAR file should now exist in +/chemistry-opencmis-test/chemistry-opencmis-test-browser-app/target.
  4. +
  5. Deploy the WAR file to your favorite servlet engine.
  6. +
+ +
+
 
  + +  
   
+ + Added: websites/staging/chemistry/trunk/content/opencmis-client-api.html ============================================================================== --- websites/staging/chemistry/trunk/content/opencmis-client-api.html (added) +++ websites/staging/chemistry/trunk/content/opencmis-client-api.html Thu Feb 17 17:18:07 2011 @@ -0,0 +1,385 @@ + + + + + + + + + + +Apache Chemistry - OpenCMIS Client API + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
   
  +
+ +
+
+ + + + + +
+
+ +Home » OpenCMIS » OpenCMIS Client API + +
+
+
+ +

License Site Map

+ +
+
+
+
 
  + + + + + +
+
+
+
+ +
+
+
+
+ +

+

OpenCMIS Client API

+

{info:title=Table of Content} + Sessions + Example Code + * Session Creation - AtomPub Binding + * Session Creation - Web Services Binding + * Reading Objects - Root Collection + * Reading Properties - Single Property + * Reading Properties - All Properties +{info}

+

The OpenCMIS client layer provides an object oriented interface for easy +consumption of the underlying CMIS related layers. In addition to the CMIS +specification the OpenCMIS client layer introduces a session concept which +easily enables applications to get control on the client side cache +behavior.

+

The client layer consists of a client interface, common interfaces and a +runtime implementation. The runtime maps the client interface to the +bindings layer and implements the session cache. All parts are exposed by +following packages:

+ + + + + +
Package Artifact Description
org.apache.chemistry.opencmis.client.api chemistry-opencmis-client-api + Main interfaces of the client API
org.apache.chemistry.opencmis.commons.api +chemistry-opencmis-commons-api Interfaces and classes shared by client +and client bindings API
org.apache.chemistry.opencmis.client.runtime +chemistry-opencmis-client-impl Implementation classes of client API +including a default implementation of the SessionFactory
+ +

The following UML diagram illustrates the main classes of the client API:

+

!OpenCMIS Client API Class Diagram.png!

+
    +
  • SessionFactory This interface provides the entry point into the client +API and is responsible to create a session object. Additionally it gives +access to all repository info exposed by a CMIS client binding. The runtime +provides a default implementation for the SessionFactory interface.
  • +
  • Session This is the main interface an application has to work with. A +session object is related to a CMIS service client binding and is attached +to exact one repository. All data that is received through the session +interface can be cached in the session object in dependency of the concrete +implementation which is behind.
  • +
  • Repository Wrapper interface for the CMIS RepositoryInfo service.
  • +
  • CmisObject The CmisObject interface represents the CMIS domain object.
  • +
  • ObjectType This interface is base for all CMIS domain types like +FolderType, DocumentType, PolicyType and RelationshipType. The derived +interfaces are not shown in the diagram.
  • +
  • Folder This interface represents the CMIS folder object.
  • +
  • Document This interface represents the CMIS document object.
  • +
  • ContentStream this interface wraps the content stream of a CMIS +document.
  • +
  • Policy This interface represents the CMIS policy object.
  • +
  • Relationship This interface represents the CMIS relationship object.
  • +
+

+

Sessions

+

OpenCMIS' central entry point to a CMIS repository is a session. A session +controls settings and caches that used across multiple calls and provides +access to all CMIS operations and objects. +In order to create a session, the SessionFactory needs a set parameters +(see OpenCMIS Session Parameters +).

+

+

Example Code

+

+

Session Creation - AtomPub Binding

+
Opening a Atom Pub Connection
+ // default factory implementation of client runtime + SessionFactory f = SessionFactoryImpl.newInstance(); + Map parameter = new HashMap(); + +// user credentials + parameter.put(SessionParameter.USER, "Otto"); + parameter.put(SessionParameter.PASSWORD, "****"); + +
// connection settings
+parameter.put(SessionParameter.ATOMPUB_URL,
+
+ + +

"http://:/cmis/atom"); + parameter.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value()); + parameter.put(SessionParameter.REPOSITORY_ID, "myRepository");

+
// session locale
+parameter.put(SessionParameter.LOCALE_ISO3166_COUNTRY, "");
+parameter.put(SessionParameter.LOCALE_ISO639_LANGUAGE, "de");
+
+// create session
+Session s = f.createSession(parameter);
+
+ + +

+

Session Creation - Web Services Binding

+
Opening a Web Services Connection
+ // default factory implementation of client runtime + SessionFactory f = SessionFactoryImpl.newInstance(); + Map parameter = new HashMap(); + +// user credentials + parameter.put(SessionParameter.USER, "Otto"); + parameter.put(SessionParameter.PASSWORD, "****"); + +
// connection settings
+parameter.put(SessionParameter.BINDING_TYPE,
+
+ + +

BindingType.WEBSERVICES.value()); + parameter.put(SessionParameter.REPOSITORY_ID, "myRepository"); + parameter.put(SessionParameter.WEBSERVICES_ACL_SERVICE, +"http://:/cmis/services/ACLService?wsdl"); + parameter.put(SessionParameter.WEBSERVICES_DISCOVERY_SERVICE, +"http://:/cmis/services/DiscoveryService?wsdl"); + parameter.put(SessionParameter.WEBSERVICES_MULTIFILING_SERVICE, +"http://:/cmis/services/MultiFilingService?wsdl"); + parameter.put(SessionParameter.WEBSERVICES_NAVIGATION_SERVICE, +"http://:/cmis/services/NavigationService?wsdl"); + parameter.put(SessionParameter.WEBSERVICES_OBJECT_SERVICE, +"http://:/cmis/services/ObjectService?wsdl"); + parameter.put(SessionParameter.WEBSERVICES_POLICY_SERVICE, +"http://:/cmis/services/PolicyService?wsdl"); + parameter.put(SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE, +"http://:/cmis/services/RelationshipService?wsdl"); + parameter.put(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE, +"http://:/cmis/services/RepositoryService?wsdl"); + parameter.put(SessionParameter.WEBSERVICES_VERSIONING_SERVICE, +"http://:/cmis/services/VersioningService?wsdl");

+
// session locale
+parameter.put(SessionParameter.LOCALE_ISO3166_COUNTRY, "");
+parameter.put(SessionParameter.LOCALE_ISO639_LANGUAGE, "de");
+parameter.put(SessionParameter.LOCALE_VARIANT, "");
+
+// create session
+Session s = f.createSession(parameter);
+
+ + +

+

Reading Objects - Root Collection

+
Reading the Root Collection
+ Folder root = this.session.getRootFolder(); + +ItemIterable pl = root.getChildren(); + +
for (CmisObject o : pl) {
+  System.out.println(o.getName());
+}
+
+ + +

+

Reading Properties - Single Property

+
Reading a Single Property
+ ObjectId id = this.session.createObjectId("4711"); + Document document = (Document) this.session.getObject(id); + Property p = document.getProperty(PropertyIds.OBJECT_ID); + +String s = p.getValue(); + +

+

Reading Properties - All Properties

+
Reading all Properties
+ ObjectId id = this.session.createObjectId("4711"); + Document document = (Document) this.session.getObject(id); + List> l = document.getProperties(); + Iterator> i = l.iterator(); + while (i.hasNext()) { + Property p = i.next(); + Object value = p.getValue(); + PropertyType t = p.getType(); + +switch (t) { + case INTEGER: + Integer n = (Integer) value; + System.out.println(p.getName() + " = " + n); + break; + case STRING: + [...] + }
+ +
+
 
  + +  
   
+ + Added: websites/staging/chemistry/trunk/content/opencmis-client-bindings.html ============================================================================== --- websites/staging/chemistry/trunk/content/opencmis-client-bindings.html (added) +++ websites/staging/chemistry/trunk/content/opencmis-client-bindings.html Thu Feb 17 17:18:07 2011 @@ -0,0 +1,344 @@ + + + + + + + + + + +Apache Chemistry - OpenCMIS Client Bindings + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
   
  +
+ +
+
+ + + + + +
+ + +
+ +

License Site Map

+ +
+
+
+
 
  + + + + + +
+
+
+
+ +
+
+
+
+ +

+

OpenCMIS Client Bindings

+

The OpenCMIS client bindings layer hides the CMIS AtomPub and Web Services +bindings and provides an interface that is very similar to the CMIS domain model +. The services, operations, parameters, and structures are named after the +CMIS domain model and behave as described in the CMIS specification.

+

The primary objective of the client bindings layer is to be complete, +covering all CMIS operations and extension points. The result is a somewhat +clunky interface. The OpenCMIS Client API + sits on top of the provider layer and exposes a nicer and simpler to use +interface. It is the better choice for most applications.

+

A connection to a CMIS repository is represented by a CmisBinding + object. Such an object can be created by the [CmisBindingFactory|http://incubator.apache.org/chemistry/javadoc/org/apache/chemistry/opencmis/client/bindings/CmisBindingFactory.html] +. The factory provides three main methods, one for each binding and third +one for a local connection (same JVM), that require binding specific +connection information. The created CmisBinding object exposes a +binding agnostic interface.

+

CmisBinding is the entry point to the CMIS services and a few utility +operations. It contains a transparent cache for repository infos and type +definitions. The object is serializable, although dehydrating can be +expensive. CmisBinding is thread-safe.

+

The getService() methods provide access to the CMIS services. Some +service operations take provider layer specific objects. These objects +should be created with the BindingsObjectFactory +. This factory can be obtained through the getObjectFactory() method of +the CmisBinding* object.

+

Please refer to the OpenCMIS Commons JavaDoc + and OpenCMIS Client Binding [JavaDoc|http://incubator.apache.org/chemistry/javadoc/] + for more details on the interfaces.

+

+

Sample Code

+

+

Creating an AtomPub binding instance

+

The AtomPub binding requires the URL of the CMIS service document. HTTP +basic authentication is enabled by default and a username and a password +have to be provided.

+

{code:java} +Map parameters = new HashMap();

+

parameters.put(SessionParameter.USER, user); +parameters.put(SessionParameter.PASSWORD, password);

+

parameters.put(SessionParameter.ATOMPUB_URL, url); // service document URL

+

CmisBindingFactory factory = CmisBindingFactory.newInstance(); +CmisBinding binding = factory.createCmisAtomPubBinding(parameters);

+
h3. Creating a Web Services binding instance
+
+The Web Services binding requires a WSDL URL for each CMIS service. This
+
+ + +

might the same the URL for all services. WS-Security (UsernameToken) is +enabled by default and a username and a password have to be provided.

+
{code:java}
+Map<String, String> parameters = new HashMap<String, String>();
+
+parameters.put(SessionParameter.USER, username);
+parameters.put(SessionParameter.PASSWORD, password);
+
+parameters.put(SessionParameter.WEBSERVICES_REPOSITORY_SERVICE,
+
+ + +

repositoryServiceWsdlUrl); + parameters.put(SessionParameter.WEBSERVICES_NAVIGATION_SERVICE, +navigationServiceWsdlUrl); + parameters.put(SessionParameter.WEBSERVICES_OBJECT_SERVICE, +objectServiceWsdlUrl); + parameters.put(SessionParameter.WEBSERVICES_VERSIONING_SERVICE, +versioningServiceWsdlUrl); + parameters.put(SessionParameter.WEBSERVICES_DISCOVERY_SERVICE, +discoveryServiceWsdlUrl); + parameters.put(SessionParameter.WEBSERVICES_RELATIONSHIP_SERVICE, +relationshipServiceWsdlUrl); + parameters.put(SessionParameter.WEBSERVICES_MULTIFILING_SERVICE, +multiFilingServiceWsdlUrl); + parameters.put(SessionParameter.WEBSERVICES_POLICY_SERVICE, +policyServiceWsdlUrl); + parameters.put(SessionParameter.WEBSERVICES_ACL_SERVICE, +aclServiceWsdlUrl);

+
CmisBindingFactory factory = CmisBindingFactory.newInstance();
+CmisBinding binding = factory.createCmisWebServicesBinding(parameters);
+
+ + +

+

Creating a Local binding instance

+

The Local binding connects to an OpenCMIS server in the same JVM. The +server factory class name has to be supplied.

+

{code:java} +Map parameters = new HashMap();

+

parameters.put(SessionParameter.USER, user); +parameters.put(SessionParameter.PASSWORD, password);

+

parameters.put(SessionParameter.LOCAL_FACTORY, factoryClassName);

+

CmisBindingFactory factory = CmisBindingFactory.newInstance(); +CmisBinding binding = factory.createCmisLocalBinding(parameters);

+
h3. Getting an Object
+
+The following snippet gets the name of the object "myObject" in repository
+
+ + +

"myRepository". The parameters of getObject() can be found in the CMIS +specification.

+
{code:java}
+CmisBinding binding = ...
+
+ObjectData myObject = binding.getObjectService().getObject("myRepository",
+
+ + +

"myObject", + "*", true, IncludeRelationships.BOTH, "cmis:none", true, true, null);

+
PropertiesData properties = myObject.getProperties();
+PropertyData<String> nameProperty =
+
+ + +

properties.getProperties().get(PropertyIds.NAME); + String name = nameProperty.getFirstValue();

+

+

Custom Authentication Provider

+

OpenCMIS supports HTTP basic authentication for the AtomPub binding and +WS-Security (UsernameToken) for the Web Services binding out of the box. +Other authentication methods can be added by implementing a custom +authentication provider.

+

Such a provider must extend +org.apache.chemistry.opencmis.client.provider.spi.AbstractAuthenticationProvider +and overwrite the methods getHTTPHeaders and getSOAPHeaders. See +JavaDoc for details.

+

The session parameter SessionParameter.AUTHENTICATION_PROVIDER_CLASS +must be set to the fully qualified class name in order to active the +authentication provider before the session is created.

+

{code:java} +Map parameters = new HashMap();

+

parameters.put(SessionParameter.AUTHENTICATION_PROVIDER_CLASS, +"org.example.opencmis.MyAuthenticationProvider"); +parameters.put("org.example.opencmis.user", "cmisuser"); // +MyAuthenticationProvider can get and evaluate this +parameters.put("org.example.opencmis.secret", "b3BlbmNtaXMgdXNlcg==");

+

parameters.put(SessionParameter.ATOMPUB_URL, url); // service document URL

+

CmisBindingFactory factory = CmisBindingFactory.newInstance(); +CmisBinding provider = factory.createCmisAtomPubBinding(parameters);

+ +
+
 
  + +  
   
+ +