chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1083786 - in /chemistry/site/trunk/content/java: developing/ examples/
Date Mon, 21 Mar 2011 13:57:55 GMT
Author: fmui
Date: Mon Mar 21 13:57:55 2011
New Revision: 1083786

URL: http://svn.apache.org/viewvc?rev=1083786&view=rev
Log:
more example code

Modified:
    chemistry/site/trunk/content/java/developing/dev-known-repo-issues.mdtext
    chemistry/site/trunk/content/java/developing/dev-operation-context.mdtext
    chemistry/site/trunk/content/java/examples/example-connect-dotnet.mdtext
    chemistry/site/trunk/content/java/examples/example-create-session.mdtext
    chemistry/site/trunk/content/java/examples/example-create-update.mdtext
    chemistry/site/trunk/content/java/examples/example-get-id-from-path.mdtext
    chemistry/site/trunk/content/java/examples/example-list-folder.mdtext
    chemistry/site/trunk/content/java/examples/example-osgi.mdtext
    chemistry/site/trunk/content/java/examples/example-read-root.mdtext
    chemistry/site/trunk/content/java/examples/index.mdtext

Modified: chemistry/site/trunk/content/java/developing/dev-known-repo-issues.mdtext
URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/developing/dev-known-repo-issues.mdtext?rev=1083786&r1=1083785&r2=1083786&view=diff
==============================================================================
--- chemistry/site/trunk/content/java/developing/dev-known-repo-issues.mdtext (original)
+++ chemistry/site/trunk/content/java/developing/dev-known-repo-issues.mdtext Mon Mar 21 13:57:55
2011
@@ -1,4 +1,3 @@
-
 Title: Known repository issues
 
 #  Known repository issues

Modified: chemistry/site/trunk/content/java/developing/dev-operation-context.mdtext
URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/developing/dev-operation-context.mdtext?rev=1083786&r1=1083785&r2=1083786&view=diff
==============================================================================
--- chemistry/site/trunk/content/java/developing/dev-operation-context.mdtext (original)
+++ chemistry/site/trunk/content/java/developing/dev-operation-context.mdtext Mon Mar 21 13:57:55
2011
@@ -1,6 +1,4 @@
-
 Title: Understanding the Operation Context
-
 # Understanding the Operation Context
 
 TODO

Modified: chemistry/site/trunk/content/java/examples/example-connect-dotnet.mdtext
URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/examples/example-connect-dotnet.mdtext?rev=1083786&r1=1083785&r2=1083786&view=diff
==============================================================================
--- chemistry/site/trunk/content/java/examples/example-connect-dotnet.mdtext (original)
+++ chemistry/site/trunk/content/java/examples/example-connect-dotnet.mdtext Mon Mar 21 13:57:55
2011
@@ -1,10 +1,8 @@
-Title:  Connecting from a .Net client
+Title: Connecting from a .NET client
 
-# Connecting from a .Net client via the Web Services binding
+# Connecting from a .NET client via the Web Services binding
     
-This is a very simple C# example that demonstrates how to connect to an
-OpenCMIS server via the Web Services binding. Please note that .Net only
-allows UsernameTokens over HTTPS.
+This is a very simple C# example that demonstrates how to connect to an OpenCMIS server via
the Web Services binding. Please note that .NET only allows UsernameTokens over HTTPS.
 (See also [DotCMIS](../../dotnet/dotcmis.html)).
 
     :::C#

Modified: chemistry/site/trunk/content/java/examples/example-create-session.mdtext
URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/examples/example-create-session.mdtext?rev=1083786&r1=1083785&r2=1083786&view=diff
==============================================================================
--- chemistry/site/trunk/content/java/examples/example-create-session.mdtext (original)
+++ chemistry/site/trunk/content/java/examples/example-create-session.mdtext Mon Mar 21 13:57:55
2011
@@ -1,13 +1,13 @@
 Title: Creating a session
 
 # Creating a session
