chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1085477 - in /chemistry/site/trunk/content/java/developing: client/dev-client-overview.mdtext dev-compare-client-api-binding.mdtext
Date Fri, 25 Mar 2011 17:24:43 GMT
Author: fmui
Date: Fri Mar 25 17:24:43 2011
New Revision: 1085477

URL: http://svn.apache.org/viewvc?rev=1085477&view=rev
Log:
fixed links and did some clean up

Modified:
    chemistry/site/trunk/content/java/developing/client/dev-client-overview.mdtext
    chemistry/site/trunk/content/java/developing/dev-compare-client-api-binding.mdtext

Modified: chemistry/site/trunk/content/java/developing/client/dev-client-overview.mdtext
URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/developing/client/dev-client-overview.mdtext?rev=1085477&r1=1085476&r2=1085477&view=diff
==============================================================================
--- chemistry/site/trunk/content/java/developing/client/dev-client-overview.mdtext (original)
+++ chemistry/site/trunk/content/java/developing/client/dev-client-overview.mdtext Fri Mar
25 17:24:43 2011
@@ -16,9 +16,9 @@ The OpenCMIS client API provides an easy
 
 1. Make sure your repository speaks HTTPS. You probably don't want to expose your password
and your documents to everyone on the network.
 
-1. Download the [OpenCMIS client library](../download.html) and the [CMIS Workbench](../download.html)
.
+1. Download the [OpenCMIS client library](../../download.html) and the [CMIS Workbench](../../download.html).
 
-1. Choose an API. OpenCMIS provides two CMIS client APIs that are called [Client API](dev-client-api.html)
and [Client Bindings API](dev-client-bindings.html). The Client API is a high-level, object
orientated API and suitable for most use cases. It sits on top of the Client Bindings API.
The Client Bindings API reflects the CMIS domain model. It allows fine-grained control, which
makes the interfaces a bit clunky. This guide explains the Client API and [this page](dev-compare-client-api-binding.html)
compares both.
+1. Choose an API. OpenCMIS provides two CMIS client APIs that are called [Client API](dev-client-api.html)
and [Client Bindings API](dev-client-bindings.html). The Client API is a high-level, object
orientated API and suitable for most use cases. It sits on top of the Client Bindings API.
The Client Bindings API reflects the CMIS domain model. It allows fine-grained control, which
makes the interfaces a bit clunky. This guide explains the Client API and [this page](../dev-compare-client-api-binding.html)
compares both.
 
 
 ## The Theory
@@ -39,22 +39,22 @@ The OpenCMIS client package contains all
 
 Before you start implementing have a look at the OpenCMIS JavaDoc. Start with the Session
interface, the Document interface, and the Folder interface. Together with your CMIS domain
model knowledge (you remember the second chapter of the CMIS specification) you should now
have a picture of what is available. 
 
-To connect to a repository you have to create a Session object. See [this page](../examples/example-create-session.html)
for code examples. There are a few required entries in the session parameters map. OpenCMIS
has to know which binding you want to use and where to find the CMIS endpoint. Most repositories
also need a username and a password to identify the user. (See the authentication section
for more details.)
+To connect to a repository you have to create a Session object. See [this page](../../examples/example-create-session.html)
for code examples. There are a few required entries in the session parameters map. OpenCMIS
has to know which binding you want to use and where to find the CMIS endpoint. Most repositories
also need a username and a password to identify the user. (See the authentication section
for more details.)
 
 The repository id parameter tells OpenCMIS which repository at this CMIS endpoint it should
talk to. How do you get this repository id is repository specific. The SessionFactory can
also fetch a list of all available repositories. 
 
-There are also a number of optional [session parameters](dev-session-parameters.html) that
control the cache behavior, HTTP settings, etc. Leave them alone as long as you don't want
or have to optimize your setup.
+There are also a number of optional [session parameters](../dev-session-parameters.html)
that control the cache behavior, HTTP settings, etc. Leave them alone as long as you don't
want or have to optimize your setup.
 
-The Session object gives you access to all CMIS features.  There are a few common and repeating
patterns. Have a look at the [examples sections](../examples/index.html).
+The Session object gives you access to all CMIS features.  There are a few common and repeating
patterns. Have a look at the [examples sections](../../examples/index.html).
 
