chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r791371 [2/3] - in /websites/staging/chemistry/trunk/content/java/developing: guide.html images/ images/FileTree.png images/todo.gif
Date Wed, 22 Jun 2011 09:39:33 GMT

Added: websites/staging/chemistry/trunk/content/java/developing/guide.html
==============================================================================
--- websites/staging/chemistry/trunk/content/java/developing/guide.html (added)
+++ websites/staging/chemistry/trunk/content/java/developing/guide.html Wed Jun 22 09:39:32 2011
@@ -0,0 +1,1341 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<html>
+  <head>
+    <link type="text/css" rel="stylesheet" href="/resources/site.css" />
+    <script src="/resources/space.js" type="text/javascript"></script>
+    <meta name="keywords" content="CMIS, Content Management Interoperability Service, ECM, Enterprise Content Management, OASIS, integration standards, Chemistry, OpenCMIS, cmislib, DotCMIS" />
+    <meta name="description" content="Apache Chemistry, CMIS Implementation" />
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <title>
+Apache Chemistry - OpenCMIS Client API Developer&#39;s Guide
+    </title>
+  </head>
+<body onload="init()">
+  <table width="100%" cellpadding="0" cellspacing="0">
+    <tr width="100%">
+      <td id="cell-0-0">&nbsp;</td>
+      <td id="cell-0-1">&nbsp;</td>
+      <td id="cell-0-2">&nbsp;</td>
+    </tr>
+    <tr width="100%">
+      <td id="cell-1-0">&nbsp;</td>
+      <td id="cell-1-1">
+        <div style="padding: 0px;">
+          <div id="banner">
+          <!-- Banner -->
+<TABLE border="0" cellpadding="0" cellspacing="0" width="100%">
+<TR>
+<TD align="left" class="topbardiv" nowrap="">
+  <A href="http://chemistry.apache.org/" title="Apache Chemistry">
+    <IMG border="0" src="/images/chemistry_tm_logo_small.png"/>
+  </A>
+</TD>
+<TD align="right" nowrap="">
+  <A href="http://www.apache.org/" title="The Apache Software Foundation">
+    <IMG border="0" src="/images/asf-logo.png"/>
+  </A>
+</TD>
+</TR>
+</TABLE>
+          <!-- Banner -->
+          </div>
+        </div>
+        <div id="top-menu">
+          <table border="0" cellpadding="1" cellspacing="0" width="100%">
+            <tr>
+              <td>
+                <div align="left">
+                <!-- Breadcrumbs -->
+<a href="/">Home</a>&nbsp;&raquo&nbsp;<a href="/java">Java</a>&nbsp;&raquo&nbsp;<a href="/java/developing">Developing</a>&nbsp;&raquo&nbsp;<a href="/java/developing/guide.html">OpenCMIS Client API Developer's Guide</a>
+                <!-- Breadcrumbs -->
+                </div>
+              </td>
+              <td>
+                <div align="right">
+                <!-- Quicklinks -->
+<P>
+<A href="http://www.apache.org/" class="external-link" rel="nofollow">Apache</A>
+|
+<A href="http://www.apache.org/licenses/LICENSE-2.0.html" class="external-link" rel="nofollow">License</A>
+|
+<A href="sitemap.html" title="SiteMap">Site Map</A>
+</P>
+                <!-- Quicklinks -->
+                </div>
+              </td>
+            </tr>
+          </table>
+        </div>
+      </td>
+      <td id="cell-1-2">&nbsp;</td>
+    </tr>
+    <tr width="100%">
+      <td id="cell-2-0">&nbsp;</td>
+      <td id="cell-2-1">
+        <table>
+          <tr height="100%" valign="top">
+            <td height="100%">
+              <div id="wrapper-menu-page-right">
+                <div id="wrapper-menu-page-top">
+                  <div id="wrapper-menu-page-bottom">
+                    <div id="menu-page">
+                    <!-- NavigationBar -->
+                    <H3><A name="Navigation-Overview"></A>Overview</H3>
+
+<UL class="alternate" type="square">
+   <LI><A href="/project/cmis.html" title="What's CMIS">What is CMIS?</A></LI>
+   <LI><A href="http://www.apache.org/licenses/" class="external-link" rel="nofollow">License</A></LI>
+   <LI><A href="/project/community.html" title="Community">Community</A></LI>
+   <LI><A href="http://mail-archives.apache.org/mod_mbox/chemistry-dev/" class="external-link" rel="nofollow">Mailing List</A></LI>
+   <LI><A href="https://issues.apache.org/jira/browse/CMIS" class="external-link" rel="nofollow">Issue Tracking</A></LI>
+   <LI><A href="http://www.apache.org/security/" class="external-link" rel="nofollow">Security</A></LI>
+</UL>
+
+
+<H3><A name="Navigation-Search"></A>Search</H3>
+
+<DIV style="padding: 0px 0px 0px 20px;">
+<FORM action="http://www.google.com/search" method="get" style="font-size: 10px;">
+<INPUT name="ie" type="hidden" value="UTF-8"></INPUT>
+<INPUT name="oe" type="hidden" value="UTF-8"></INPUT>
+  <INPUT maxlength="255" name="q" size="12" type="text" value=""></INPUT>
+  <INPUT name="btnG" type="submit" value="Search"></INPUT>
+  <INPUT name="domains" type="hidden" value="chemistry.apache.org"></INPUT>
+  <INPUT name="sitesearch" type="hidden" value="chemistry.apache.org"></INPUT>
+</FORM>
+</DIV>
+
+
+<H3><A name="Navigation-CMISforJava"></A>CMIS for Java</H3>
+
+<UL class="alternate" type="square">
+  <LI><A href="/java/opencmis.html" title="OpenCMIS Overview and Index">Overview</A></LI>
+  <LI><A href="/java/download.html" title="Downloads">Downloads</A></LI>
+  <LI><A href="/java/developing/index.html" title="">Developing with OpenCMIS</A></LI>
+  <LI><A href="/java/examples/index.html" title="Example Code">Example Code</A></LI>
+  <LI><A href="/java/how-to/index.html" title="OpenCMIS HowTos">OpenCMIS HowTos</A></LI>
+  <LI><A href="http://incubator.apache.org/chemistry/javadoc/index.html" class="external-link" rel="nofollow">JavaDoc</A></LI>
+  <LI><A href="https://svn.apache.org/repos/asf/chemistry/opencmis/trunk/" class="external-link" rel="nofollow">Source Code</A></LI>
+</UL>
+
+
+<H3><A name="Navigation-CMISforPython"></A>CMIS for Python</H3>
+
+<UL class="alternate" type="square">
+  <LI><A href="/python/cmislib.html" title="cmislib">cmislib</A></LI>
+   <LI><A href="http://incubator.apache.org/chemistry/cmislib-doc/" class="external-link" rel="nofollow">cmislib Documentation</A></LI>
+  <LI><A href="https://svn.apache.org/repos/asf/chemistry/cmislib/trunk/" class="external-link" rel="nofollow">Source Code</A></LI>
+</UL>
+
+
+<H3><A name="Navigation-CMISforPHP"></A>CMIS for PHP</H3>
+
+<UL class="alternate" type="square">
+  <LI><A href="/php/phpclient.html" title="phpclient">CMIS PHP Client</A></LI>
+  <LI><A href="https://svn.apache.org/repos/asf/chemistry/phpclient/trunk/" class="external-link" rel="nofollow">Source Code</A></LI>
+</UL>
+
+
+<H3><A name="Navigation-CMISfor.NET"></A>CMIS for .NET</H3>
+
+<UL class="alternate" type="square">
+  <LI><A href="/dotnet/dotcmis.html" title="DotCMIS">DotCMIS</A></LI>
+  <LI><A href="https://svn.apache.org/repos/asf/chemistry/dotcmis/trunk/" class="external-link" rel="nofollow">Source Code</A></LI>
+</UL>
+
+
+<H3><A name="Navigation-Sponsorship"></A>Sponsorship</H3>
+
+<UL class="alternate" type="square">
+   <LI><A href="http://www.apache.org/foundation/thanks.html" class="external-link" rel="nofollow">Thanks</A></LI>
+   <LI><A href="http://www.apache.org/foundation/sponsorship.html" class="external-link" rel="nofollow">Sponsoring Apache</A></LI>
+</UL>
+
+
+<H3><A name="Navigation-Internal"></A>Internal Docs</H3>
+
+<UL class="alternate" type="square">
+   <LI><A href="/internal/internal-index.html"> Internal Documentation</A></LI>
+</UL>
+                    <!-- NavigationBar -->
+                    </div>
+                </div>
+              </div>
+            </div>
+           </td>
+           <td height="100%">
+             <!-- Content -->
+             <div class="wiki-content"><h1 id="opencmis_client_api_developers_guide">OpenCMIS Client API Developer's Guide</h1>
+<h2 id="audience">Audience</h2>
+<p>This guide is for software engineers who want to use the Apache Chemistry OpenCMIS client to access CMIS-complaint
+content repositories from java code. The examples included in the guide assume the code is running in
+a standalone Java application, but the OpenCMIS client can be used by on any Java platform, 
+such as Web applications and phone apps.</p>
+<h3 id="how_to_use_this_guide">How to use this guide</h3>
+<p>The guide is divided into 5 parts :-</p>
+<ol>
+<li><em>The Basics</em> - A brief introduction to CMIS and a practical "hello world" sample. Read this section to find out how to build, install and run a sample OpenCMIS application using Apache Chemistry.</li>
+<li><em>Getting Started with OpenCMIS</em> - quick, practical examples of the the most commonly needed CMIS function.</li>
+<li><em>Advanced CMIS features</em> - the rest of the CMIS API</li>
+<li><em>OpenCMIS bindings</em> - the 2 CMIS 1.0 bindings, and when and how to use them.</li>
+<li><em>Troubleshooting</em> - common pitfalls you may encounter when using OpenCMIS.</li>
+</ol>
+<h3 id="assumptions">Assumptions</h3>
+<p>The guide assumes you are using the Eclipse IDE for code development, and have Maven and SVN installed.</p>
+<ul>
+<li>You can download and install Eclipse <a href="http://eclipse.org/downloads.html">here</a>.</li>
+<li>You can download and install Maven <a href="http://maven.apache.org/download.html">here</a>.</li>
+<li>You can download and install SVN for your platform <a href="http://subversion.apache.org/packages.html">here</a>.</li>
+</ul>
+<h2 id="the_basics">The basics</h2>
+<p>This section gives a high-level overview of the OpenCMIS library, and introduces a supplied "Hello World" sample to
+get an OpenCMIS client up and running against a repository and accessing CMIS objects.</p>
+<h3 id="what_is_opencmis">What is OpenCMIS?</h3>
+<p>CMIS (Content Management Interoperability Services) is vendor-neutral <a href="http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=cmis">OASIS Web services interface specification</a> 
+that enables interoperability between Enterprise Content Management (ECM) systems. 
+CMIS allows rich information to be shared across Internet protocols in vendor-neutral formats, 
+among document systems, publishers and repositories, in a single enterprise and between companies.</p>
+<p>OpenCMIS is a collection of Java libraries frameworks and tools based on the CMIS  specification. 
+It is available under the open source <a href="http://www.apache.org/licenses/">Apache License</a> from the
+<a href="http://chemistry.apache.org/">Apache Chemistry project</a>.
+The OpenCMIS Client API is a Java client-side library that implements the CMIS specification. You can see the Javadoc for the 
+OpenCMIS Client API <a href="http://incubator.apache.org/chemistry/javadoc/org/apache/chemistry/opencmis/client/api/package-summary.html">here</a>.
+CMIS defines a domain model that describes a vendor-neutral ECM repository and its contents, a set of services to work with the 
+repository and its content, and a set of bindings which a client uses to access the services.</p>
+<h4 id="the_cmis_domain_model">The CMIS Domain Model</h4>
+<p>CMIS defines a domain model. A client will access a CMIS service endpoint described by a URL. A service endpoint must have at least one repository.
+A repository is a data store and contains content. Each item of content is an object such as a folder, or a document.  A repository is identified by its ID, and has a set of capabilities which describe what optional 
+CMIS functionality the repository supports. </p>
+<p>An object has an ID, has a type, and has set of properties for that type.
+There are four base types for a CMIS object :-</p>
+<ul>
+<li><em>Document</em> - is an item of content. The document may have a content stream, which is the actual file associated with the document. 
+A content stream exists  only as part of its containing document object. A content stream has a mimetype associated with it.
+A document object may contain one or more renditions, which are alternate views of the content.
+Documents objects are  the only objects that are <em>versionable</em>. 
+Each version of a document has its own object ID. All the versions of a document make up a version series and share a version series ID.
+You can create, read, update and delete documents using OpenCMIS methods. </li>
+<li><em>Folder</em> - is a container used to organize the document objects. A repository had one root folder. All other folder objects 
+have one parent folder. A folder has a folder path representing its place in the repository's folder hierarchy.
+A folder object can have renditions. For example, a folder can have a thumbnail as a rendition representing the contents of the folder.</li>
+<li><em>Relationship</em> - define relationships between a source object and a target object. 
+Creating, changing and deleting relationships do not change the source or target objects themselves. 
+Relationship objects are optional. A CMIS repository may not support relationship objects.</li>
+<li><em>Policy</em> - are optional repository-specific objects that can be applied to controllable objects. The behavior of policies are not modeled by the CMIS specification. 
+A  policy object may be applied to multiple controllable objects and a controllable object may have multiple policies applied to it. 
+A policy object can not be deleted if it is currently applied to one or more controllable objects.</li>
+</ul>
+<p>There can be other object types in the repository, defined in a repository as subtypes of these base types. 
+CMIS services are provided for the discovery of object-types that are defined in a repository, but for the moment 
+folders and documents are the main objects you will be concerned with for the first 2 parts of this document.</p>
+<h4 id="cmis_services">CMIS Services</h4>
+<p>The CMIS specification describes a set of services that act on repositories. The OpenCMIS client API uses these services, but by using a client binding,
+presents the user of the API simple set of classes rather than the services described by CMIS. If you want to access a CMIS repository at the service level, you can do that
+by using the <a href="http://chemistry.apache.org/java/developing/client/dev-client-bindings.html">OpenCMIS client bindings layer</a> directly.
+The CMIS services are:-</p>
+<ul>
+<li><em>Repository services</em> -  let you discover available repositories, get the capabilities of these repositories, and provide basic Data Dictionary information of what types are available in the repository.</li>
+<li><em>Navigation services</em> -  let you navigate the repository by accessing the folder tree and traversing the folder/child hierarchy. You can use these services to get both children and parents of an object.</li>
+<li><em>Object services</em> -  provide the basic CRUD (Create, Read, Update, Delete) and Control services on any object, including document, folder, policy, and relationship objects. For document objects, this includes setting and getting of properties, policies, and content streams. Object services retrieve objects by path or object ID. Applications may also discover what actions users are allowed to perform.</li>
+<li><em>Multi-filing services</em> -  let you establish the hierarchy by adding or removing an object to or from a folder.</li>
+<li><em>Discovery services</em> -  provide Query and Change services, and a means of paging the results of the query.</li>
+<li><em>Change services</em> -  let you discover what content has changed since the last time checked, as specified by a special token. You can use Change services for external search indexing and replication services.</li>
+<li><em>Versioning services</em> -  control concurrent operation of the Object services by providing Check In and Check Out services. Version services also provide version histories for objects that are versioned.</li>
+<li><em>Relationship services</em> -  let you create, manage, and access relationships or associations between objects as well as allow an application to traverse those associations.</li>
+<li><em>Policy services</em> -  apply policies on document objects. Policies are free-form objects and can be used by implementations for security, record, or control policies.</li>
+<li><em>ACL services</em> - let you create, manage, and access Access Control Lists to control who can perform certain operations on an object.</li>
+</ul>
+<h4 id="cmis_bindings">CMIS Bindings</h4>
+<p>How does an OpenCMIS client communicate over the wire with a CMIS service endpoint? A CMIS repository can communicate over two protocols,
+SOAP and <a href="http://tools.ietf.org/html/rfc5023">AtomPub</a>, and provide  tow corresponding bindings, a web services binding, and an AtomPub binding. A CMIS service endpoint will 
+provide a URL for both types of binding, and in an OpenCMIS you specify the binding type when calling the <code>getRepositories()</code> method on 
+the <code>SessionFactory</code> object.</p>
+<h4 id="the_opencmis_workbench">The OpenCMIS Workbench</h4>
+<p>The workbench is a GUI repository browser that lets you quickly view the contents of a repository, create documents and folders, look at metadata, and 
+perform queries. It's really useful for debugging your applications, and for quickly testing out queries before you commit them to code. You can
+download the latest version <a href="http://incubator.apache.org/chemistry/cmis-workbench.html">here</a>. The workbench is a Java Swing application, and comes 
+with both Windows and UNIX starter scripts.</p>
+<h3 id="hello_world">Hello World</h3>
+<p>You can download, install, and test the Apache Chemistry client code using the <code>Hello World</code> sample. On a command line, type the following command :-
+<p class="todo"> Need a full URL here</p></p>
+<div class="codehilite"><pre><span class="n">svn</span> <span class="n">co</span> <span class="n">https:</span><span class="sr">//s</span><span class="n">vn</span><span class="o">.</span><span class="n">apache</span><span class="o">.</span><span class="n">org</span><span class="sr">/repos/</span><span class="n">asf</span><span class="sr">/chemistry/o</span><span class="n">pencmis</span><span class="sr">/trunk/c</span><span class="n">hemistry</span><span class="o">-</span><span class="n">opencmis</span><span class="o">-</span><span class="n">samples</span><span class="o">/</span><span class="n">chemistry</span><span class="o">-</span><span class="n">opencmis</span><span class="o">-</span><span class="n">hello</span>
+</pre></div>
+
+
+<p>You can then build the sample and run the <code>org.apache.chemistry.opencmis.doc.Hello</code> sample using maven, by typing the following command</p>
+<div class="codehilite"><pre><span class="n">mvn</span> <span class="n">clean</span> <span class="n">install</span>
+</pre></div>
+
+
+<p>You will see some output towards the end of the build that looks similar to the following lines:-</p>
+<div class="codehilite"><pre><span class="s-Atom">org</span><span class="p">.</span><span class="s-Atom">apache</span><span class="p">.</span><span class="s-Atom">chemistry</span><span class="p">.</span><span class="s-Atom">opencmis</span><span class="p">.</span><span class="s-Atom">doc</span><span class="p">.</span><span class="nv">Hello</span> <span class="s-Atom">started</span>
+<span class="nv">Found</span> <span class="nn">repository</span><span class="p">:</span> <span class="nv">InMemory</span> <span class="nv">Repository</span>
+<span class="nv">Got</span> <span class="s-Atom">a</span> <span class="s-Atom">connection</span> <span class="s-Atom">to</span> <span class="nn">repository</span><span class="p">:</span> <span class="nv">InMemory</span> <span class="nv">Repository</span><span class="p">,</span> <span class="s-Atom">with</span> <span class="nn">id</span><span class="p">:</span> <span class="nv">A1</span>
+<span class="nv">Found</span> <span class="s-Atom">the</span> <span class="s-Atom">following</span> <span class="s-Atom">objects</span> <span class="s-Atom">in</span> <span class="s-Atom">the</span> <span class="s-Atom">root</span> <span class="nn">folder</span><span class="p">:</span><span class="o">-</span>
+<span class="nv">MasterClass</span>
+<span class="nv">My_Document</span><span class="o">-</span><span class="m">0</span><span class="o">-</span><span class="m">0</span>
+<span class="nv">My_Document</span><span class="o">-</span><span class="m">0</span><span class="o">-</span><span class="m">1</span>
+<span class="nv">My_Document</span><span class="o">-</span><span class="m">0</span><span class="o">-</span><span class="m">2</span>
+<span class="nv">My_Folder</span><span class="o">-</span><span class="m">0</span><span class="o">-</span><span class="m">0</span>
+<span class="nv">My_Folder</span><span class="o">-</span><span class="m">0</span><span class="o">-</span><span class="m">1</span>
+<span class="s-Atom">org</span><span class="p">.</span><span class="s-Atom">apache</span><span class="p">.</span><span class="s-Atom">chemistry</span><span class="p">.</span><span class="s-Atom">opencmis</span><span class="p">.</span><span class="s-Atom">doc</span><span class="p">.</span><span class="nv">Hello</span> <span class="s-Atom">ended</span>
+</pre></div>
+
+
+<p>The Hello World sample has connected to a public CMIS repository and retrieved all the objects in the root folder of that repository.
+The simplest way to view the sample code is to use eclipse</p>
+<ol>
+<li>
+<p>Add the maven repository to your eclipse workspace classpath with the following command. You only need to perform this step once.</p>
+<p><code>mvn eclipse:configure-workspace -Declipse.workspace=&lt;path-to-your-eclipse-workspace&gt;</code></p>
+</li>
+<li>
+<p>Create a an eclipse project from the code, and import it into your eclipse.
+Type the following command :-</p>
+<p><code>mvn eclipse:eclipse</code></p>
+</li>
+<li>
+<p>Import the project into eclipse:-</p>
+<ol>
+<li>click <code>File-&gt;Import</code> and choose <code>General-&gt;Existing projects into workspace</code> in the 
+Import wizard.</li>
+<li>Click <code>Next</code> and  browse to the folder you extracted the project to.</li>
+<li>Click the checkbox next to <code>chemistry-opencmis-hello</code> project. The project will be imported into your workspace.</li>
+</ol>
+</li>
+</ol>
+<p>You can run the <code>main</code> method in the <code>Hello</code> class as a Java application.</p>
+<p>Once you have successfully run the <code>Hello World</code> sample, you can start to get familiar with the core parts of the 
+OpenCMIS API in the next section.</p>
+<h2 id="getting_started_with_opencmis">Getting Started with OpenCMIS</h2>
+<p>This section introduces the most commonly used parts of the OpenCMIS client API. The code snippets are taken from the GettingStarted sample class supplied with Apache chemistry.</p>
+<h3 id="installing_the_getting_started_sample">Installing the getting started sample</h3>
+<p>On a command line, type the following command :-
+<p class="todo"> Need a full URL here</p></p>
+<div class="codehilite"><pre><span class="n">svn</span> <span class="n">co</span> <span class="n">https:</span><span class="sr">//s</span><span class="n">vn</span><span class="o">.</span><span class="n">apache</span><span class="o">.</span><span class="n">org</span><span class="sr">/repos/</span><span class="n">asf</span><span class="sr">/chemistry/o</span><span class="n">pencmis</span><span class="sr">/trunk/c</span><span class="n">hemistry</span><span class="o">-</span><span class="n">opencmis</span><span class="o">-</span><span class="n">samples</span><span class="o">/</span><span class="n">chemistry</span><span class="o">-</span><span class="n">opencmis</span><span class="o">-</span><span class="n">getting</span><span class="o">-</span><span class="n">started</span>
+</pre></div>
+
+
+<p>You can then build the sample and run the <code>org.apache.chemistry.opencmis.doc.GettingStarted</code> sample using maven, by typing the following command</p>
+<div class="codehilite"><pre><span class="n">mvn</span> <span class="n">clean</span> <span class="n">install</span>
+</pre></div>
+
+
+<p>This will pull in any dependencies for the sample, build it, and run it against a public repository.</p>
+<p>The simplest way to work with the getting started sample is to use Maven to create an eclipse project from the code, and import it into your eclipse.
+To create the eclipse project type the following command :-</p>
+<div class="codehilite"><pre><span class="n">mvn</span> <span class="n">eclipse:eclipse</span>
+</pre></div>
+
+
+<p>To import the project into eclipse:-</p>
+<ol>
+<li>click <code>File-&gt;Import</code> and choose <code>General-&gt;Existing projects into workspace</code> in the 
+Import wizard.</li>
+<li>Click <code>Next</code> and  browse to the folder you extracted the project to.</li>
+<li>Click the checkbox next to <code>chemistry-opencmis-gettingstarted</code> project. The project will be imported into your workspace.</li>
+</ol>
+<p>You can run the <code>main</code> method in the <code>GettingStarted</code> class as a Java application.</p>
+<h3 id="connecting_to_a_cmis_repository">Connecting to a CMIS repository</h3>
+<p>To do any work on a repository, you must first find your repository, and create a session with it.
+To do that, you create a SessionFactory, and set up a parameter map that describes the credentials
+and connection settings for the target URL.  This code snippet uses the publicly accessible OpenCMIS InMemory Repository
+which you will be sharing with everyone. There are other publicly accessible CMIS repositories which you can try your code out on, or 
+you can change the code to use a repository local to you.
+Note that:-</p>
+<ol>
+<li>This repository does not require credentials, but the code snippet sets a user id and password to show how this is done</li>
+<li>
+<p>The code uses the <code>ATOMPUB</code> binding for connection. </p>
+<div class="codehilite"><pre><span class="n">SessionFactory</span> <span class="n">sessionFactory</span> <span class="o">=</span> <span class="n">SessionFactoryImpl</span><span class="o">.</span><span class="n">newInstance</span><span class="p">();</span>
+<span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="p">,</span> <span class="n">String</span><span class="o">&gt;</span> <span class="n">parameter</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o">&lt;</span><span class="n">String</span><span class="p">,</span> <span class="n">String</span><span class="o">&gt;</span><span class="p">();</span>
+<span class="n">parameter</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="n">SessionParameter</span><span class="o">.</span><span class="n">USER</span><span class="p">,</span> <span class="s">&quot;admin&quot;</span><span class="p">);</span>
+<span class="n">parameter</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="n">SessionParameter</span><span class="o">.</span><span class="n">PASSWORD</span><span class="p">,</span> <span class="s">&quot;admin&quot;</span><span class="p">);</span>
+<span class="n">parameter</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="n">SessionParameter</span><span class="o">.</span><span class="n">ATOMPUB_URL</span><span class="p">,</span>
+ <span class="s">&quot;http://opencmis.cloudapp.net/inmemory/atom/&quot;</span><span class="p">);</span>
+<span class="n">parameter</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="n">SessionParameter</span><span class="o">.</span><span class="n">BINDING_TYPE</span><span class="p">,</span> <span class="n">BindingType</span><span class="o">.</span><span class="n">ATOMPUB</span><span class="o">.</span><span class="n">value</span><span class="p">());</span>
+</pre></div>
+
+
+</li>
+</ol>
+<h4 id="connecting_to_a_repository_by_id">Connecting to a repository by id</h4>
+<p>In a production environment, the client code will probably know the ID of the repository that it wants to connnect to.
+The following code snippet shows how to connect to a repository using its ID.</p>
+<div class="codehilite"><pre>    <span class="n">parameter</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="n">SessionParameter</span><span class="o">.</span><span class="n">REPOSITORY_ID</span><span class="p">,</span> <span class="s">&quot;A1&quot;</span><span class="p">);</span>
+    <span class="n">Session</span> <span class="n">session</span> <span class="o">=</span> <span class="n">sessionFactory</span><span class="o">.</span><span class="n">createSession</span><span class="p">(</span><span class="n">parameter</span><span class="p">);</span>
+</pre></div>
+
+
+<p>That's it. Any work you want to do against the repository uses this session.</p>
+<h4 id="connecting_to_one_of_a_list_of_repositories">Connecting to one of a list of repositories</h4>
+<p>The CMIS specification allows a CMIS service endpoint to advertise one or more repositories, so this code snippet retrieves a list of repositories. In this 
+case there the code chooses the first repository in list:-</p>
+<div class="codehilite"><pre>    <span class="n">List</span><span class="sr">&lt;Repository&gt;</span> <span class="n">repositories</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ArrayList</span><span class="sr">&lt;Repository&gt;</span><span class="p">();</span>
+    <span class="n">repositories</span> <span class="o">=</span> <span class="n">sessionFactory</span><span class="o">.</span><span class="n">getRepositories</span><span class="p">(</span><span class="n">parameter</span><span class="p">);</span>
+    <span class="k">for</span> <span class="p">(</span><span class="n">Repository</span> <span class="n">r</span> <span class="p">:</span> <span class="n">repositories</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s">&quot;Found repository: &quot;</span> <span class="o">+</span> <span class="n">r</span><span class="o">.</span><span class="n">getName</span><span class="p">());</span>
+    <span class="p">}</span>
+</pre></div>
+
+
+<p>Now you can create your session with the first and only repository:-</p>
+<div class="codehilite"><pre>    <span class="n">Repository</span> <span class="n">repository</span> <span class="o">=</span> <span class="n">repositories</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span>
+    <span class="n">parameter</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="n">SessionParameter</span><span class="o">.</span><span class="n">REPOSITORY_ID</span><span class="p">,</span> <span class="n">repository</span><span class="o">.</span><span class="n">getId</span><span class="p">());</span>
+    <span class="n">Session</span> <span class="n">session</span> <span class="o">=</span> <span class="n">sessionFactory</span><span class="o">.</span><span class="n">createSession</span><span class="p">(</span><span class="n">parameter</span><span class="p">);</span>
+
+    <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s">&quot;Got a connection to repository: &quot;</span> 
+            <span class="o">+</span> <span class="n">repository</span><span class="o">.</span><span class="n">getName</span><span class="p">()</span> <span class="o">+</span> <span class="s">&quot;, with id: &quot;</span>
+            <span class="o">+</span> <span class="n">repository</span><span class="o">.</span><span class="n">getId</span><span class="p">());</span>
+</pre></div>
+
+
+<p>That's it. Any work you want to do against the repository uses this session.</p>
+<h3 id="working_with_folders_and_documents">Working with Folders and Documents</h3>
+<p>Of the  for base objects described by the CMIS domain model, the most commonly used are the folder and the document.</p>
+<p>A folder is a container for other objects. Folders exist in a  hierarchical structure as you would expect, but 
+a CMIS repository can optionally store objects in multiple folders, and an object can exist but not be contained in a folder. 
+CMIS uses the terminology multifiling and unfiling for these
+capabilities.</p>
+<p>The Document is the only object that can have content, described by a content stream, and has properties such as the author and modification date. </p>
+<h4 id="finding_the_contents_of_the_root_folder">Finding the contents of the root folder</h4>
+<p>Now you have a session you can start examining the repository. All CMIS repositories have a root folder, which is the single top level folder in the heirarchy.
+To list the objects in the root folder of your repository you use the <code>getRootFolder()</code> method on the session.</p>
+<div class="codehilite"><pre>    <span class="nv">Folder</span> <span class="s-Atom">root</span> <span class="o">=</span> <span class="s-Atom">session</span><span class="p">.</span><span class="nf">getRootFolder</span><span class="p">();</span>
+    <span class="nv">ItemIterable</span><span class="o">&lt;</span><span class="nv">CmisObject</span><span class="o">&gt;</span> <span class="s-Atom">children</span> <span class="o">=</span> <span class="s-Atom">root</span><span class="p">.</span><span class="nf">getChildren</span><span class="p">();</span>
+    <span class="nv">System</span><span class="p">.</span><span class="s-Atom">out</span><span class="p">.</span><span class="nf">println</span><span class="p">(</span><span class="s2">&quot;Found the following objects in the root folder:-&quot;</span><span class="p">);</span>
+    <span class="nf">for</span> <span class="p">(</span><span class="nv">CmisObject</span> <span class="s-Atom">o</span> <span class="s-Atom">:</span> <span class="s-Atom">children</span><span class="p">)</span> <span class="p">{</span>
+        <span class="nv">System</span><span class="p">.</span><span class="s-Atom">out</span><span class="p">.</span><span class="nf">println</span><span class="p">(</span><span class="s-Atom">o</span><span class="p">.</span><span class="nf">getName</span><span class="p">()</span> <span class="o">+</span> <span class="s2">&quot; which is of type &quot;</span> <span class="o">+</span> <span class="s-Atom">o</span><span class="p">.</span><span class="nf">getType</span><span class="p">().</span><span class="nf">getDisplayName</span><span class="p">());</span>
+    <span class="p">}</span>
+</pre></div>
+
+
+<h4 id="creating_a_folder_object">Creating a folder object</h4>
+<p>To create a folder, you use the  <code>createFolder()</code> method on the parent folder.
+As with most CMIS methods, it takes a map of properties which define the Object to be created.
+In this code snippet a folder with the name <code>ADGNewFolder</code> is created in the root folder:-</p>
+<div class="codehilite"><pre>    <span class="nv">System</span><span class="p">.</span><span class="s-Atom">out</span><span class="p">.</span><span class="nf">println</span><span class="p">(</span><span class="s2">&quot;Creating &#39;ADGNewFolder&#39; in the root folder&quot;</span><span class="p">);</span>
+    <span class="nv">Map</span><span class="o">&lt;</span><span class="nv">String</span><span class="p">,</span> <span class="nv">String</span><span class="o">&gt;</span> <span class="s-Atom">newFolderProps</span> <span class="o">=</span> <span class="s-Atom">new</span> <span class="nv">HashMap</span><span class="o">&lt;</span><span class="nv">String</span><span class="p">,</span> <span class="nv">String</span><span class="s-Atom">&gt;</span><span class="p">();</span>
+    <span class="s-Atom">newFolderProps</span><span class="p">.</span><span class="nf">put</span><span class="p">(</span><span class="nv">PropertyIds</span><span class="p">.</span><span class="nv">OBJECT_TYPE_ID</span><span class="p">,</span> <span class="s2">&quot;cmis:folder&quot;</span><span class="p">);</span>
+    <span class="s-Atom">newFolderProps</span><span class="p">.</span><span class="nf">put</span><span class="p">(</span><span class="nv">PropertyIds</span><span class="p">.</span><span class="nv">NAME</span><span class="p">,</span> <span class="s2">&quot;ADGNewFolder&quot;</span><span class="p">);</span>
+    <span class="nv">Folder</span> <span class="s-Atom">newFolder</span> <span class="o">=</span> <span class="s-Atom">root</span><span class="p">.</span><span class="nf">createFolder</span><span class="p">(</span><span class="s-Atom">newFolderProps</span><span class="p">);</span>
+
+    <span class="o">//</span> <span class="nv">Did</span> <span class="s-Atom">it</span> <span class="s-Atom">work?</span>
+    <span class="s-Atom">children</span> <span class="o">=</span> <span class="s-Atom">root</span><span class="p">.</span><span class="nf">getChildren</span><span class="p">();</span>
+    <span class="nv">System</span><span class="p">.</span><span class="s-Atom">out</span><span class="p">.</span><span class="nf">println</span><span class="p">(</span><span class="s2">&quot;Now finding the following objects in the root folder:-&quot;</span><span class="p">);</span>
+    <span class="nf">for</span> <span class="p">(</span><span class="nv">CmisObject</span> <span class="s-Atom">o</span> <span class="s-Atom">:</span> <span class="s-Atom">children</span><span class="p">)</span> <span class="p">{</span>
+        <span class="nv">System</span><span class="p">.</span><span class="s-Atom">out</span><span class="p">.</span><span class="nf">println</span><span class="p">(</span><span class="s-Atom">o</span><span class="p">.</span><span class="nf">getName</span><span class="p">());</span>
+    <span class="p">}</span>
+</pre></div>
+
+
+<p>Note that the properties set for in the above code snippet are the minimum set of name and object type id. 
+There are many other properties you can set on creation, depending on the object type.</p>
+<h4 id="creating_a_a_simple_document_object">Creating a a simple document object</h4>
+<p>Document objects describe entities in the CMIS repository. A document object with content
+contains a content stream that is the actual file contents, and a mimetype for the content stream. So, to create Document Object, first you need a content stream</p>
+<div class="codehilite"><pre>     <span class="n">final</span> <span class="n">String</span> <span class="n">textFileName</span> <span class="o">=</span> <span class="s">&quot;test.txt&quot;</span><span class="p">;</span>
+     <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s">&quot;creating a simple text file, &quot;</span> <span class="o">+</span> <span class="n">textFileName</span><span class="p">);</span>
+     <span class="n">String</span> <span class="n">mimetype</span> <span class="o">=</span> <span class="s">&quot;text/plain; charset=UTF-8&quot;</span><span class="p">;</span>
+     <span class="n">String</span> <span class="n">content</span> <span class="o">=</span> <span class="s">&quot;This is some test content.&quot;</span><span class="p">;</span>
+     <span class="n">String</span> <span class="n">filename</span> <span class="o">=</span> <span class="n">textFileName</span><span class="p">;</span>
+
+     <span class="n">byte</span><span class="o">[]</span> <span class="n">buf</span> <span class="o">=</span> <span class="n">null</span><span class="p">;</span>
+     <span class="n">try</span> <span class="p">{</span>
+         <span class="n">buf</span> <span class="o">=</span> <span class="n">content</span><span class="o">.</span><span class="n">getBytes</span><span class="p">(</span><span class="s">&quot;UTF-8&quot;</span><span class="p">);</span>
+     <span class="p">}</span> <span class="n">catch</span> <span class="p">(</span><span class="n">UnsupportedEncodingException</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
+         <span class="n">e</span><span class="o">.</span><span class="n">printStackTrace</span><span class="p">();</span>
+     <span class="p">}</span>
+     <span class="n">ByteArrayInputStream</span> <span class="n">input</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ByteArrayInputStream</span><span class="p">(</span><span class="n">buf</span><span class="p">);</span>
+     <span class="n">ContentStream</span> <span class="n">contentStream</span> <span class="o">=</span> <span class="n">session</span><span class="o">.</span><span class="n">getObjectFactory</span><span class="p">()</span><span class="o">.</span><span class="n">createContentStream</span><span class="p">(</span><span class="n">filename</span><span class="p">,</span>
+             <span class="n">buf</span><span class="o">.</span><span class="nb">length</span><span class="p">,</span> <span class="n">mimetype</span><span class="p">,</span> <span class="n">input</span><span class="p">);</span>
+</pre></div>
+
+
+<p>To add a document with some content to the repository, you use the <code>createDocument()</code> method on the parent folder, and provide the content stream
+and a map of properties which define the object to be created.</p>
+<div class="codehilite"><pre>    <span class="n">Map</span><span class="o">&lt;</span><span class="n">String</span><span class="p">,</span> <span class="n">Object</span><span class="o">&gt;</span> <span class="n">properties</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o">&lt;</span><span class="n">String</span><span class="p">,</span> <span class="n">Object</span><span class="o">&gt;</span><span class="p">();</span>
+    <span class="n">properties</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="n">PropertyIds</span><span class="o">.</span><span class="n">OBJECT_TYPE_ID</span><span class="p">,</span> <span class="s">&quot;cmis:document&quot;</span><span class="p">);</span>
+    <span class="n">properties</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="n">PropertyIds</span><span class="o">.</span><span class="n">NAME</span><span class="p">,</span> <span class="n">filename</span><span class="p">);</span>
+    <span class="n">ObjectId</span> <span class="n">id</span> <span class="o">=</span> <span class="n">newFolder</span><span class="o">.</span><span class="n">createDocument</span><span class="p">(</span><span class="n">properties</span><span class="p">,</span> <span class="n">contentStream</span><span class="p">,</span> <span class="n">VersioningState</span><span class="o">.</span><span class="n">MAJOR</span><span class="p">);</span>
+</pre></div>
+
+
+<p>Note the following points :-</p>
+<ul>
+<li>The <code>createDocument()</code> method returns the Object ID of the newly created document object. </li>
+<li>Each version of a document object has its own object ID.</li>
+<li>You can create a document without an associated content stream.</li>
+</ul>
+<h4 id="reading_the_contents_of_a_document_object">Reading the contents of a document object</h4>
+<p>You can retrieve a CMIS object by path, or by using the object ID.</p>
+<p>The following code snippet retrieves the newly created object using the object ID:-</p>
+<div class="codehilite"><pre>    <span class="sr">//</span> <span class="n">Get</span> <span class="n">the</span> <span class="n">contents</span> <span class="n">of</span> <span class="n">the</span> <span class="n">file</span>
+    <span class="n">doc</span> <span class="o">=</span> <span class="p">(</span><span class="n">Document</span><span class="p">)</span> <span class="n">session</span><span class="o">.</span><span class="n">getObject</span><span class="p">(</span><span class="n">id</span><span class="p">);</span>
+    <span class="n">try</span> <span class="p">{</span>
+        <span class="n">content</span> <span class="o">=</span> <span class="n">getContentAsString</span><span class="p">(</span><span class="n">doc</span><span class="o">.</span><span class="n">getContentStream</span><span class="p">());</span>
+    <span class="p">}</span> <span class="n">catch</span> <span class="p">(</span><span class="n">IOException</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
+        <span class="sr">//</span> <span class="n">TODO</span> <span class="n">Auto</span><span class="o">-</span><span class="n">generated</span> <span class="n">catch</span> <span class="n">block</span>
+        <span class="n">e</span><span class="o">.</span><span class="n">printStackTrace</span><span class="p">();</span>
+    <span class="p">}</span>
+
+    <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s">&quot;Contents of &quot;</span> <span class="o">+</span> <span class="n">filename</span> <span class="o">+</span> <span class="s">&quot; are: &quot;</span> <span class="o">+</span> <span class="n">content</span><span class="p">);</span>
+
+    <span class="o">...</span>
+
+ <span class="o">/**</span>
+ <span class="o">*</span> <span class="n">Helper</span> <span class="n">method</span> <span class="n">to</span> <span class="n">get</span> <span class="n">the</span> 
+ <span class="o">*</span> <span class="nv">@param</span> <span class="n">stream</span>
+ <span class="o">*</span> <span class="nv">@return</span>
+ <span class="o">*</span> <span class="nv">@throws</span> <span class="n">IOException</span>
+ <span class="o">*/</span>
+<span class="n">private</span> <span class="n">static</span> <span class="n">String</span> <span class="n">getContentAsString</span><span class="p">(</span><span class="n">ContentStream</span> <span class="n">stream</span><span class="p">)</span> <span class="n">throws</span> <span class="n">IOException</span> <span class="p">{</span>
+    <span class="n">InputStream</span> <span class="n">in2</span> <span class="o">=</span> <span class="n">stream</span><span class="o">.</span><span class="n">getStream</span><span class="p">();</span>
+    <span class="n">StringBuffer</span> <span class="n">sbuf</span> <span class="o">=</span> <span class="n">null</span><span class="p">;</span>
+    <span class="n">sbuf</span> <span class="o">=</span> <span class="k">new</span> <span class="n">StringBuffer</span><span class="p">(</span><span class="n">in2</span><span class="o">.</span><span class="n">available</span><span class="p">());</span>
+    <span class="nb">int</span> <span class="n">count</span><span class="p">;</span>
+    <span class="n">byte</span><span class="o">[]</span> <span class="n">buf2</span> <span class="o">=</span> <span class="k">new</span> <span class="n">byte</span><span class="p">[</span><span class="mi">100</span><span class="p">];</span>
+    <span class="k">while</span> <span class="p">((</span><span class="n">count</span> <span class="o">=</span> <span class="n">in2</span><span class="o">.</span><span class="nb">read</span><span class="p">(</span><span class="n">buf2</span><span class="p">))</span> <span class="o">!=</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
+        <span class="k">for</span> <span class="p">(</span><span class="nb">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">count</span><span class="p">;</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
+            <span class="n">sbuf</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">char</span><span class="p">)</span> <span class="n">buf2</span><span class="p">[</span><span class="n">i</span><span class="p">]);</span>
+        <span class="p">}</span>
+    <span class="p">}</span>
+    <span class="n">in2</span><span class="o">.</span><span class="nb">close</span><span class="p">();</span>
+    <span class="k">return</span> <span class="n">sbuf</span><span class="o">.</span><span class="n">toString</span><span class="p">();</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<p>The following code snippet retrieves the newly created object using a path:-</p>
+<div class="codehilite"><pre>    <span class="n">String</span> <span class="n">path</span> <span class="o">=</span> <span class="n">newFolder</span><span class="o">.</span><span class="n">getPath</span><span class="p">()</span> <span class="o">+</span> <span class="s">&quot;/&quot;</span> <span class="o">+</span> <span class="n">textFileName</span><span class="p">;</span>
+    <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s">&quot;Getting object by path &quot;</span> <span class="o">+</span> <span class="n">path</span><span class="p">);</span>
+    <span class="n">doc</span> <span class="o">=</span> <span class="p">(</span><span class="n">Document</span><span class="p">)</span> <span class="n">session</span><span class="o">.</span><span class="n">getObjectByPath</span><span class="p">(</span><span class="n">path</span><span class="p">);</span>
+    <span class="n">try</span> <span class="p">{</span>
+        <span class="n">content</span> <span class="o">=</span> <span class="n">getContentAsString</span><span class="p">(</span><span class="n">doc</span><span class="o">.</span><span class="n">getContentStream</span><span class="p">());</span>
+    <span class="p">}</span> <span class="n">catch</span> <span class="p">(</span><span class="n">IOException</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">e</span><span class="o">.</span><span class="n">printStackTrace</span><span class="p">();</span>
+    <span class="p">}</span>
+</pre></div>
+
+
+<p>Note the following points :-</p>
+<ul>
+<li>All paths start with the root folder <code>/</code>. </li>
+<li>The <code>Document</code> class does not have a <code>getPath()</code> method, since multifiling means a document can have more than one parent folder. It does implement the 
+<code>getPaths()</code> method from the <code>FileableCmisObject</code> interface. This returns a list of the current paths to the document object. </li>
+</ul>
+<h4 id="updating_a_document">Updating a document.</h4>
+<p>You can update the properties of a Document object, and you update the contents of the document by overwriting the document's content stream with a new content stream.
+Note that the object ID returned when updating a document is not guaranteed to remain the same, some repository implementations return the same object ID, and some may not.</p>
+<p>The following code snippet updates the name property of the <code>test2.txt</code> document:-</p>
+<div class="codehilite"><pre>    <span class="n">Document</span> <span class="n">doc2</span> <span class="o">=</span> <span class="p">(</span><span class="n">Document</span><span class="p">)</span> <span class="n">session</span><span class="o">.</span><span class="n">getObject</span><span class="p">(</span><span class="n">id2</span><span class="p">);</span>        
+    <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s">&quot;renaming &quot;</span> <span class="o">+</span> <span class="n">doc2</span><span class="o">.</span><span class="n">getName</span><span class="p">()</span> <span class="o">+</span> <span class="s">&quot; to test3.txt&quot;</span><span class="p">);</span>
+    <span class="n">properties</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o">&lt;</span><span class="n">String</span><span class="p">,</span> <span class="n">Object</span><span class="o">&gt;</span><span class="p">();</span>
+    <span class="n">properties</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="n">PropertyIds</span><span class="o">.</span><span class="n">NAME</span><span class="p">,</span> <span class="s">&quot;test3.txt&quot;</span><span class="p">);</span>
+    <span class="n">id2</span> <span class="o">=</span> <span class="n">doc2</span><span class="o">.</span><span class="n">updateProperties</span><span class="p">(</span><span class="n">properties</span><span class="p">);</span>
+    <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s">&quot;renamed to &quot;</span> <span class="o">+</span> <span class="n">doc2</span><span class="o">.</span><span class="n">getName</span><span class="p">());</span>
+</pre></div>
+
+
+<p>You can update the contents of a document by setting a new content stream using the <code>setContentStream()</code> method.
+You must set the overwrite flag if the document has existing content, otherwise an exception will be thrown. The following code snippet updated the content of the <code>test3.txt</code> document:-</p>
+<div class="codehilite"><pre>    <span class="n">content</span> <span class="o">=</span> <span class="s">&quot;This is some updated test content for our renamed second document.&quot;</span><span class="p">;</span>
+    <span class="n">buf</span> <span class="o">=</span> <span class="n">null</span><span class="p">;</span>
+    <span class="n">try</span> <span class="p">{</span>
+        <span class="n">buf</span> <span class="o">=</span> <span class="n">content</span><span class="o">.</span><span class="n">getBytes</span><span class="p">(</span><span class="s">&quot;UTF-8&quot;</span><span class="p">);</span>
+    <span class="p">}</span> <span class="n">catch</span> <span class="p">(</span><span class="n">UnsupportedEncodingException</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">e</span><span class="o">.</span><span class="n">printStackTrace</span><span class="p">();</span>
+    <span class="p">}</span>
+    <span class="n">input</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ByteArrayInputStream</span><span class="p">(</span><span class="n">buf</span><span class="p">);</span>
+    <span class="n">contentStream</span> <span class="o">=</span> <span class="n">session</span><span class="o">.</span><span class="n">getObjectFactory</span><span class="p">()</span><span class="o">.</span><span class="n">createContentStream</span><span class="p">(</span><span class="s">&quot;test3.txt&quot;</span><span class="p">,</span> <span class="n">buf</span><span class="o">.</span><span class="nb">length</span><span class="p">,</span>
+            <span class="n">mimetype</span><span class="p">,</span> <span class="n">input</span><span class="p">);</span>
+    <span class="n">properties</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o">&lt;</span><span class="n">String</span><span class="p">,</span> <span class="n">Object</span><span class="o">&gt;</span><span class="p">();</span>
+    <span class="n">properties</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="n">PropertyIds</span><span class="o">.</span><span class="n">OBJECT_TYPE_ID</span><span class="p">,</span> <span class="s">&quot;cmis:document&quot;</span><span class="p">);</span>
+    <span class="n">properties</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="n">PropertyIds</span><span class="o">.</span><span class="n">NAME</span><span class="p">,</span> <span class="s">&quot;test3.txt&quot;</span><span class="p">);</span>
+    <span class="n">doc2</span><span class="o">.</span><span class="n">setContentStream</span><span class="p">(</span><span class="n">contentStream</span><span class="p">,</span> <span class="n">true</span><span class="p">);</span>
+
+    <span class="sr">//</span> <span class="n">did</span> <span class="n">it</span> <span class="n">work</span><span class="p">?</span>
+    <span class="n">try</span> <span class="p">{</span>
+        <span class="n">content</span> <span class="o">=</span> <span class="n">getContentAsString</span><span class="p">(</span><span class="n">doc2</span><span class="o">.</span><span class="n">getContentStream</span><span class="p">());</span>
+    <span class="p">}</span> <span class="n">catch</span> <span class="p">(</span><span class="n">IOException</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">e</span><span class="o">.</span><span class="n">printStackTrace</span><span class="p">();</span>
+    <span class="p">}</span>
+    <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s">&quot;Contents of &quot;</span> <span class="o">+</span> <span class="n">doc2</span><span class="o">.</span><span class="n">getName</span><span class="p">()</span> <span class="o">+</span> <span class="s">&quot; are: &quot;</span> <span class="o">+</span> <span class="n">content</span><span class="p">);</span>
+</pre></div>
+
+
+<h4 id="deleting_a_document">Deleting a document</h4>
+<p>You can delete any CMIS object using the <code>delete</code> method. The following code snippet lists the 
+contents of the test folder before and after a delete of one of the two documents
+in the folder.</p>
+<div class="codehilite"><pre>    <span class="s-Atom">children</span> <span class="o">=</span> <span class="s-Atom">newFolder</span><span class="p">.</span><span class="nf">getChildren</span><span class="p">();</span>
+    <span class="nv">System</span><span class="p">.</span><span class="s-Atom">out</span><span class="p">.</span><span class="nf">println</span><span class="p">(</span><span class="s2">&quot;Now finding the following objects in our folder:-&quot;</span><span class="p">);</span>
+    <span class="nf">for</span> <span class="p">(</span><span class="nv">CmisObject</span> <span class="s-Atom">o</span> <span class="s-Atom">:</span> <span class="s-Atom">children</span><span class="p">)</span> <span class="p">{</span>
+        <span class="nv">System</span><span class="p">.</span><span class="s-Atom">out</span><span class="p">.</span><span class="nf">println</span><span class="p">(</span><span class="s-Atom">o</span><span class="p">.</span><span class="nf">getName</span><span class="p">());</span>
+    <span class="p">}</span>
+    <span class="nv">System</span><span class="p">.</span><span class="s-Atom">out</span><span class="p">.</span><span class="nf">println</span><span class="p">(</span><span class="s2">&quot;Deleting document &quot;</span> <span class="o">+</span> <span class="s-Atom">doc2</span><span class="p">.</span><span class="nf">getName</span><span class="p">());</span>
+    <span class="s-Atom">doc2</span><span class="p">.</span><span class="nf">delete</span><span class="p">(</span><span class="s-Atom">true</span><span class="p">);</span>
+    <span class="nv">System</span><span class="p">.</span><span class="s-Atom">out</span><span class="p">.</span><span class="nf">println</span><span class="p">(</span><span class="s2">&quot;Now finding the following objects in our folder:-&quot;</span><span class="p">);</span>
+    <span class="nf">for</span> <span class="p">(</span><span class="nv">CmisObject</span> <span class="s-Atom">o</span> <span class="s-Atom">:</span> <span class="s-Atom">children</span><span class="p">)</span> <span class="p">{</span>
+        <span class="nv">System</span><span class="p">.</span><span class="s-Atom">out</span><span class="p">.</span><span class="nf">println</span><span class="p">(</span><span class="s-Atom">o</span><span class="p">.</span><span class="nf">getName</span><span class="p">());</span>
+    <span class="p">}</span>
+</pre></div>
+
+
+<p>Note that the <code>allVersions</code> flag is set o <code>true</code>. If you set it to false then the delete will
+be of this version only.</p>
+<h4 id="deleting_a_folder_tree">Deleting a folder tree</h4>
+<p>You can delete a folder and all its contents using just one method. The following code snippet
+creates a new folder tree and then deletes it, ignoring any failures to delete individual objects, and deleting
+all versions of any documents in the tree.</p>
+<div class="codehilite"><pre>    <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s">&quot;Creating &#39;ADGFolder1&#39; in the root folder&quot;</span><span class="p">);</span>
+    <span class="n">newFolderProps</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HashMap</span><span class="o">&lt;</span><span class="n">String</span><span class="p">,</span> <span class="n">String</span><span class="o">&gt;</span><span class="p">();</span>
+    <span class="n">newFolderProps</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="n">PropertyIds</span><span class="o">.</span><span class="n">OBJECT_TYPE_ID</span><span class="p">,</span> <span class="s">&quot;cmis:folder&quot;</span><span class="p">);</span>
+    <span class="n">newFolderProps</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="n">PropertyIds</span><span class="o">.</span><span class="n">NAME</span><span class="p">,</span> <span class="s">&quot;ADGFolder1&quot;</span><span class="p">);</span>
+    <span class="n">Folder</span> <span class="n">folder1</span> <span class="o">=</span> <span class="n">root</span><span class="o">.</span><span class="n">createFolder</span><span class="p">(</span><span class="n">newFolderProps</span><span class="p">);</span>
+    <span class="n">newFolderProps</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="n">PropertyIds</span><span class="o">.</span><span class="n">NAME</span><span class="p">,</span> <span class="s">&quot;ADGFolder11&quot;</span><span class="p">);</span>
+    <span class="n">Folder</span> <span class="n">folder11</span> <span class="o">=</span> <span class="n">folder1</span><span class="o">.</span><span class="n">createFolder</span><span class="p">(</span><span class="n">newFolderProps</span><span class="p">);</span>
+    <span class="n">newFolderProps</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="n">PropertyIds</span><span class="o">.</span><span class="n">NAME</span><span class="p">,</span> <span class="s">&quot;ADGFolder12&quot;</span><span class="p">);</span>
+    <span class="n">Folder</span> <span class="n">folder12</span> <span class="o">=</span> <span class="n">folder1</span><span class="o">.</span><span class="n">createFolder</span><span class="p">(</span><span class="n">newFolderProps</span><span class="p">);</span>
+    <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s">&quot;delete the &#39;ADGFolder1&#39; tree&quot;</span><span class="p">);</span>        
+    <span class="n">folder1</span><span class="o">.</span><span class="n">deleteTree</span><span class="p">(</span><span class="n">true</span><span class="p">,</span> <span class="n">UnfileObject</span><span class="o">.</span><span class="n">DELETE</span><span class="p">,</span> <span class="n">true</span><span class="p">);</span>
+</pre></div>
+
+
+<p>Note that with the continueOnFailure parameter set to true, folders and documents are deleted individually. 
+If a document or folder cannot be deleted, the method moves to the next document or folder in the list.
+When the method completes, it returns a list of the document IDs and folder IDs that were not deleted.</p>
+<p>With the continueOnFailure parameter set to false, all of the folders and documents can be deleted in a single batch, 
+which, depending on the repository design, may improve performance. If a document or folder cannot be deleted, 
+an exception is raised. Some repository implementations will attempt the delete transactionally, so if it fails,
+no objects are deleted. In other repositories a failed delete may have deleted some, but not all, objects in the tree.</p>
+<h4 id="navigating_through_a_folder_tree">Navigating through a folder tree</h4>
+<p>CMIS provides several concepts for navigating through the tree of objects in the repository. For any folder, 
+you can get its children, get its descendants, and get the folder tree. The getting started sample application sets
+up a tree in the repository that looks like this:-</p>
+<img src="images/FileTree.png" />
+
+<p>The following snippet from the getting started sample will print out the children of a folder :-</p>
+<div class="codehilite"><pre>    <span class="s-Atom">children</span> <span class="o">=</span> <span class="s-Atom">folder1</span><span class="p">.</span><span class="nf">getChildren</span><span class="p">();</span>
+    <span class="nv">System</span><span class="p">.</span><span class="s-Atom">out</span><span class="p">.</span><span class="nf">println</span><span class="p">(</span><span class="s2">&quot;Children of &quot;</span> <span class="o">+</span> <span class="s-Atom">folder1</span><span class="p">.</span><span class="nf">getName</span><span class="p">()</span> <span class="o">+</span> <span class="s2">&quot;:-&quot;</span><span class="p">);</span>
+    <span class="nf">for</span> <span class="p">(</span><span class="nv">CmisObject</span> <span class="s-Atom">o</span> <span class="s-Atom">:</span> <span class="s-Atom">children</span><span class="p">)</span> <span class="p">{</span>
+        <span class="nv">System</span><span class="p">.</span><span class="s-Atom">out</span><span class="p">.</span><span class="nf">println</span><span class="p">(</span><span class="s-Atom">o</span><span class="p">.</span><span class="nf">getName</span><span class="p">());</span>
+    <span class="p">}</span>
+</pre></div>
+
+
+<p>Note that the children of a Folder object can be of any type supported by the repository. 
+Running the sample produces the following output :-</p>
+<div class="codehilite"><pre><span class="nv">Children</span> <span class="s-Atom">of</span> <span class="nv">ADGFolder1</span><span class="p">:-</span>
+<span class="nv">ADGFolder11</span>
+<span class="nv">ADGFolder12</span>
+<span class="nv">ADGFile1f1</span>
+</pre></div>
+
+
+<p>If your repository supports <code>getDescendants</code>, you can navigate the whole subtree of descendants of any folder. 
+This code snippet uses a recursive method to print out the entire folder subtree:-</p>
+<div class="codehilite"><pre><span class="nf">if</span> <span class="p">(!</span><span class="s-Atom">session</span><span class="p">.</span><span class="nf">getRepositoryInfo</span><span class="p">().</span><span class="nf">getCapabilities</span><span class="p">().</span><span class="o">is</span><span class="nv">GetDescendantsSupported</span><span class="p">())</span> <span class="p">{</span>
+    <span class="nv">System</span><span class="p">.</span><span class="s-Atom">out</span><span class="p">.</span><span class="nf">println</span><span class="p">(</span><span class="s2">&quot;getDescendants not supported in this repository&quot;</span><span class="p">);</span>
+<span class="p">}</span> <span class="s-Atom">else</span> <span class="p">{</span>
+    <span class="nv">System</span><span class="p">.</span><span class="s-Atom">out</span><span class="p">.</span><span class="nf">println</span><span class="p">(</span><span class="s2">&quot;Descendants of &quot;</span> <span class="o">+</span> <span class="s-Atom">folder1</span><span class="p">.</span><span class="nf">getName</span><span class="p">()</span> <span class="o">+</span> <span class="s2">&quot;:-&quot;</span><span class="p">);</span>
+    <span class="nf">for</span> <span class="p">(</span><span class="nv">Tree</span><span class="o">&lt;</span><span class="nv">FileableCmisObject</span><span class="o">&gt;</span> <span class="s-Atom">t</span> <span class="s-Atom">:</span> <span class="s-Atom">folder1</span><span class="p">.</span><span class="nf">getDescendants</span><span class="p">(</span><span class="o">-</span><span class="m">1</span><span class="p">))</span> <span class="p">{</span>
+        <span class="nf">printTree</span><span class="p">(</span><span class="s-Atom">t</span><span class="p">);</span>
+    <span class="p">}</span>
+<span class="p">}</span>
+
+<span class="p">...</span>
+
+<span class="s-Atom">private</span> <span class="s-Atom">static</span> <span class="s-Atom">void</span> <span class="nf">printTree</span><span class="p">(</span><span class="nv">Tree</span><span class="o">&lt;</span><span class="nv">FileableCmisObject</span><span class="o">&gt;</span> <span class="s-Atom">tree</span><span class="p">)</span> <span class="p">{</span>
+    <span class="nv">System</span><span class="p">.</span><span class="s-Atom">out</span><span class="p">.</span><span class="nf">println</span><span class="p">(</span><span class="s2">&quot;Descendant &quot;</span> <span class="o">+</span> <span class="s-Atom">tree</span><span class="p">.</span><span class="nf">getItem</span><span class="p">().</span><span class="nf">getName</span><span class="p">());</span>
+    <span class="nf">for</span> <span class="p">(</span><span class="nv">Tree</span><span class="o">&lt;</span><span class="nv">FileableCmisObject</span><span class="o">&gt;</span> <span class="s-Atom">t</span> <span class="s-Atom">:</span> <span class="s-Atom">tree</span><span class="p">.</span><span class="nf">getChildren</span><span class="p">())</span> <span class="p">{</span>
+        <span class="nf">printTree</span><span class="p">(</span><span class="s-Atom">t</span><span class="p">);</span>
+    <span class="p">}</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<p>Note the following points:-</p>
+<ol>
+<li>The children of a <code>Tree</code> are themselves of type <code>Tree</code>. </li>
+<li>The single argument of <code>getDescendants</code> is the depth or level of the tree that you want to go to. A depth of 1 will give you just the root of the tree. 
+A depth of -1 will return the full tree.</li>
+</ol>
+<p>Running the sample produces the following output :-</p>
+<div class="codehilite"><pre><span class="nv">Descendants</span> <span class="s-Atom">of</span> <span class="nv">ADGFolder1</span><span class="p">:-</span>
+<span class="nv">Descendant</span> <span class="nv">ADGFolder11</span>
+<span class="nv">Descendant</span> <span class="nv">ADGFolder111</span>
+<span class="nv">Descendant</span> <span class="nv">ADGFolder112</span>
+<span class="nv">Descendant</span> <span class="nv">ADGFile11f1</span>
+<span class="nv">Descendant</span> <span class="nv">ADGFile11f2</span>
+<span class="nv">Descendant</span> <span class="nv">ADGFolder12</span>
+<span class="nv">Descendant</span> <span class="nv">ADGFolder121</span>
+<span class="nv">Descendant</span> <span class="nv">ADGFile121f1</span>
+<span class="nv">Descendant</span> <span class="nv">ADGFolder122</span>
+<span class="nv">Descendant</span> <span class="nv">ADGFile1f1</span>
+</pre></div>
+
+
+<p>If your repository supports <code>getFolderTree</code>, you can navigate the whole subtree of folders from any folder in the repository.
+This code snippet uses a recursive method to print out the entire folder subtree:-</p>
+<div class="codehilite"><pre><span class="nf">if</span> <span class="p">(!</span><span class="s-Atom">session</span><span class="p">.</span><span class="nf">getRepositoryInfo</span><span class="p">().</span><span class="nf">getCapabilities</span><span class="p">().</span><span class="o">is</span><span class="nv">GetFolderTreeSupported</span><span class="p">())</span> <span class="p">{</span>
+    <span class="nv">System</span><span class="p">.</span><span class="s-Atom">out</span><span class="p">.</span><span class="nf">println</span><span class="p">(</span><span class="s2">&quot;getFolderTree not supported in this repository&quot;</span><span class="p">);</span>
+<span class="p">}</span> <span class="s-Atom">else</span> <span class="p">{</span>
+    <span class="nv">System</span><span class="p">.</span><span class="s-Atom">out</span><span class="p">.</span><span class="nf">println</span><span class="p">(</span><span class="s2">&quot;Foldertree for &quot;</span> <span class="o">+</span> <span class="s-Atom">folder1</span><span class="p">.</span><span class="nf">getName</span><span class="p">()</span> <span class="o">+</span> <span class="s2">&quot;:-&quot;</span><span class="p">);</span>
+    <span class="nf">for</span> <span class="p">(</span><span class="nv">Tree</span><span class="o">&lt;</span><span class="nv">FileableCmisObject</span><span class="o">&gt;</span> <span class="s-Atom">t</span> <span class="s-Atom">:</span> <span class="s-Atom">folder1</span><span class="p">.</span><span class="nf">getFolderTree</span><span class="p">(</span><span class="o">-</span><span class="m">1</span><span class="p">))</span> <span class="p">{</span>
+        <span class="nf">printFolderTree</span><span class="p">(</span><span class="s-Atom">t</span><span class="p">);</span>
+    <span class="p">}</span>
+<span class="p">}</span>
+
+<span class="p">...</span>
+
+<span class="s-Atom">private</span> <span class="s-Atom">static</span> <span class="s-Atom">void</span> <span class="nf">printFolderTree</span><span class="p">(</span><span class="nv">Tree</span><span class="o">&lt;</span><span class="nv">FileableCmisObject</span><span class="o">&gt;</span> <span class="s-Atom">tree</span><span class="p">)</span> <span class="p">{</span>
+    <span class="nv">System</span><span class="p">.</span><span class="s-Atom">out</span><span class="p">.</span><span class="nf">println</span><span class="p">(</span><span class="s2">&quot;Folder &quot;</span> <span class="o">+</span> <span class="s-Atom">tree</span><span class="p">.</span><span class="nf">getItem</span><span class="p">().</span><span class="nf">getName</span><span class="p">());</span>
+    <span class="nf">for</span> <span class="p">(</span><span class="nv">Tree</span><span class="o">&lt;</span><span class="nv">FileableCmisObject</span><span class="o">&gt;</span> <span class="s-Atom">t</span> <span class="s-Atom">:</span> <span class="s-Atom">tree</span><span class="p">.</span><span class="nf">getChildren</span><span class="p">())</span> <span class="p">{</span>
+        <span class="nf">printFolderTree</span><span class="p">(</span><span class="s-Atom">t</span><span class="p">);</span>
+    <span class="p">}</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<p>Running the sample produces the following output :-</p>
+<div class="codehilite"><pre><span class="nv">Foldertree</span> <span class="s-Atom">for</span> <span class="nv">ADGFolder1</span><span class="p">:-</span>
+<span class="nv">Folder</span> <span class="nv">ADGFolder11</span>
+<span class="nv">Folder</span> <span class="nv">ADGFolder111</span>
+<span class="nv">Folder</span> <span class="nv">ADGFolder112</span>
+<span class="nv">Folder</span> <span class="nv">ADGFolder12</span>
+<span class="nv">Folder</span> <span class="nv">ADGFolder121</span>
+<span class="nv">Folder</span> <span class="nv">ADGFolder122</span>
+</pre></div>
+
+
+<p>Note that <code>getDescendants</code> and <code>getFolderTree</code> are similar, but <code>getDescendants</code> finds objects of any fileable type, <code>getFolderTree</code> finds only folder
+objects.</p>
+<h3 id="object_types">Object Types</h3>
+<p>CMIS Objects have an object type. There are four base types, two of which <em>must</em> be supported by a repository </p>
+<ul>
+<li><code>cmis:document</code></li>
+<li><code>cmis:folder</code> </li>
+</ul>
+<p>The other two base types <em>may</em> be supported by a repository :-</p>
+<ul>
+<li><code>cmis:relationship</code></li>
+<li><code>cmis:policy</code> </li>
+</ul>
+<p>Any other types in a repository must be defined as sub-types of a base type. 
+An object type definition includes a set of attributes (for example Fileable, Queryable) 
+and a property schema that will apply to Objects of that type.</p>
+<p>Every object type has a parent type, except a base type.</p>
+<p>CMIS 1.0 does not allow you to create types, but it does have allow you to navigate the object type tree, and look at type definitions.</p>
+<p>So, we can retrieve information in the type definition for our <code>doc</code> object :-</p>
+<div class="codehilite"><pre>    <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s">&quot;Getting type definition for doc type&quot;</span><span class="p">);</span>
+    <span class="n">ObjectType</span> <span class="n">objectType</span> <span class="o">=</span> <span class="n">session</span><span class="o">.</span><span class="n">getTypeDefinition</span><span class="p">(</span><span class="n">doc</span><span class="o">.</span><span class="n">getType</span><span class="p">()</span><span class="o">.</span><span class="n">getId</span><span class="p">());</span>
+    <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s">&quot;isBaseType() returns &quot;</span> <span class="o">+</span> <span class="p">(</span><span class="n">objectType</span><span class="o">.</span><span class="n">isBaseType</span><span class="p">()</span> <span class="p">?</span> <span class="s">&quot;true&quot;</span> <span class="p">:</span> <span class="s">&quot;false&quot;</span><span class="p">));</span>
+    <span class="n">ObjectType</span> <span class="n">baseType</span> <span class="o">=</span> <span class="n">objectType</span><span class="o">.</span><span class="n">getBaseType</span><span class="p">();</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">baseType</span> <span class="o">==</span> <span class="n">null</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s">&quot;getBaseType() returns null&quot;</span><span class="p">);</span>
+    <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+        <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s">&quot;getBaseType() returns &quot;</span> <span class="o">+</span> <span class="n">baseType</span><span class="o">.</span><span class="n">getDisplayName</span><span class="p">());</span>
+    <span class="p">}</span>
+    <span class="n">ObjectType</span> <span class="n">parentType</span> <span class="o">=</span> <span class="n">objectType</span><span class="o">.</span><span class="n">getParentType</span><span class="p">();</span>
+    <span class="k">if</span> <span class="p">(</span><span class="n">parentType</span> <span class="o">==</span> <span class="n">null</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s">&quot;getParentType() returns null&quot;</span><span class="p">);</span>
+    <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+        <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s">&quot;getParentType() returns &quot;</span> <span class="o">+</span> <span class="n">parentType</span><span class="o">.</span><span class="n">getDisplayName</span><span class="p">());</span>
+    <span class="p">}</span>
+    <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s">&quot;Listing child types of &quot;</span> <span class="o">+</span> <span class="n">objectType</span><span class="o">.</span><span class="n">getDisplayName</span><span class="p">());</span>
+    <span class="k">for</span> <span class="p">(</span><span class="n">ObjectType</span> <span class="n">o</span> <span class="p">:</span> <span class="n">objectType</span><span class="o">.</span><span class="n">getChildren</span><span class="p">())</span> <span class="p">{</span>
+        <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s">&quot;\t&quot;</span> <span class="o">+</span> <span class="n">o</span><span class="o">.</span><span class="n">getDisplayName</span><span class="p">());</span>
+    <span class="p">}</span>
+    <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s">&quot;Getting immediate descendant types of &quot;</span> <span class="o">+</span> <span class="n">objectType</span><span class="o">.</span><span class="n">getDisplayName</span><span class="p">());</span>
+    <span class="k">for</span> <span class="p">(</span><span class="n">Tree</span><span class="sr">&lt;ObjectType&gt;</span> <span class="n">o</span> <span class="p">:</span> <span class="n">objectType</span><span class="o">.</span><span class="n">getDescendants</span><span class="p">(</span><span class="mi">1</span><span class="p">))</span> <span class="p">{</span>
+        <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s">&quot;\t&quot;</span> <span class="o">+</span> <span class="n">o</span><span class="o">.</span><span class="n">getItem</span><span class="p">()</span><span class="o">.</span><span class="n">getDisplayName</span><span class="p">());</span>
+    <span class="p">}</span>
+</pre></div>
+
+
+<p>You will see that, not surprisingly, doc has a type of <code>Document</code>, which is a base type, so has no parent. Depending on the repository
+you are running this code against, there may be a number of children of the <code>Document</code> type, which are types derived from this base type.</p>
+<h3 id="cmis_properties">CMIS Properties</h3>
+<h4 id="displaying_the_properties_of_an_object">Displaying the properties of an Object</h4>
+<p>All objects of the CMIS base types implement the interface <code>CmisObjectProperties</code> which provides 
+accessors to CMIS object properties. The following code snippet uses the <code>getProperties()</code> method
+to print out all the available properties on a newly created Document object, doc.</p>
+<div class="codehilite"><pre><span class="x">     List&lt;Property</span><span class="cp">&lt;?</span><span class="o">&gt;&gt;</span> <span class="nx">props</span> <span class="o">=</span> <span class="nx">doc</span><span class="o">.</span><span class="nx">getProperties</span><span class="p">();</span>
+     <span class="k">for</span> <span class="p">(</span><span class="nx">Property</span><span class="o">&lt;?&gt;</span> <span class="nx">p</span> <span class="o">:</span> <span class="nx">props</span><span class="p">)</span> <span class="p">{</span>
+         <span class="nx">System</span><span class="o">.</span><span class="nx">out</span><span class="o">.</span><span class="nx">println</span><span class="p">(</span><span class="nx">p</span><span class="o">.</span><span class="nx">getDefinition</span><span class="p">()</span><span class="o">.</span><span class="nx">getDisplayName</span><span class="p">()</span> <span class="o">+</span> <span class="s2">&quot;=&quot;</span> <span class="o">+</span>
+                 <span class="nx">p</span><span class="o">.</span><span class="nx">getValuesAsString</span><span class="p">()</span>                     
+                 <span class="p">);</span>
+     <span class="p">}</span>
+</pre></div>
+
+
+<p>The output should look something like this :-</p>
+<div class="codehilite"><pre><span class="n">Is</span> <span class="n">Latest</span> <span class="n">Major</span> <span class="n">Version</span><span class="o">=</span><span class="p">[</span><span class="n">false</span><span class="p">]</span>
+<span class="n">Content</span> <span class="n">Stream</span> <span class="n">Length</span><span class="o">=</span><span class="p">[</span><span class="mi">26</span><span class="p">]</span>
+<span class="n">Content</span> <span class="n">Stream</span> <span class="n">Id</span><span class="o">=</span><span class="p">[</span><span class="n">store:</span><span class="sr">//</span><span class="mi">2011</span><span class="sr">/5/</span><span class="mi">20</span><span class="sr">/12/</span><span class="mi">54</span><span class="o">/</span><span class="mi">0</span><span class="n">d69ee48</span><span class="o">-</span><span class="n">ef03</span><span class="o">-</span><span class="mi">4715</span><span class="o">-</span><span class="n">ae23</span><span class="o">-</span><span class="n">b84b4342315c</span><span class="o">.</span><span class="n">bin</span><span class="p">]</span>
+<span class="n">Version</span> <span class="n">Series</span> <span class="n">Checked</span> <span class="n">Out</span> <span class="n">By</span><span class="o">=[]</span>
+<span class="n">Object</span> <span class="n">Type</span> <span class="n">Id</span><span class="o">=</span><span class="p">[</span><span class="n">cmis:document</span><span class="p">]</span>
+<span class="n">Version</span> <span class="n">Series</span> <span class="n">Checked</span> <span class="n">Out</span> <span class="n">Id</span><span class="o">=[]</span>
+<span class="n">Name</span><span class="o">=</span><span class="p">[</span><span class="n">test</span><span class="o">.</span><span class="n">txt</span><span class="p">]</span>
+<span class="n">Content</span> <span class="n">Stream</span> <span class="n">MIME</span> <span class="n">Type</span><span class="o">=</span><span class="p">[</span><span class="n">text</span><span class="o">/</span><span class="n">plain</span><span class="p">;</span> <span class="n">charset</span><span class="o">=</span><span class="n">UTF</span><span class="o">-</span><span class="mi">8</span><span class="p">]</span>
+<span class="n">Version</span> <span class="n">series</span> <span class="n">id</span><span class="o">=</span><span class="p">[</span><span class="n">workspace:</span><span class="sr">//</span><span class="n">SpacesStore</span><span class="o">/</span><span class="mi">3</span><span class="n">cd2cbbf</span><span class="o">-</span><span class="mi">1</span><span class="n">a00</span><span class="o">-</span><span class="mi">4653</span><span class="o">-</span><span class="mi">8</span><span class="n">ea8</span><span class="o">-</span><span class="mf">1e91515</span><span class="n">c6092</span><span class="p">]</span>
+<span class="n">Creation</span> <span class="n">Date</span><span class="o">=</span><span class="p">[</span><span class="n">Fri</span> <span class="n">May</span> <span class="mi">20</span> <span class="mi">12</span><span class="p">:</span><span class="mi">54</span><span class="p">:</span><span class="mi">47</span> <span class="n">BST</span> <span class="mi">2011</span><span class="p">]</span>
+<span class="n">Change</span> <span class="n">token</span><span class="o">=[]</span>
+<span class="n">Version</span> <span class="n">Label</span><span class="o">=</span><span class="p">[</span><span class="mf">0.0</span><span class="p">]</span>
+<span class="n">Is</span> <span class="n">Latest</span> <span class="n">Version</span><span class="o">=</span><span class="p">[</span><span class="n">true</span><span class="p">]</span>
+<span class="n">Is</span> <span class="n">Version</span> <span class="n">Series</span> <span class="n">Checked</span> <span class="n">Out</span><span class="o">=</span><span class="p">[</span><span class="n">false</span><span class="p">]</span>
+<span class="n">Last</span> <span class="n">Modified</span> <span class="n">By</span><span class="o">=</span><span class="p">[</span><span class="n">admin</span><span class="p">]</span>

[... 536 lines stripped ...]


Mime
View raw message