-This example explains the first steps required in each client application: 
+These examples show the first steps that are required in client applications: 
 How to create a session and connect to a repository.
 
 ## AtomPub binding
 
     :::java
-    // default factory implementation of client runtime
+    // default factory implementation
     SessionFactory factory = SessionFactoryImpl.newInstance();
     Map<String, String> parameter = new HashMap<String, String>();
     
@@ -27,7 +27,7 @@ How to create a session and connect to a
 ## Web Services binding
 
     ::java
-    // default factory implementation of client runtime
+    // default factory implementation
     SessionFactory factory = SessionFactoryImpl.newInstance();
     Map<String, String> parameter = new HashMap<String, String>();
     
@@ -54,8 +54,10 @@ How to create a session and connect to a
 
 ## Local binding
 
+The local binding is specific to OpenCMIS. It lets an OpenCMIS client connect to an OpenCMIS
server in the same JVM.
+
     ::java
-    // default factory implementation of client runtime
+    // default factory implementation
     SessionFactory factory = SessionFactoryImpl.newInstance();
     Map<String, String> parameter = new HashMap<String, String>();
     

Modified: chemistry/site/trunk/content/java/examples/example-create-update.mdtext
URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/examples/example-create-update.mdtext?rev=1083786&r1=1083785&r2=1083786&view=diff
==============================================================================
--- chemistry/site/trunk/content/java/examples/example-create-update.mdtext (original)
+++ chemistry/site/trunk/content/java/examples/example-create-update.mdtext Mon Mar 21 13:57:55
2011
@@ -1,5 +1,54 @@
 Title: Creating and updating CMIS objects
- 
+
 # Creating and updating CMIS objects
  
