org.apache.chemistry.opencmis.client.runtime
Class SessionImpl

java.lang.Object
  extended by org.apache.chemistry.opencmis.client.runtime.SessionImpl
All Implemented Interfaces:
Serializable, Session

public class SessionImpl
extends Object
implements Session

Persistent model session.

See Also:
Serialized Form

Constructor Summary
SessionImpl(Map<String,String> parameters, ObjectFactory objectFactory, AuthenticationProvider authenticationProvider, Cache cache)
          Constructor.
 
Method Summary
 Acl applyAcl(ObjectId objectId, List<Ace> addAces, List<Ace> removeAces, AclPropagation aclPropagation)
          Applies an ACL to an object.
 void applyPolicy(ObjectId objectId, ObjectId... policyIds)
          Applies a set of policies to an object.
 void clear()
          Clears all cached data.
 void connect()
          Connect session object to the provider.
 ObjectId createDocument(Map<String,?> properties, ObjectId folderId, ContentStream contentStream, VersioningState versioningState)
          Creates a new document.
 ObjectId createDocument(Map<String,?> properties, ObjectId folderId, ContentStream contentStream, VersioningState versioningState, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces)
          Creates a new document.
 ObjectId createDocumentFromSource(ObjectId source, Map<String,?> properties, ObjectId folderId, VersioningState versioningState)
          Creates a new document from a source document.
 ObjectId createDocumentFromSource(ObjectId source, Map<String,?> properties, ObjectId folderId, VersioningState versioningState, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces)
          Creates a new document from a source document.
 ObjectId createFolder(Map<String,?> properties, ObjectId folderId)
          Creates a new folder.
 ObjectId createFolder(Map<String,?> properties, ObjectId folderId, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces)
          Creates a new folder.
 ObjectId createObjectId(String id)
          Creates an object id from a String.
 OperationContext createOperationContext()
          Creates a new operation context object.
 OperationContext createOperationContext(Set<String> filter, boolean includeAcls, boolean includeAllowableActions, boolean includePolicies, IncludeRelationships includeRelationships, Set<String> renditionFilter, boolean includePathSegments, String orderBy, boolean cacheEnabled, int maxItemsPerPage)
          Creates a new operation context object with the given properties.
 ObjectId createPolicy(Map<String,?> properties, ObjectId folderId)
          Creates a new policy.
 ObjectId createPolicy(Map<String,?> properties, ObjectId folderId, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces)
          Creates a new policy.
 QueryStatement createQueryStatement(String statement)
          Creates a query statement.
 ObjectId createRelationship(Map<String,?> properties)
          Creates a new relationship.
 ObjectId createRelationship(Map<String,?> properties, List<Policy> policies, List<Ace> addAces, List<Ace> removeAces)
          Creates a new relationship.
 Acl getAcl(ObjectId objectId, boolean onlyBasicPermissions)
          Fetches the ACL of an object from the repository.
 CmisBinding getBinding()
          Returns the underlying binding object.
 Cache getCache()
           
 ItemIterable<Document> getCheckedOutDocs()
          Returns all checked out documents.
 ItemIterable<Document> getCheckedOutDocs(OperationContext context)
          Returns all checked out documents with the given OperationContext .
 ChangeEvents getContentChanges(String changeLogToken, boolean includeProperties, long maxNumItems)
          Returns the content changes.
 ChangeEvents getContentChanges(String changeLogToken, boolean includeProperties, long maxNumItems, OperationContext context)
          Returns the content changes.
 OperationContext getDefaultContext()
          Returns the current default operation parameters for filtering, paging and caching.
 Locale getLocale()
          Get the current locale to be used for this session.
 CmisObject getObject(ObjectId objectId)
          Returns a CMIS object from the session cache.
 CmisObject getObject(ObjectId objectId, OperationContext context)
          Returns a CMIS object from the session cache.
 CmisObject getObject(String objectId)
          Returns a CMIS object from the session cache.
 CmisObject getObject(String objectId, OperationContext context)
          Returns a CMIS object from the session cache.
 CmisObject getObjectByPath(String path)
          Returns a CMIS object from the session cache.
 CmisObject getObjectByPath(String path, OperationContext context)
          Returns a CMIS object from the session cache.
 ObjectFactory getObjectFactory()
          Gets a factory object that provides methods to create the objects used by this API.
 ItemIterable<Relationship> getRelationships(ObjectId objectId, boolean includeSubRelationshipTypes, RelationshipDirection relationshipDirection, ObjectType type, OperationContext context)
          Fetches the relationships from or to an object from the repository.
 String getRepositoryId()
          Returns the repository id.
 RepositoryInfo getRepositoryInfo()
          Returns the repository info of the repository associated with this session.
 Folder getRootFolder()
          Gets the root folder of the repository.
 Folder getRootFolder(OperationContext context)
          Gets the root folder of the repository with the given OperationContext.
 ItemIterable<ObjectType> getTypeChildren(String typeId, boolean includePropertyDefinitions)
          Returns the type children of the given type id.
 ObjectType getTypeDefinition(String typeId)
          Returns the type definition of the given type id.
 List<Tree<ObjectType>> getTypeDescendants(String typeId, int depth, boolean includePropertyDefinitions)
          Returns the type descendants of the given type id.
 ItemIterable<QueryResult> query(String statement, boolean searchAllVersions)
          Sends a query to the repository.
 ItemIterable<QueryResult> query(String statement, boolean searchAllVersions, OperationContext context)
          Sends a query to the repository using the given OperationContext.
 void removeObjectFromCache(ObjectId objectId)
          Removes the given object from the cache.
 void removeObjectFromCache(String objectId)
          Removes the given object from the cache.
 void removePolicy(ObjectId objectId, ObjectId... policyIds)
          Removes a set of policies from an object.
 void setDefaultContext(OperationContext context)
          Sets the current session parameters for filtering, paging and caching.
 String setExtensionContext(String context)
           
 ExtensionHandler setExtensionHandler(String context, ExtensionHandler extensionHandler)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionImpl

