org.xcmis.spi.basic
Class BasicStorage

java.lang.Object
  extended by org.xcmis.spi.basic.BasicStorage
All Implemented Interfaces:
Storage, TypeManager

public abstract class BasicStorage
extends Object
implements Storage

Basic Storage impl


Field Summary
protected  PermissionService permissionService
           
protected  RepositoryInfo repositoryInfo
           
protected  TypeManager typeManager
           
 
Constructor Summary
BasicStorage(RepositoryInfo repositoryInfo, TypeManager typeManager, PermissionService permissionService)
           
 
Method Summary
 String addType(TypeDefinition type)
          Add new type in repository.
 AllowableActions calculateAllowableActions(ObjectData object)
          Calculates allowable actions for specified object.
 DocumentData createDocument(FolderData parent, TypeDefinition typeDefinition, Map<String,Property<?>> properties, ContentStream content, List<AccessControlEntry> acl, Collection<PolicyData> policies, VersioningState versioningState)
          Create new document with type typeDefinition using parent as parent.
 PolicyData createPolicy(FolderData parent, TypeDefinition typeDefinition, Map<String,Property<?>> properties, List<AccessControlEntry> acl, Collection<PolicyData> policies)
          Create new policy with type typeDefinition using parent as parent.
 RelationshipData createRelationship(ObjectData source, ObjectData target, TypeDefinition typeDefinition, Map<String,Property<?>> properties, List<AccessControlEntry> acl, Collection<PolicyData> policies)
          Create new relationship for specified source and target.
 Collection<DocumentData> getAllVersions(String versionSeriesId)
          Collection of all Document in the specified version series, sorted by cmis:creationDate descending.
 ItemsIterator<ChangeEvent> getChangeLog(String changeLogToken)
          Gets content changes.
 ItemsIterator<DocumentData> getCheckedOutDocuments(FolderData folder, String orderBy)
          Get checkedout objects (private working copies) that user has access to.
 String getId()
          Gets storage unique id.
 ItemsIterator<Rendition> getRenditions(ObjectData object)
          Get object renditions.
 RepositoryInfo getRepositoryInfo()
          Get description of storage and its capabilities.
 ItemsIterator<TypeDefinition> getTypeChildren(String typeId, boolean includePropertyDefinitions)
          Iterator over object types.
 TypeDefinition getTypeDefinition(String typeId, boolean includePropertyDefinition)
          Get type definition for type typeId .
 Iterator<String> getUnfiledObjectsId()
          Iterator of all unfilled documents identifiers.
 ObjectData moveObject(ObjectData object, FolderData target, FolderData source)
          Move object from source to target.
 ItemsIterator<Result> query(Query query)
          Handle specified SQL query.
 void removeType(String typeId)
          Remove type definition for type typeId .
 void unfileObject(ObjectData object)
          Remove non-folder fileable object from all folder where in which it is currently filed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xcmis.spi.Storage
copyDocument, createFolder, deleteObject, deleteTree, getObjectById, getObjectByPath
 

Field Detail

repositoryInfo

protected RepositoryInfo repositoryInfo

typeManager

protected TypeManager typeManager

permissionService

protected PermissionService permissionService
Constructor Detail

BasicStorage

public BasicStorage(RepositoryInfo repositoryInfo,
                    TypeManager typeManager,
                    PermissionService permissionService)
Method Detail

getRepositoryInfo

public RepositoryInfo getRepositoryInfo()
Get description of storage and its capabilities. 2.2.2.2 getRepositoryInfo Implementation Compatibility: MUST be implemented The "Get Repository Information" service MUST also return implementation information including vendor name, product name, product version, version of CMIS that it supports, the root folder ID (see section 2.1.5.2 Folder Hierarchy), and MAY include other implementation-specific information. The version of CMIS that the repository supports MUST be expressed as a Decimal that matches the specification version.

Specified by:
getRepositoryInfo in interface Storage
Returns:
storage description

calculateAllowableActions

public AllowableActions calculateAllowableActions(ObjectData object)
Calculates allowable actions for specified object. Implementation Compatibility: MUST be implemented

Specified by:
calculateAllowableActions in interface Storage
Parameters:
object - object
Returns:
allowable actions for object

addType

public String addType(TypeDefinition type)
               throws ConstraintException,
                      StorageException,
                      CmisRuntimeException
Add new type in repository. 2.1.3 Object-Type A repository MAY define additional object-types beyond the CMIS Base Object-Types Implementation Compatibility: MAY be implemented.

Specified by:
addType in interface TypeManager
Parameters:
type - the type definition
Returns:
ID of added type
Throws:
ConstraintException - if any of the following conditions are met:
StorageException - if type can't be added cause to storage internal problem
NotSupportedException - if storage does not support adding new types
CmisRuntimeException

removeType

public void removeType(String typeId)
                throws TypeNotFoundException,
                       ConstraintException,
                       StorageException,
                       CmisRuntimeException