-When you feel comfortable with the API, familiarize yourself with the [OpenCMIS caches](dev-client-cache.html)
and the [OperationContext](dev-operation-context.html). They can improve the performance considerably.
+When you feel comfortable with the API, familiarize yourself with the [OpenCMIS caches](../dev-client-cache.html)
and the [OperationContext](../dev-operation-context.html). They can improve the performance
considerably.
 
 
 ## Authentication
 
 The CMIS specification recommends HTTP basic authentication for AtomPub and WS-Security UsernameToken
for Web Services. Most repositories support that. If can't find any information in the repository
documentation, assume that those are enabled.
 
-OpenCMIS also supports [NTLM](dev-session-parameters.html) but you should avoid it if you
can. It generates some side effects in the JVM and has streaming issues. 
+OpenCMIS also supports [NTLM](../dev-session-parameters.html) but you should avoid it if
you can. It generates some side effects in the JVM and has streaming issues. 
 
 If the repository need requires a different authentication mechanism, you have to implement
your own [authentication provider](dev-client-bindings.html).
 

Modified: chemistry/site/trunk/content/java/developing/dev-compare-client-api-binding.mdtext
URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/developing/dev-compare-client-api-binding.mdtext?rev=1085477&r1=1085476&r2=1085477&view=diff
==============================================================================
--- chemistry/site/trunk/content/java/developing/dev-compare-client-api-binding.mdtext (original)
+++ chemistry/site/trunk/content/java/developing/dev-compare-client-api-binding.mdtext Fri
Mar 25 17:24:43 2011
@@ -17,15 +17,13 @@ See also [OpenCMIS Client API](client/de
 
     Map<String, String> parameters = new HashMap<String, String>();
     parameters.put(SessionParameter.BINDING_TYPE, BindingType.ATOMPUB.value());
-    parameters.put(SessionParameter.ATOMPUB_URL,
-        "http://localhost:8080/opencmis/atom");
+    parameters.put(SessionParameter.ATOMPUB_URL, "http://localhost:8080/opencmis/atom");
     parameters.put(SessionParameter.REPOSITORY_ID, "A1");
     parameters.put(SessionParameter.USER, "test");
     parameters.put(SessionParameter.PASSWORD, "test");
 
     // create the session
-    Session session =
-        SessionFactoryImpl.newInstance().createSession(parameters);
+    Session session = SessionFactoryImpl.newInstance().createSession(parameters);
 
     // get repository info
     RepositoryInfo repInfo = session.getRepositoryInfo();
@@ -39,23 +37,20 @@ See also [OpenCMIS Client API](client/de
     // list root folder children
     ItemIterable<CmisObject> children = rootFolder.getChildren();
     for (CmisObject object : children) {
-      System.out.println("---------------------------------");
-      System.out.println("	Id:		  " + object.getId());
-      System.out.println("	Name:		  " + object.getName());
-      System.out.println("	Base Type:	  " + object.getBaseTypeId());
-      System.out.println("	Property 'bla':   " +
-    object.getPropertyValue("bla"));
+        System.out.println("---------------------------------");
+        System.out.println("	Id:              " + object.getId());
+        System.out.println("	Name:            " + object.getName());
+        System.out.println("	Base Type:       " + object.getBaseTypeId());
+        System.out.println("	Property 'bla':  " + object.getPropertyValue("bla"));
     
-      ObjectType type = object.getType();
-      System.out.println("	Type Id:	  " + type.getId());
-      System.out.println("	Type Name:	  " + type.getDisplayName());
-      System.out.println("	Type Query Name:  " + type.getQueryName());
+        ObjectType type = object.getType();
+        System.out.println("	Type Id:          " + type.getId());
+        System.out.println("	Type Name:        " + type.getDisplayName());
+        System.out.println("	Type Query Name:  " + type.getQueryName());
     
-      AllowableActions actions = object.getAllowableActions();
-      System.out.println("	canGetProperties: " +
-        actions.getAllowableActions().contains(Action.CAN_GET_PROPERTIES));
-      System.out.println("	canDeleteObject:  " +
-        actions.getAllowableActions().contains(Action.CAN_DELETE_OBJECT));
+        AllowableActions actions = object.getAllowableActions();
+        System.out.println("	canGetProperties: " + actions.getAllowableActions().contains(Action.CAN_GET_PROPERTIES));
+        System.out.println("	canDeleteObject:  " + actions.getAllowableActions().contains(Action.CAN_DELETE_OBJECT));
     }
     
     // get an object
@@ -63,111 +58,81 @@ See also [OpenCMIS Client API](client/de
     CmisObject object = session.getObject(objectId);
     
     if (object instanceof Folder) {
-      Folder folder = (Folder) object;
-      System.out.println("Is root folder: " + folder.isRootFolder());
+        Folder folder = (Folder) object;
+        System.out.println("Is root folder: " + folder.isRootFolder());
     }
     
     if (object instanceof Document) {
-      Document document = (Document) object;
-      ContentStream content = document.getContentStream();
-      System.out.println("Document MIME type: " + content.getMimeType());
+        Document document = (Document) object;
+        ContentStream content = document.getContentStream();
+        System.out.println("Document MIME type: " + content.getMimeType());
     }
 
 <a name="OpenCMISAPIExamples-ClientBindingAPI"></a>
 ## Client Binding API
 
-[Client Binding API JavaDoc](http://hudson.zones.apache.org/hudson/job/Chemistry%20-%20OpenCMIS%20-%20site/javadoc/org/apache/opencmis/commons/provider/package-summary.html)
-. See also [OpenCMIS Client Binding API](client/dev-client-bindings.html)
-.
-
-        Map<String, String> parameters = new HashMap<String, String>();
-        parameters.put(SessionParameter.ATOMPUB_URL,
-        "http://localhost:8080/opencmis/atom");
-        parameters.put(SessionParameter.USER, "test");
-        parameters.put(SessionParameter.PASSWORD, "test");
-
-        // create provider
-        CmisBinding binding =
-        CmisBindingFactory.newInstance().createCmisAtomPubBinding(parameters);
-
-        String repositoryId = "A1";
-
-        // get repository info
-        RepositoryInfo repInfo =
-        binding.getRepositoryService().getRepositoryInfo(repositoryId, null);
-        System.out.println("Repository name: " + repInfo.getName());
-
-        // get root folder and its path
-        ObjectData rootFolder = binding.getObjectService().getObject(repositoryId,
-        repInfo.getRootFolderId(), "*",
-              true, IncludeRelationships.NONE, null, false, false, null);
-
-        PropertyString pathProperty = (PropertyString)
-        rootFolder.getProperties().getProperties().get(PropertyIds.PATH);
-        String path = pathProperty.getFirstValue();
-        System.out.println("Root folder path: " + path);
-
-        // list root folder children
-        ObjectInFolderList childrenList =
-        binding.getNavigationService().getChildren(repositoryId,
-              repInfo.getRootFolderId(), "*", null, true,
-        IncludeRelationships.NONE, null, false,
-              BigInteger.valueOf(10000), BigInteger.ZERO, null);
-
-        for (ObjectInFolderData object : childrenList.getObjects()) {
-           System.out.println("---------------------------------");
-
-           PropertyString nameProperty = (PropertyString)
-        object.getObject().getProperties().getProperties().get(
-                 PropertyIds.NAME);
-           PropertyString blaProperty = (PropertyString)
-        object.getObject().getProperties().getProperties().get("bla");
-           PropertyId typeProperty = (PropertyId)
-        object.getObject().getProperties().getProperties().get(
-                 PropertyIds.OBJECT_TYPE_ID);
-
-           System.out.println("  Id:		" +
-        object.getObject().getId());
-           System.out.println("  Name:		" +
-        nameProperty.getFirstValue());
-           System.out.println("  Base Type:	" +
-        object.getObject().getBaseTypeId());
-           System.out.println("  Property 'bla':	" + (blaProperty == null ?
-        null : blaProperty.getFirstValue()));
-
-           TypeDefinition type =
-        binding.getRepositoryService().getTypeDefinition(repositoryId,
-                 typeProperty.getFirstValue(), null);
-           System.out.println("  Type Id:		" + type.getId());
-           System.out.println("  Type Name:	" + type.getDisplayName());
-           System.out.println("  Type Query Name:	" + type.getQueryName());
-
-           AllowableActions actions =
-        object.getObject().getAllowableActions();
-           System.out.println("  canGetProperties: "
-                 +
-        actions.getAllowableActions().contains(Action.CAN_GET_PROPERTIES));
-           System.out.println("  canDeleteObject:	"
-                 +
-        actions.getAllowableActions().contains(Action.CAN_DELETE_OBJECT));
-        }
-
-        // get an object
-        String objectId = "100";
-
-        ObjectData object = binding.getObjectService().getObject(repositoryId,
-        objectId, "*", false,
-              IncludeRelationships.NONE, null, false, false, null);
-
-        if (object.getBaseTypeId() == BaseTypeId.CMIS_FOLDER) {
-           System.out.println("Is root folder: " +
-        (repInfo.getRootFolderId().equals(object.getId())));
-        }
-
-        if (object.getBaseTypeId() == BaseTypeId.CMIS_DOCUMENT) {
-           ContentStream content =
-        binding.getObjectService().getContentStream(repositoryId, objectId, null,
-        null,
-                 null, null);
-           System.out.println("Document MIME type: " + content.getMimeType());
-        }
+[Client Binding API JavaDoc](http://hudson.zones.apache.org/hudson/job/Chemistry%20-%20OpenCMIS%20-%20site/javadoc/org/apache/opencmis/commons/provider/package-summary.html).
See also [OpenCMIS Client Binding API](client/dev-client-bindings.html).
+
+     Map<String, String> parameters = new HashMap<String, String>();
+     parameters.put(SessionParameter.ATOMPUB_URL, "http://localhost:8080/opencmis/atom");
+     parameters.put(SessionParameter.USER, "test");
+     parameters.put(SessionParameter.PASSWORD, "test");
+
+     // create binding
+     CmisBinding binding = CmisBindingFactory.newInstance().createCmisAtomPubBinding(parameters);
+
+     String repositoryId = "A1";
+
+     // get repository info
+     RepositoryInfo repInfo = binding.getRepositoryService().getRepositoryInfo(repositoryId,
null);
+     System.out.println("Repository name: " + repInfo.getName());
+
+     // get root folder and its path
+     ObjectData rootFolder = binding.getObjectService().getObject(repositoryId,
+         repInfo.getRootFolderId(), "*", true, IncludeRelationships.NONE, null, false, false,
null);
+
+     PropertyString pathProperty = (PropertyString)
+     rootFolder.getProperties().getProperties().get(PropertyIds.PATH);
+     String path = pathProperty.getFirstValue();
+     System.out.println("Root folder path: " + path);
+
+     // list root folder children
+     ObjectInFolderList childrenList = binding.getNavigationService().getChildren(repositoryId,
repInfo.getRootFolderId(), "*", null, true,
+         IncludeRelationships.NONE, null, false, BigInteger.valueOf(10000), BigInteger.ZERO,
null);
+
+     for (ObjectInFolderData object : childrenList.getObjects()) {
+         System.out.println("---------------------------------");
+
+         PropertyString nameProperty = (PropertyString) object.getObject().getProperties().getProperties().get(PropertyIds.NAME);
+         PropertyString blaProperty = (PropertyString) object.getObject().getProperties().getProperties().get("bla");
+         PropertyId typeProperty = (PropertyId) object.getObject().getProperties().getProperties().get(PropertyIds.OBJECT_TYPE_ID);
+
+         System.out.println("  Id:	           " + object.getObject().getId());
+         System.out.println("  Name:             " + nameProperty.getFirstValue());
+         System.out.println("  Base Type:        " + object.getObject().getBaseTypeId());
+         System.out.println("  Property 'bla':   " + (blaProperty == null ? null : blaProperty.getFirstValue()));
+
+         TypeDefinition type = binding.getRepositoryService().getTypeDefinition(repositoryId,
typeProperty.getFirstValue(), null);
+         System.out.println("  Type Id:          " + type.getId());
+         System.out.println("  Type Name:        " + type.getDisplayName());
+         System.out.println("  Type Query Name:  " + type.getQueryName());
+
+         AllowableActions actions = object.getObject().getAllowableActions();
+         System.out.println("  canGetProperties: " + actions.getAllowableActions().contains(Action.CAN_GET_PROPERTIES));
+         System.out.println("  canDeleteObject:  " + actions.getAllowableActions().contains(Action.CAN_DELETE_OBJECT));
+     }
+
+     // get an object
+     String objectId = "100";
+
+     ObjectData object = binding.getObjectService().getObject(repositoryId, objectId, "*",
false,
+         IncludeRelationships.NONE, null, false, false, null);
+
+      if (object.getBaseTypeId() == BaseTypeId.CMIS_FOLDER) {
+          System.out.println("Is root folder: " + (repInfo.getRootFolderId().equals(object.getId())));
+      }
+
+      if (object.getBaseTypeId() == BaseTypeId.CMIS_DOCUMENT) {
+          ContentStream content = binding.getObjectService().getContentStream(repositoryId,
objectId, null, null, null, null);
+          System.out.println("Document MIME type: " + content.getMimeType());
+     }



Mime
View raw message