public SessionImpl(Map<String,String> parameters,
                   ObjectFactory objectFactory,
                   AuthenticationProvider authenticationProvider,
                   Cache cache)
Constructor.

Method Detail

clear

public void clear()
Description copied from interface: Session
Clears all cached data. This implies that all data will be reloaded from the repository (depending on the implementation, reloading might be done immediately or be deferred).

Specified by:
clear in interface Session

getObjectFactory

public ObjectFactory getObjectFactory()
Description copied from interface: Session
Gets a factory object that provides methods to create the objects used by this API.

Specified by:
getObjectFactory in interface Session

getCheckedOutDocs

public ItemIterable<Document> getCheckedOutDocs()
Description copied from interface: Session
Returns all checked out documents.

Specified by:
getCheckedOutDocs in interface Session
See Also:
Folder.getCheckedOutDocs()

getCheckedOutDocs

public ItemIterable<Document> getCheckedOutDocs(OperationContext context)
Description copied from interface: Session
Returns all checked out documents with the given OperationContext .

Specified by:
getCheckedOutDocs in interface Session
See Also:
Folder.getCheckedOutDocs(OperationContext)

getContentChanges

public ChangeEvents getContentChanges(String changeLogToken,
                                      boolean includeProperties,
                                      long maxNumItems)
Description copied from interface: Session
Returns the content changes.

Specified by:
getContentChanges in interface Session
Parameters:
changeLogToken - the change log token to start from or null
includeProperties - indicates if changed properties should be included in the result
maxNumItems - maximum numbers of events

getContentChanges

public ChangeEvents getContentChanges(String changeLogToken,
                                      boolean includeProperties,
                                      long maxNumItems,
                                      OperationContext context)
Description copied from interface: Session
Returns the content changes.

Specified by:
getContentChanges in interface Session
Parameters:
changeLogToken - the change log token to start from or null
includeProperties - indicates if changed properties should be included in the result
maxNumItems - maximum numbers of events
context - the OperationContext

getDefaultContext