Remove type definition for type typeId .

Specified by:
removeType in interface TypeManager
Parameters:
typeId - type Id
Throws:
TypeNotFoundException - if type typeId not found in repository
ConstraintException - if removing type violates a storage constraint. For example, if storage already contains object of this type
StorageException - if type can't be added cause to storage internal problem
CmisRuntimeException

getTypeChildren

public ItemsIterator<TypeDefinition> getTypeChildren(String typeId,
                                                     boolean includePropertyDefinitions)
                                              throws TypeNotFoundException,
                                                     CmisRuntimeException
Iterator over object types.

Specified by:
getTypeChildren in interface TypeManager
Parameters:
typeId - the type id, if not null then return only specified Object Type and its direct descendant. If null then return base types
includePropertyDefinitions - true if property definition should be included false otherwise
Returns:
set of base types or specified object type and its direct children
Throws:
TypeNotFoundException - if type typeId does not exist
CmisRuntimeException

getTypeDefinition

public TypeDefinition getTypeDefinition(String typeId,
                                        boolean includePropertyDefinition)
                                 throws TypeNotFoundException,
                                        CmisRuntimeException
Get type definition for type typeId .

Specified by:
getTypeDefinition in interface TypeManager
Parameters:
typeId - type Id
includePropertyDefinition - if true property definition should be included
Returns:
type definition
Throws:
TypeNotFoundException - if type typeId does not exist
CmisRuntimeException

createDocument

public DocumentData createDocument(FolderData parent,
                                   TypeDefinition typeDefinition,
                                   Map<String,Property<?>> properties,
                                   ContentStream content,
                                   List<AccessControlEntry> acl,
                                   Collection<PolicyData> policies,
                                   VersioningState versioningState)
                            throws ConstraintException,
                                   NameConstraintViolationException,
                                   IOException,
                                   StorageException
Create new document with type typeDefinition using parent as parent. If parent == null then document created in unfiling state. If unfiling is not supported ConstraintException should be thrown. Implementation Compatibility: MUST be implemented

Specified by:
createDocument in interface Storage
Parameters:
parent - parent folder or null if document should be created in unfiling state
typeDefinition - the document type definition
properties - the document properties. Properties whith updatability other then Updatability.ONCREATE or Updatability.READWRITE will be ignored
content - the document content. May be null. MUST be required if the type requires it.
acl - the list of ACEs to be applied to newly create document. May be null or empty list if no ACEs to be applied
policies - the list of policies. May be null or empty collection if no policies to be applied
versioningState - versioning state
Returns:
newly created document
Throws:
ConstraintException - if any of following condition are met:
  • versionable attribute of the object type definition is false and a value of the versioningState parameter is other than none
  • versionable attribute of the object type definition is true and and the value of the versioningState parameter is none
  • if parent == null and unfiling is not supported
NameConstraintViolationException - if property 'cmis:name' throws conflict
IOException - if any i/o error occurs when try to set document content stream
StorageException - if object can not be saved cause to storage internal problem
See Also:
VersioningState

createPolicy

public PolicyData createPolicy(FolderData parent,
                               TypeDefinition typeDefinition,
                               Map<String,Property<?>> properties,
                               List<AccessControlEntry> acl,
                               Collection<PolicyData> policies)
                        throws ConstraintException,
                               NameConstraintViolationException,
                               StorageException
Create new policy with type typeDefinition using parent as parent. If parent == null then policy created in unfiling state. 2.2.4.5 createPolicy Implementation Compatibility: the support for policy objects is optional, if implementation does not support cmis:policy object-type method should throw NotSupportedException

Specified by:
createPolicy in interface Storage
Parameters:
parent - parent folder
typeDefinition - the policy type definition
properties - the policy properties
acl - the list of ACEs to be applied to newly created policy. May be null or empty list if no ACEs to be applied
policies - the list of policies. May be null or empty collection if no policies to be applied
Returns:
newly created policy
Throws:
ConstraintException - if parent == null and policy type is fileable
NameConstraintViolationException - if property 'cmis:name' throws conflict
StorageException - if object can not be saved cause to storage internal problem

createRelationship

public RelationshipData createRelationship(ObjectData source,
                                           ObjectData target,
                                           TypeDefinition typeDefinition,
                                           Map<String,Property<?>> properties,
                                           List<AccessControlEntry> acl,
                                           Collection<PolicyData> policies)
                                    throws NameConstraintViolationException,
                                           StorageException
Create new relationship for specified source and target. Implementation Compatibility: the support for relationship objects is optional, if implementation does not support cmis:relationship object-type method should throw NotSupportedException

Specified by:
createRelationship in interface Storage
Parameters:
source - source of relationship
target - target of relationship
typeDefinition - the relationship type definition
properties - the relationship properties
acl - the list of ACEs to be applied to newly created relationship. May be null or empty list if no ACEs to be applied
policies - the list of policies. May be null or empty collection if no policies to be applied
Returns:
newly created relationship
Throws:
NameConstraintViolationException - if property 'cmis:name' throws conflict
StorageException - if object can not be removed cause to storage internal problem