-TODO
\ No newline at end of file
+
+## Creating a folder
+
+This example creates a folder under the root folder.
+
+    Folder root = session.getRootFolder();
+
+    // properties (minimal set: name and object type id)
+    Map<String, Object> properties = new HashMap<String, Object>();
+    properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:folder");
+    properties.put(PropertyIds.NAME, "a new folder");
+
+    // create the folder
+    Folder newFolder = root.createFolder(properties);
+
+
+## Creating a document
+
+This example creates a document in the folder `parent`.
+
+    Folder parent = ....
+
+    String name = "myNewDocument.txt";
+
+    // properties (minimal set: name and object type id)
+    Map<String, Object> properties = new HashMap<String, Object>();
+    properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
+    properties.put("PropertyIds.NAME, name);
+    
+    // content
+    byte[] content = "Hello World!".getBytes();
+    InputStream stream = new ByteArrayInputStream(content);
+    ContentStream contentStream = new ContentStreamImpl(name, content.length, "text/plain",
stream);
+    
+    // create a major version
+    Document newDoc = parent.createDocument(properties, contentStream, VersioningState.MAJOR);
+
+
+## Update properties
+
+This example updates two properties of a CMIS object
+
+    CmisObject cmisobject = ....
+
+    Map<String, Object> updateproperties = new HashMap<String, Object>();
+    updateproperties.put("my:property", "new value");
+    updateproperties.put("my:other.property", 42);
+
+    cmisobject.updateProperties(updateproperties);
+

Modified: chemistry/site/trunk/content/java/examples/example-get-id-from-path.mdtext
URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/examples/example-get-id-from-path.mdtext?rev=1083786&r1=1083785&r2=1083786&view=diff
==============================================================================
--- chemistry/site/trunk/content/java/examples/example-get-id-from-path.mdtext (original)
+++ chemistry/site/trunk/content/java/examples/example-get-id-from-path.mdtext Mon Mar 21
13:57:55 2011
@@ -1,9 +1,10 @@
 Title: Getting the id from path
+
 # Getting the id of an object from its path
 
 A code snippet how to get the id of an object when only a path is known:
 
     :::java
     String path = "/User Homes/customer1/document.odt"
-    CmisObject object = getSession().getObjectByPath(path);
+    CmisObject object = session.getObjectByPath(path);
     String id = object.getId();
\ No newline at end of file

Modified: chemistry/site/trunk/content/java/examples/example-list-folder.mdtext
URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/examples/example-list-folder.mdtext?rev=1083786&r1=1083785&r2=1083786&view=diff
==============================================================================
--- chemistry/site/trunk/content/java/examples/example-list-folder.mdtext (original)
+++ chemistry/site/trunk/content/java/examples/example-list-folder.mdtext Mon Mar 21 13:57:55
2011
@@ -1,6 +1,4 @@
-
 Title: List a folder with paging
-
 # Showing a folder's items, with results paging
 
     :::java
@@ -8,7 +6,7 @@ Title: List a folder with paging
     int skipCount = 10;
     
     CmisObject object = session.getObject(session.createObjectId(folderId));
-    Folder folder = (Folder)object;
+    Folder folder = (Folder) object;
     OperationContext operationContext = session.createOperationContext();
     operationContext.setMaxItemsPerPage(maxItemsPerPage);
     

Modified: chemistry/site/trunk/content/java/examples/example-osgi.mdtext
URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/examples/example-osgi.mdtext?rev=1083786&r1=1083785&r2=1083786&view=diff
==============================================================================
--- chemistry/site/trunk/content/java/examples/example-osgi.mdtext (original)
+++ chemistry/site/trunk/content/java/examples/example-osgi.mdtext Mon Mar 21 13:57:55 2011
@@ -1,6 +1,4 @@
-
 Title: Using OSGI with OpenCMIS
-
 # Using OSGI with OpenCMIS
 
 This example shows how to use OpenCMIS with OSGI bundles.

Modified: chemistry/site/trunk/content/java/examples/example-read-root.mdtext
URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/examples/example-read-root.mdtext?rev=1083786&r1=1083785&r2=1083786&view=diff
==============================================================================
--- chemistry/site/trunk/content/java/examples/example-read-root.mdtext (original)
+++ chemistry/site/trunk/content/java/examples/example-read-root.mdtext Mon Mar 21 13:57:55
2011
@@ -1,14 +1,30 @@
-Title: Reading the Root Fodler
+Title: Reading the Root Folder
 
-#  Reading the Root Folder
+# Reading the Root Folder
 
-<DIV class="codeHeader">Reading the Root Collection</DIV>
+## Listing all children
+
+This example lists all objects in the root folder.
 
     :::java
-    Folder root = this.session.getRootFolder();
+    Folder root = session.getRootFolder();
     
     ItemIterable<CmisObject> pl = root.getChildren();
     
     for (CmisObject o : pl) {
       System.out.println(o.getName());
     }
+
+
+## Retrieving a page
+
+This example retrieves a page of 10 objects starting at the 20th child.
+
+    :::java
+    Folder root = session.getRootFolder();
+    
+    ItemIterable<CmisObject> pl = root.getChildren().skipTo(20).getPage(10);
+    
+    for (CmisObject o : pl) {
+      System.out.println(o.getName());
+    }
\ No newline at end of file

Modified: chemistry/site/trunk/content/java/examples/index.mdtext
URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/examples/index.mdtext?rev=1083786&r1=1083785&r2=1083786&view=diff
==============================================================================
--- chemistry/site/trunk/content/java/examples/index.mdtext (original)
+++ chemistry/site/trunk/content/java/examples/index.mdtext Mon Mar 21 13:57:55 2011
@@ -7,7 +7,7 @@ Example code and code fragments for the 
 ## Basics
 
 * [Creating a session](example-create-session.html)
-* [Creating and updating a document](example-create-update.html)
+* [Creating and updating a CMIS object](example-create-update.html)
 * [Listing a folder](example-list-folder.html)
 * [Processing a query](example-process-query-results.html)
 * [Reading metadata and content](example-read-meta-content.html)



Mime
View raw message