public OperationContext getDefaultContext()
Description copied from interface: Session
Returns the current default operation parameters for filtering, paging and caching.

Specified by:
getDefaultContext in interface Session

setDefaultContext

public void setDefaultContext(OperationContext context)
Description copied from interface: Session
Sets the current session parameters for filtering, paging and caching.

Specified by:
setDefaultContext in interface Session
Parameters:
context - the OperationContext to be used for the session; if null, a default context is used

createOperationContext

public OperationContext createOperationContext(Set<String> filter,
                                               boolean includeAcls,
                                               boolean includeAllowableActions,
                                               boolean includePolicies,
                                               IncludeRelationships includeRelationships,
                                               Set<String> renditionFilter,
                                               boolean includePathSegments,
                                               String orderBy,
                                               boolean cacheEnabled,
                                               int maxItemsPerPage)
Description copied from interface: Session
Creates a new operation context object with the given properties.

Specified by:
createOperationContext in interface Session
See Also:
OperationContext

createOperationContext

public OperationContext createOperationContext()
Description copied from interface: Session
Creates a new operation context object.

Specified by:
createOperationContext in interface Session

createObjectId

public ObjectId createObjectId(String id)
Description copied from interface: Session
Creates an object id from a String.

Specified by:
createObjectId in interface Session

getLocale

public Locale getLocale()
Description copied from interface: Session
Get the current locale to be used for this session.

Specified by:
getLocale in interface Session

getObject

public CmisObject getObject(ObjectId objectId)
Description copied from interface: Session
Returns a CMIS object from the session cache. If the object is not in the cache or the cache is turned off per default OperationContext, it will load the object from the repository and puts it into the cache.

Specified by:
getObject in interface Session
Parameters:
objectId - the object id
See Also:
Session.getObject(String)

getObject

public CmisObject getObject(ObjectId objectId,
                            OperationContext context)
Description copied from interface: Session
Returns a CMIS object from the session cache. If the object is not in the cache or the given OperationContext has caching turned off, it will load the object from the repository and puts it into the cache.

Specified by:
getObject in interface Session
Parameters:
objectId - the object id
context - the OperationContext to use
See Also:
Session.getObject(String, OperationContext)

getObject

public CmisObject getObject(String objectId)
Description copied from interface: Session
Returns a CMIS object from the session cache. If the object is not in the cache or the cache is turned off per default OperationContext, it will load the object from the repository and puts it into the cache.

Specified by:
getObject in interface Session
Parameters:
objectId - the object id
See Also:
Session.getObject(ObjectId)

getObject

public CmisObject getObject(String objectId,
                            OperationContext context)
Description copied from interface: Session
Returns a CMIS object from the session cache. If the object is not in the cache or the given OperationContext has caching turned off, it will load the object from the repository and puts it into the cache.

Specified by:
getObject in interface Session
Parameters:
objectId - the object id
context - the OperationContext to use
See Also:
Session.getObject(ObjectId, OperationContext)

getObjectByPath

public CmisObject getObjectByPath(String path)
Description copied from interface: Session
Returns a CMIS object from the session cache. If the object is not in the cache or the cache is turned off per default OperationContext, it will load the object from the repository and puts it into the cache.

Specified by:
getObjectByPath in interface Session
Parameters:
path - the object path

getObjectByPath

public CmisObject getObjectByPath(String path,
                                  OperationContext context)
Description copied from interface: Session
Returns a CMIS object from the session cache. If the object is not in the cache or the given OperationContext has caching turned off, it will load the object from the repository and puts it into the cache.

Specified by:
getObjectByPath in interface Session
Parameters:
path - the object path
context - the OperationContext to use

removeObjectFromCache

public void removeObjectFromCache(ObjectId objectId)
Description copied from interface: Session
Removes the given object from the cache.

Specified by:
removeObjectFromCache in interface Session
Parameters:
objectId - object id

removeObjectFromCache

public void removeObjectFromCache(String objectId)
Description copied from interface: Session
Removes the given object from the cache.

Specified by:
removeObjectFromCache in interface Session
Parameters:
objectId - object id