getAllVersions

public Collection<DocumentData> getAllVersions(String versionSeriesId)
                                        throws ObjectNotFoundException
Collection of all Document in the specified version series, sorted by cmis:creationDate descending. Implementation Compatibility: SHOULD be implemented if the repository supports versioning. Otherwise, NotSupportedException should be thrown.

Specified by:
getAllVersions in interface Storage
Parameters:
versionSeriesId - the id of version series
Returns:
document versions
Throws:
ObjectNotFoundException - if version series with versionSeriesId does not exist

getChangeLog

public ItemsIterator<ChangeEvent> getChangeLog(String changeLogToken)
                                        throws ConstraintException
Gets content changes. Implementation Compatibility: SHOULD be implemented if the repository supports changes Capability (capabilityChanges != none). Otherwise, NotSupportedException should be thrown.

Specified by:
getChangeLog in interface Storage
Parameters:
changeLogToken - if value other than null, then change event corresponded to the value of the specified change log token will be returned as the first result in the output. If not specified, then will be returned the first change event recorded in the change log. When set of changes passed is returned then changeLogToken must contains log token corresponded to the last change event. Then it may be used by caller for getting next set on change events
Returns:
iterator over change log events
Throws:
ConstraintException - if the event corresponding to the change log token provided as an input parameter is no longer available in the change log. (E.g. because the change log was truncated)

getCheckedOutDocuments

public ItemsIterator<DocumentData> getCheckedOutDocuments(FolderData folder,
                                                          String orderBy)
Get checkedout objects (private working copies) that user has access to. Implementation Compatibility: Optional. Repository versioning specific.

Specified by:
getCheckedOutDocuments in interface Storage
Parameters:
folder - folder, if null then get all checked out objects in any folders
orderBy - comma-separated list of query names and the ascending modifier 'ASC' or the descending modifier 'DESC' for each query name. A storage's handling of the orderBy input is storage-specific and storage may ignore this parameter if it not able sort items
Returns:
iterator over checked out objects. If storage does not support any versionable type, so may not have PWCs (private working copies) empty iterator must be returned

getId

public String getId()
Gets storage unique id. Implementation Compatibility: MUST be implemented

Specified by:
getId in interface Storage
Returns:
storage id

getRenditions

public ItemsIterator<Rendition> getRenditions(ObjectData object)
Get object renditions. Implementation Compatibility: SHOULD be implemented if capabilityRenditions = read

Specified by:
getRenditions in interface Storage
Parameters:
object - the object
Returns:
iterator over object's renditions. If object has not any renditions then empty iterator must be returned but never null

moveObject

public ObjectData moveObject(ObjectData object,
                             FolderData target,
                             FolderData source)
                      throws UpdateConflictException,
                             VersioningException,
                             NameConstraintViolationException,
                             StorageException
Move object from source to target. If operation successful then changes saved immediately. Implementation Compatibility: MUST be implemented

Specified by:
moveObject in interface Storage
Parameters:
object - object to be moved
target - destination folder
source - folder from which object must be moved
Returns:
Throws:
UpdateConflictException - if object that is no longer current (as determined by the storage).
VersioningException - if object is a non-current document version
NameConstraintViolationException - if moving operation cause name conflict, e.g. destination folder already contains object with the same name
StorageException - if object can not be moved (save changes) cause to storage internal problem

query

public ItemsIterator<Result> query(Query query)
                            throws InvalidArgumentException
Handle specified SQL query. Implementation Compatibility: SHOULD be implemented if the repository supports query Capability (capabilityQuery != none)). Otherwise, NotSupportedException should be thrown.

Specified by:
query in interface Storage
Parameters:
query - SQL query
Returns:
set of query results
Throws:
InvalidArgumentException - if specified query is invalid

unfileObject

public void unfileObject(ObjectData object)
Remove non-folder fileable object from all folder where in which it is currently filed. NOTE This method never remove object itself. 2.2.5.2 removeObjectFromFolder Implementation Compatibility: SHOULD be implemented if the repository supports the multifiling (capabilityMultifiling) and unfiling (capabilityUnfiling) optional capabilities. Otherwise, NotSupportedException should be thrown.

Specified by:
unfileObject in interface Storage
Parameters:
object - object

getUnfiledObjectsId

public Iterator<String> getUnfiledObjectsId()
                                     throws StorageException
Iterator of all unfilled documents identifiers. Implementation Compatibility: SHOULD be implemented if the repository supports the unfiling (capabilityUnfiling) optional capabilities. Otherwise, NotSupportedException should be thrown.

Specified by:
getUnfiledObjectsId in interface Storage
Returns:
Iterator of all unfilled documents identifiers.
Throws:
StorageException - if any storage error occurs


Copyright © 2011 eXo Platform SAS. All Rights Reserved.