You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2013/09/24 17:32:46 UTC

svn commit: r1525926 - in /chemistry/opencmis/trunk/chemistry-opencmis-client: chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/ chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/

Author: fmui
Date: Tue Sep 24 15:32:45 2013
New Revision: 1525926

URL: http://svn.apache.org/r1525926
Log:
added getLatestChangeLogToken() and more JavaDoc

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java?rev=1525926&r1=1525925&r2=1525926&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/api/Session.java Tue Sep 24 15:32:45 2013
@@ -36,6 +36,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.enums.RelationshipDirection;
 import org.apache.chemistry.opencmis.commons.enums.VersioningState;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException;
+import org.apache.chemistry.opencmis.commons.exceptions.CmisObjectNotFoundException;
 import org.apache.chemistry.opencmis.commons.spi.CmisBinding;
 
 /**
@@ -57,7 +58,7 @@ import org.apache.chemistry.opencmis.com
  * (Please refer to the <a
  * href="http://docs.oasis-open.org/cmis/CMIS/v1.0/os/">CMIS specification</a>
  * for details about the domain model, terms, concepts, base types, properties,
- * ids and query names, query language, etc.)
+ * IDs and query names, query language, etc.)
  * </p>
  */
 public interface Session extends Serializable {
@@ -73,6 +74,8 @@ public interface Session extends Seriali
 
     /**
      * Returns the underlying binding object.
+     * 
+     * @return the binding object, not {@code null}
      */
     CmisBinding getBinding();
 
@@ -87,6 +90,8 @@ public interface Session extends Seriali
      * thread-safe manner, create a new {@link OperationContext} object and use
      * {@link #setDefaultContext(OperationContext)} to apply it.
      * </p>
+     * 
+     * @return the default operation context, not {@code null}
      */
     OperationContext getDefaultContext();
 
@@ -94,19 +99,23 @@ public interface Session extends Seriali
      * Sets the current session parameters for filtering, paging and caching.
      * 
      * @param context
-     *            the <code>OperationContext</code> to be used for the session;
-     *            if {@code null}, a default context is used
+     *            the {@code OperationContext} to be used for the session; if
+     *            {@code null}, a default context is used
      */
     void setDefaultContext(OperationContext context);
 
     /**
      * Creates a new operation context object.
+     * 
+     * @return the newly created operation context object
      */
     OperationContext createOperationContext();
 
     /**
      * Creates a new operation context object with the given properties.
      * 
+     * @return the newly created operation context object
+     * 
      * @see OperationContext
      */
     OperationContext createOperationContext(Set<String> filter, boolean includeAcls, boolean includeAllowableActions,
@@ -114,7 +123,9 @@ public interface Session extends Seriali
             boolean includePathSegments, String orderBy, boolean cacheEnabled, int maxItemsPerPage);
 
     /**
-     * Creates an object id from a String.
+     * Creates an object ID from a String.
+     * 
+     * @return the object ID object
      */
     ObjectId createObjectId(String id);
 
@@ -122,6 +133,8 @@ public interface Session extends Seriali
 
     /**
      * Get the current locale to be used for this session.
+     * 
+     * @return the current locale, may be {@code null}
      */
     Locale getLocale();
 
@@ -131,6 +144,8 @@ public interface Session extends Seriali
      * Returns the repository info of the repository associated with this
      * session.
      * 
+     * @return the repository info, not {@code null}
+     * 
      * @cmis 1.0
      */
     RepositoryInfo getRepositoryInfo();
@@ -138,27 +153,55 @@ public interface Session extends Seriali
     /**
      * Gets a factory object that provides methods to create the objects used by
      * this API.
+     * 
+     * @return the repository info, not {@code null}
      */
     ObjectFactory getObjectFactory();
 
     // types
 
     /**
-     * Returns the type definition of the given type id.
+     * Returns the type definition of the given type ID.
+     * 
+     * @param typeId
+     *            the type ID
+     * @return the type definition
+     * 
+     * @throws CmisObjectNotFoundException
+     *             if a type with the given type ID doesn't exist
      * 
      * @cmis 1.0
      */
     ObjectType getTypeDefinition(String typeId);
 
     /**
-     * Returns the type children of the given type id.
+     * Returns the type children of the given type ID.
+     * 
+     * @param typeId
+     *            the type ID or {@code null} to request the base types
+     * @param includePropertyDefinitions
+     *            indicates if the property definitions should be included
+     * @return the type iterator, not {@code null}
+     * 
+     * @throws CmisObjectNotFoundException
+     *             if a type with the given type ID doesn't exist
      * 
      * @cmis 1.0
      */
     ItemIterable<ObjectType> getTypeChildren(String typeId, boolean includePropertyDefinitions);
 
     /**
-     * Returns the type descendants of the given type id.
+     * Returns the type descendants of the given type ID.
+     * 
+     * @param typeId
+     *            the type ID or {@code null} to request the base types
+     * @param includePropertyDefinitions
+     *            indicates if the property definitions should be included
+     * @param depth
+     *            the tree depth, must be >0 or -1 for infinite depth
+     * 
+     * @throws CmisObjectNotFoundException
+     *             if a type with the given type ID doesn't exist
      * 
      * @cmis 1.0
      */
@@ -167,6 +210,10 @@ public interface Session extends Seriali
     /**
      * Creates a new type.
      * 
+     * @param type
+     *            the type definition
+     * @return the new type definition
+     * 
      * @cmis 1.1
      */
     ObjectType createType(TypeDefinition type);
@@ -174,6 +221,10 @@ public interface Session extends Seriali
     /**
      * Updates an existing type.
      * 
+     * @param type
+     *            the type definition updates
+     * @return the updated type definition
+     * 
      * @cmis 1.1
      */
     ObjectType updateType(TypeDefinition type);
@@ -181,6 +232,9 @@ public interface Session extends Seriali
     /**
      * Deletes a type.
      * 
+     * @param typeId
+     *            the ID of the type to delete
+     * 
      * @cmis 1.1
      */
     void deleteType(String typeId);
@@ -190,6 +244,8 @@ public interface Session extends Seriali
     /**
      * Gets the root folder of the repository.
      * 
+     * @return the root folder object, not {@code null}
+     * 
      * @cmis 1.0
      */
     Folder getRootFolder();
@@ -198,6 +254,8 @@ public interface Session extends Seriali
      * Gets the root folder of the repository with the given
      * {@link OperationContext}.
      * 
+     * @return the root folder object, not {@code null}
+     * 
      * @cmis 1.0
      */
     Folder getRootFolder(OperationContext context);
@@ -227,7 +285,7 @@ public interface Session extends Seriali
      * will load the object from the repository and puts it into the cache.
      * 
      * @param objectId
-     *            the object id
+     *            the object ID
      * 
      * @see #getObject(String)
      * 
@@ -241,7 +299,7 @@ public interface Session extends Seriali
      * will load the object from the repository and puts it into the cache.
      * 
      * @param objectId
-     *            the object id
+     *            the object ID
      * @param context
      *            the {@link OperationContext} to use
      * 
@@ -257,7 +315,7 @@ public interface Session extends Seriali
      * will load the object from the repository and puts it into the cache.
      * 
      * @param objectId
-     *            the object id
+     *            the object ID
      * 
      * @see #getObject(ObjectId)
      * 
@@ -271,7 +329,7 @@ public interface Session extends Seriali
      * will load the object from the repository and puts it into the cache.
      * 
      * @param objectId
-     *            the object id
+     *            the object ID
      * @param context
      *            the {@link OperationContext} to use
      * 
@@ -311,7 +369,7 @@ public interface Session extends Seriali
      * Removes the given object from the cache.
      * 
      * @param objectId
-     *            object id
+     *            object ID
      */
     void removeObjectFromCache(ObjectId objectId);
 
@@ -319,7 +377,7 @@ public interface Session extends Seriali
      * Removes the given object from the cache.
      * 
      * @param objectId
-     *            object id
+     *            object ID
      */
     void removeObjectFromCache(String objectId);
 
@@ -357,7 +415,7 @@ public interface Session extends Seriali
     /**
      * 
      * @param type
-     *            the id of the object type
+     *            the ID of the object type
      * @param where
      *            the WHERE part of the query
      * @param searchAllVersions
@@ -393,6 +451,7 @@ public interface Session extends Seriali
      *            result
      * @param maxNumItems
      *            maximum numbers of events
+     * @return the change events
      * 
      * @cmis 1.0
      */
@@ -410,6 +469,7 @@ public interface Session extends Seriali
      *            maximum numbers of events
      * @param context
      *            the OperationContext
+     * @return the change events
      * 
      * @cmis 1.0
      */
@@ -420,7 +480,7 @@ public interface Session extends Seriali
      * Returns an iterator of content changes, starting from the given change
      * log token to the latest entry in the change log.
      * <p>
-     * Note: Paging and skiping are not supported.
+     * Note: Paging and skipping are not supported.
      * 
      * @param changeLogToken
      *            the change log token to start from or {@code null}
@@ -430,13 +490,13 @@ public interface Session extends Seriali
      * 
      * @cmis 1.0
      */
-    public ItemIterable<ChangeEvent> getContentChanges(String changeLogToken, boolean includeProperties);
+    ItemIterable<ChangeEvent> getContentChanges(String changeLogToken, boolean includeProperties);
 
     /**
      * Returns an iterator of content changes, starting from the given change
      * log token to the latest entry in the change log.
      * <p>
-     * Note: Paging and skiping are not supported.
+     * Note: Paging and skipping are not supported.
      * 
      * @param changeLogToken
      *            the change log token to start from or {@code null}
@@ -448,18 +508,32 @@ public interface Session extends Seriali
      * 
      * @cmis 1.0
      */
-    public ItemIterable<ChangeEvent> getContentChanges(final String changeLogToken, final boolean includeProperties,
+    ItemIterable<ChangeEvent> getContentChanges(final String changeLogToken, final boolean includeProperties,
             OperationContext context);
 
+    /**
+     * Returns the latest change log token.
+     * <p>
+     * In contrast to the repository info, this change log token is not cached.
+     * This method requests the token from the repository every single time it
+     * is called.
+     * 
+     * @return the latest change log token or {@code null} if the repository
+     *         doesn't provide one
+     * 
+     * @cmis 1.0
+     */
+    String getLatestChangeLogToken();
+
     // create
 
     /**
      * Creates a new document.
      * 
-     * The stream in <code>contentStream</code> is consumed but not closed by
-     * this method.
+     * The stream in {@code contentStream} is consumed but not closed by this
+     * method.
      * 
-     * @return the object id of the new document
+     * @return the object ID of the new document
      * 
      * @see Folder#createDocument(Map, ContentStream, VersioningState, List,
      *      List, List, OperationContext)
@@ -472,10 +546,10 @@ public interface Session extends Seriali
     /**
      * Creates a new document.
      * 
-     * The stream in <code>contentStream</code> is consumed but not closed by
-     * this method.
+     * The stream in {@code contentStream} is consumed but not closed by this
+     * method.
      * 
-     * @return the object id of the new document
+     * @return the object ID of the new document
      * 
      * @see Folder#createDocument(Map, ContentStream, VersioningState, List,
      *      List, List, OperationContext)
@@ -488,7 +562,7 @@ public interface Session extends Seriali
     /**
      * Creates a new document from a source document.
      * 
-     * @return the object id of the new document
+     * @return the object ID of the new document
      * 
      * @see Folder#createDocumentFromSource(ObjectId, Map, VersioningState,
      *      List, List, List, OperationContext)
@@ -501,7 +575,7 @@ public interface Session extends Seriali
     /**
      * Creates a new document from a source document.
      * 
-     * @return the object id of the new document
+     * @return the object ID of the new document
      * 
      * @see Folder#createDocumentFromSource(ObjectId, Map, VersioningState,
      *      List, List, List, OperationContext)
@@ -514,7 +588,7 @@ public interface Session extends Seriali
     /**
      * Creates a new folder.
      * 
-     * @return the object id of the new folder
+     * @return the object ID of the new folder
      * 
      * @see Folder#createFolder(Map, List, List, List, OperationContext)
      * 
@@ -526,7 +600,7 @@ public interface Session extends Seriali
     /**
      * Creates a new folder.
      * 
-     * @return the object id of the new folder
+     * @return the object ID of the new folder
      * 
      * @see Folder#createFolder(Map, List, List, List, OperationContext)
      * 
@@ -537,7 +611,7 @@ public interface Session extends Seriali
     /**
      * Creates a new policy.
      * 
-     * @return the object id of the new policy
+     * @return the object ID of the new policy
      * 
      * @see Folder#createPolicy(Map, List, List, List, OperationContext)
      * 
@@ -549,7 +623,7 @@ public interface Session extends Seriali
     /**
      * Creates a new policy.
      * 
-     * @return the object id of the new policy
+     * @return the object ID of the new policy
      * 
      * @see Folder#createPolicy(Map, List, List, List, OperationContext)
      * 
@@ -560,7 +634,7 @@ public interface Session extends Seriali
     /**
      * Creates a new item.
      * 
-     * @return the object id of the new policy
+     * @return the object ID of the new policy
      * 
      * @see Folder#createItem(Map, List, List, List, OperationContext)
      * 
@@ -572,7 +646,7 @@ public interface Session extends Seriali
     /**
      * Creates a new item.
      * 
-     * @return the object id of the new item
+     * @return the object ID of the new item
      * 
      * @see Folder#createItem(Map, List, List, List, OperationContext)
      * 
@@ -583,7 +657,7 @@ public interface Session extends Seriali
     /**
      * Creates a new relationship.
      * 
-     * @return the object id of the new relationship
+     * @return the object ID of the new relationship
      * 
      * @cmis 1.0
      */
@@ -593,7 +667,7 @@ public interface Session extends Seriali
     /**
      * Creates a new relationship.
      * 
-     * @return the object id of the new relationship
+     * @return the object ID of the new relationship
      * 
      * @cmis 1.0
      */
@@ -620,7 +694,7 @@ public interface Session extends Seriali
      * series.
      * 
      * @param objectId
-     *            the id of the object
+     *            the ID of the object
      * 
      * @cmis 1.0
      */
@@ -630,7 +704,7 @@ public interface Session extends Seriali
      * Deletes an object.
      * 
      * @param objectId
-     *            the id of the object
+     *            the ID of the object
      * @param allVersions
      *            if this object is a document this parameter defines if only
      *            this version or all versions should be deleted
@@ -643,7 +717,7 @@ public interface Session extends Seriali
      * Retrieves the main content stream of a document
      * 
      * @param docId
-     *            the id of the document
+     *            the ID of the document
      * @return the content stream or {@code null} if the document has no content
      *         stream
      * 
@@ -655,9 +729,9 @@ public interface Session extends Seriali
      * Retrieves the content stream of a document
      * 
      * @param docId
-     *            the id of the document
+     *            the ID of the document
      * @param streamId
-     *            the stream id
+     *            the stream ID
      * @param offset
      *            the offset of the stream or {@code null} to read the stream
      *            from the beginning
@@ -676,12 +750,12 @@ public interface Session extends Seriali
      * Fetches the ACL of an object from the repository.
      * 
      * @param objectId
-     *            the id the object
+     *            the ID the object
      * @param onlyBasicPermissions
-     *            if <code>true</code> the repository should express the ACL
-     *            only with the basic permissions defined in the CMIS
-     *            specification; if <code>false</code> the repository can
-     *            express the ACL with basic and repository specific permissions
+     *            if {@code true} the repository should express the ACL only
+     *            with the basic permissions defined in the CMIS specification;
+     *            if {@code false} the repository can express the ACL with basic
+     *            and repository specific permissions
      * 
      * @return the ACL of the object
      * 
@@ -695,7 +769,7 @@ public interface Session extends Seriali
      * Only direct ACEs can be added and removed.
      * 
      * @param objectId
-     *            the id the object
+     *            the ID the object
      * @param addAces
      *            list of ACEs to be added or {@code null} if no ACEs should be
      *            added
@@ -720,7 +794,7 @@ public interface Session extends Seriali
      * dependent objects.
      * 
      * @param objectId
-     *            the id the object
+     *            the ID the object
      * @param aces
      *            list of ACEs to be set
      * 
@@ -737,9 +811,9 @@ public interface Session extends Seriali
      * applied.
      * 
      * @param objectId
-     *            the id the object
+     *            the ID the object
      * @param policyIds
-     *            the ids of the policies to be applied
+     *            the IDs of the policies to be applied
      * 
      * @cmis 1.0
      */
@@ -752,9 +826,9 @@ public interface Session extends Seriali
      * removed.
      * 
      * @param objectId
-     *            the id the object
+     *            the ID the object
      * @param policyIds
-     *            the ids of the policies to be removed
+     *            the IDs of the policies to be removed
      * 
      * @cmis 1.0
      */

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java?rev=1525926&r1=1525925&r2=1525926&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java Tue Sep 24 15:32:45 2013
@@ -419,6 +419,10 @@ public class SessionImpl implements Sess
         };
     }
 
+    public String getLatestChangeLogToken() {
+        return getBinding().getRepositoryService().getRepositoryInfo(getRepositoryId(), null).getLatestChangeLogToken();
+    }
+
     public OperationContext getDefaultContext() {
         lock.readLock().lock();
         try {