getRepositoryInfo

public RepositoryInfo getRepositoryInfo()
Description copied from interface: Session
Returns the repository info of the repository associated with this session.

Specified by:
getRepositoryInfo in interface Session

getRootFolder

public Folder getRootFolder()
Description copied from interface: Session
Gets the root folder of the repository.

Specified by:
getRootFolder in interface Session

getRootFolder

public Folder getRootFolder(OperationContext context)
Description copied from interface: Session
Gets the root folder of the repository with the given OperationContext.

Specified by:
getRootFolder in interface Session

getTypeChildren

public ItemIterable<ObjectType> getTypeChildren(String typeId,
                                                boolean includePropertyDefinitions)
Description copied from interface: Session
Returns the type children of the given type id.

Specified by:
getTypeChildren in interface Session

getTypeDefinition

public ObjectType getTypeDefinition(String typeId)
Description copied from interface: Session
Returns the type definition of the given type id.

Specified by:
getTypeDefinition in interface Session

getTypeDescendants

public List<Tree<ObjectType>> getTypeDescendants(String typeId,
                                                 int depth,
                                                 boolean includePropertyDefinitions)
Description copied from interface: Session
Returns the type descendants of the given type id.

Specified by:
getTypeDescendants in interface Session

query

public ItemIterable<QueryResult> query(String statement,
                                       boolean searchAllVersions)
Description copied from interface: Session
Sends a query to the repository. (See CMIS spec "2.1.10 Query".)

Specified by:
query in interface Session
Parameters:
statement - the query statement (CMIS query language)
searchAllVersions - specifies if the latest and non-latest versions of document objects should be included

query

public ItemIterable<QueryResult> query(String statement,
                                       boolean searchAllVersions,
                                       OperationContext context)
Description copied from interface: Session
Sends a query to the repository using the given OperationContext. (See CMIS spec "2.1.10 Query".)

Specified by:
query in interface Session
Parameters:
statement - the query statement (CMIS query language)
searchAllVersions - specifies if the latest and non-latest versions of document objects should be included
context - the OperationContext

createQueryStatement

public QueryStatement createQueryStatement(String statement)
Description copied from interface: Session
Creates a query statement.

Specified by:
createQueryStatement in interface Session
Parameters:
statement - the query statement with placeholders ('?').
See Also:
QueryStatement

setExtensionContext

public String setExtensionContext(String context)

setExtensionHandler

public ExtensionHandler setExtensionHandler(String context,
                                            ExtensionHandler extensionHandler)

connect

public void connect()
Connect session object to the provider. This is the very first call after a session is created.

In dependency of the parameter set an AtomPub, a WebService or an InMemory provider is selected.


getBinding

public CmisBinding getBinding()
Description copied from interface: Session
Returns the underlying binding object.

Specified by:
getBinding in interface Session

getCache

public Cache getCache()

getRepositoryId

public String getRepositoryId()
Returns the repository id.


createDocument

public ObjectId createDocument(Map<String,?> properties,
                               ObjectId folderId,
                               ContentStream contentStream,
                               VersioningState versioningState,
                               List<Policy> policies,
                               List<Ace> addAces,
                               List<Ace> removeAces)
Description copied from interface: Session
Creates a new document.

Specified by:
createDocument in interface Session
Returns:
the object id of the new document
See Also:
Folder.createDocument(Map, ContentStream, VersioningState, List, List, List, OperationContext)

createDocumentFromSource

public ObjectId createDocumentFromSource(ObjectId source,
                                         Map<String,?> properties,
                                         ObjectId folderId,
                                         VersioningState versioningState,
                                         List<Policy> policies,
                                         List<Ace> addAces,
                                         List<Ace> removeAces)
Description copied from interface: Session
Creates a new document from a source document.

Specified by:
createDocumentFromSource in interface Session
Returns:
the object id of the new document
See Also:
Folder.createDocumentFromSource(ObjectId, Map, VersioningState, List, List, List, OperationContext)

createFolder

public ObjectId createFolder(Map<String,?> properties,
                             ObjectId folderId,
                             List<Policy> policies,
                             List<Ace> addAces,
                             List<Ace> removeAces)
Description copied from interface: Session
Creates a new folder.

Specified by:
createFolder in interface Session
Returns:
the object id of the new folder
See Also:
Folder.createFolder(Map, List, List, List, OperationContext)

createPolicy

public ObjectId createPolicy(Map<String,?> properties,
                             ObjectId folderId,
                             List<Policy> policies,
                             List<Ace> addAces,
                             List<Ace> removeAces)
Description copied from interface: Session
Creates a new policy.

Specified by:
createPolicy in interface Session
Returns:
the object id of the new policy
See Also:
Folder.createPolicy(Map, List, List, List, OperationContext)

createRelationship

public ObjectId createRelationship(Map<String,?> properties,
                                   List<Policy> policies,
                                   List<Ace> addAces,
                                   List<Ace> removeAces)
Description copied from interface: Session
Creates a new relationship.

Specified by:
createRelationship in interface Session
Returns:
the object id of the new relationship

createDocument

public ObjectId createDocument(Map<String,?> properties,
                               ObjectId folderId,
                               ContentStream contentStream,
                               VersioningState versioningState)
Description copied from interface: Session
Creates a new document.

Specified by:
createDocument in interface Session
Returns:
the object id of the new document
See Also:
Folder.createDocument(Map, ContentStream, VersioningState, List, List, List, OperationContext)

createDocumentFromSource

public ObjectId createDocumentFromSource(ObjectId source,
                                         Map<String,?> properties,
                                         ObjectId folderId,
                                         VersioningState versioningState)
Description copied from interface: Session
Creates a new document from a source document.

Specified by:
createDocumentFromSource in interface Session
Returns:
the object id of the new document
See Also:
Folder.createDocumentFromSource(ObjectId, Map, VersioningState, List, List, List, OperationContext)

createFolder

public ObjectId createFolder(Map<String,?> properties,
                             ObjectId folderId)
Description copied from interface: Session
Creates a new folder.

Specified by:
createFolder in interface Session
Returns:
the object id of the new folder
See Also:
Folder.createFolder(Map, List, List, List, OperationContext)

createPolicy

public ObjectId createPolicy(Map<String,?> properties,
                             ObjectId folderId)
Description copied from interface: Session
Creates a new policy.

Specified by:
createPolicy in interface Session
Returns:
the object id of the new policy
See Also:
Folder.createPolicy(Map, List, List, List, OperationContext)

createRelationship

public ObjectId createRelationship(Map<String,?> properties)
Description copied from interface: Session
Creates a new relationship.

Specified by:
createRelationship in interface Session
Returns:
the object id of the new relationship

getRelationships

public ItemIterable<Relationship> getRelationships(ObjectId objectId,
                                                   boolean includeSubRelationshipTypes,
                                                   RelationshipDirection relationshipDirection,
                                                   ObjectType type,
                                                   OperationContext context)
Description copied from interface: Session
Fetches the relationships from or to an object from the repository.

Specified by:
getRelationships in interface Session

getAcl

public Acl getAcl(ObjectId objectId,
                  boolean onlyBasicPermissions)
Description copied from interface: Session
Fetches the ACL of an object from the repository.

Specified by:
getAcl in interface Session

applyAcl

public Acl applyAcl(ObjectId objectId,
                    List<Ace> addAces,
                    List<Ace> removeAces,
                    AclPropagation aclPropagation)
Description copied from interface: Session
Applies an ACL to an object.

Specified by:
applyAcl in interface Session

applyPolicy

public void applyPolicy(ObjectId objectId,
                        ObjectId... policyIds)
Description copied from interface: Session
Applies a set of policies to an object.

Specified by:
applyPolicy in interface Session

removePolicy

public void removePolicy(ObjectId objectId,
                         ObjectId... policyIds)
Description copied from interface: Session
Removes a set of policies from an object.

Specified by:
removePolicy in interface Session


Copyright © 2009-2011 The Apache Software Foundation. All Rights Reserved.