public class ObjectStoreImpl extends Object implements ObjectStore, ObjectStoreMultiFiling
Certain methods in the in-memory repository must guarantee constraints. For example a folder enforces that each child has a unique name. Therefore certain operations must occur in an atomic manner. In the example it must be guaranteed that no write access occurs to the map between acquiring the iterator to find the children and finishing the add operation when no name conflicts can occur. For this purpose this class has methods to lock an unlock the state of the repository. It is very important that the caller acquiring the lock enforces an unlock under all circumstances. Typical code is:
ObjectStoreImpl os = ... ;
try {
os.lock();
} finally {
os.unlock();
}
The locking is very coarse-grained. Productive implementations would probably
implement finer grained locks on a folder or document rather than the
complete repository.ObjectStoreFiling.ChildrenResult| Modifier and Type | Field and Description |
|---|---|
static String |
ADMIN_PRINCIPAL_ID
user id for administrator always having all rights
|
| Constructor and Description |
|---|
ObjectStoreImpl(String repositoryId) |
| Modifier and Type | Method and Description |
|---|---|
void |
addParent(StoredObject so,
Folder parent)
Add this document to a new parent folder as child object
|
Acl |
applyAcl(StoredObject so,
Acl addAces,
Acl removeAces,
AclPropagation aclPropagation,
String principalId)
Apply a ACLs by relative adding and removing a list of ACEs to/from an object
|
Acl |
applyAcl(StoredObject so,
Acl acl,
AclPropagation aclPropagation,
String principalId)
Apply a ACLs by setting a new list of ACEs to an object
|
void |
checkAllAccess(String principalId,
StoredObject so) |
void |
checkReadAccess(String principalId,
StoredObject so) |
void |
checkWriteAccess(String principalId,
StoredObject so) |
void |
clear()
Clear repository and remove all data.
|
Document |
createDocument(String name,
Map<String,PropertyData<?>> propMap,
String user,
Folder folder,
List<String> policies,
Acl addACEs,
Acl removeACEs)
Create a document as initial step.
|
Folder |
createFolder(String name) |
Folder |
createFolder(String name,
Map<String,PropertyData<?>> propMap,
String user,
Folder parent,
List<String> policies,
Acl addACEs,
Acl removeACEs)
Create a folder as initial step.
|
StoredObject |
createItem(String name,
Map<String,PropertyData<?>> propMap,
String user,
Folder folder,
List<String> policies,
Acl addACEs,
Acl removeACEs)
Create an item as initial step.
|
StoredObject |
createPolicy(String name,
String policyText,
Map<String,PropertyData<?>> propMap,
String user)
Create a policy.
|
StoredObject |
createRelationship(String name,
StoredObject sourceObject,
StoredObject targetObject,
Map<String,PropertyData<?>> propMap,
String user,
Acl addACEs,
Acl removeACEs)
Create a relationship.
|
DocumentVersion |
createVersionedDocument(String name,
Map<String,PropertyData<?>> propMap,
String user,
Folder folder,
List<String> policies,
Acl addACEs,
Acl removeACEs,
ContentStream contentStream,
VersioningState versioningState)
Create a document that supports versions as initial step.
|
void |
deleteObject(String objectId,
Boolean allVersions,
String user)
Deletes an object from the store.
|
void |
deleteVersion(DocumentVersion version)
remove a version from the store (after a cancel check-out)
|
Acl |
getAcl(int aclId)
get an ACL object from an ACL id
|
int |
getAclId(StoredObjectImpl so,
Acl addACEs,
Acl removeACEs) |
List<Integer> |
getAllAclsForUser(String principalId,
Permission permission) |
List<StoredObject> |
getCheckedOutDocuments(String orderBy,
String user,
IncludeRelationships includeRelationships)
Return a list of all documents that are checked out in the repository.
|
ObjectStoreFiling.ChildrenResult |
getChildren(Folder folder,
int maxItems,
int skipCount,
String user,
boolean usePwc)
get all the children of this folder.
|
ObjectStoreFiling.ChildrenResult |
getFolderChildren(Folder folder,
int maxItems,
int skipCount,
String user)
get all the children of this folder which are folders.
|
String |
getFolderPath(String folderId)
get the path of this folder (for folder in CMIS path is unique)
|
Set<String> |
getIds() |
StoredObject |
getObjectById(String objectId)
get an object by its id
|
StoredObject |
getObjectByPath(String path,
String user)
return an object by path.
|
long |
getObjectCount()
For statistics: return the number of objects contained in the system
|
List<String> |
getParentIds(Filing fileable,
String user)
get all parent ids of this object visible for a user
|
List<StoredObject> |
getRelationships(String objectId,
List<String> typeIds,
RelationshipDirection direction)
Get relationships to and from an object
|
Folder |
getRootFolder()
Get the root folder of this object store
|
boolean |
hasAllAccess(String principalId,
StoredObject so) |
boolean |
hasReadAccess(String principalId,
StoredObject so) |
boolean |
hasWriteAccess(String principalId,
StoredObject so) |
boolean |
isTypeInUse(String typeId)
Check if this store contains any object with the given type id
|
void |
move(StoredObject so,
Folder oldParent,
Folder newParent)
Move an object to a different folder.
|
void |
removeParent(StoredObject so,
Folder parent)
Remove this object from the children of parent
|
void |
rename(Fileable so,
String newName)
Rename an object
|
String |
storeObject(StoredObject so) |
void |
storeVersion(DocumentVersion version)
Persist a new version in the store (created from a check-out)
|
void |
upateObject(StoredObject so)
Persist an object after modifying the properties
|
public static final String ADMIN_PRINCIPAL_ID
public ObjectStoreImpl(String repositoryId)
public Folder getRootFolder()
ObjectStoregetRootFolder in interface ObjectStorepublic StoredObject getObjectByPath(String path, String user)
ObjectStoregetObjectByPath in interface ObjectStorepath - the path to the objectpublic StoredObject getObjectById(String objectId)
ObjectStoregetObjectById in interface ObjectStoreobjectId - the id of the objectpublic void deleteObject(String objectId, Boolean allVersions, String user)
ObjectStoredeleteObject in interface ObjectStoreallVersions - is TRUE all version of the document are deleted, otherwise just this onepublic String storeObject(StoredObject so)
public void clear()
clear in interface ObjectStorepublic long getObjectCount()
ObjectStoregetObjectCount in interface ObjectStorepublic Document createDocument(String name, Map<String,PropertyData<?>> propMap, String user, Folder folder, List<String> policies, Acl addACEs, Acl removeACEs)
ObjectStorecreateDocument in interface ObjectStorename - name of the documentpropMap - map of propertiesuser - the user who creates the documentfolder - the parent folderpolicies - list of policies to applyaddACEs - aces that are addedremoveACEs - aces that are removedpublic StoredObject createItem(String name, Map<String,PropertyData<?>> propMap, String user, Folder folder, List<String> policies, Acl addACEs, Acl removeACEs)
ObjectStorecreateItem in interface ObjectStorename - name of the documentpropMap - map of propertiesuser - the user who creates the documentfolder - the parent folderpolicies - list of policies to applyaddACEs - aces that are addedremoveACEs - aces that are removedpublic DocumentVersion createVersionedDocument(String name, Map<String,PropertyData<?>> propMap, String user, Folder folder, List<String> policies, Acl addACEs, Acl removeACEs, ContentStream contentStream, VersioningState versioningState)
ObjectStorecreateVersionedDocument in interface ObjectStorename - name of the document
* @param propMap
map of properitiesuser - the user who creates the documentfolder - the parent folderpolicies - list of policies to applyaddACEs - aces that are addedremoveACEs - aces that are removedpublic Folder createFolder(String name, Map<String,PropertyData<?>> propMap, String user, Folder parent, List<String> policies, Acl addACEs, Acl removeACEs)
ObjectStorecreateFolder in interface ObjectStorename - name of the folderpropMap - map of propertiesuser - the user who creates the documentparent - the parent folderpolicies - list of policies to applyaddACEs - aces that are addedremoveACEs - aces that are removedpublic StoredObject createPolicy(String name, String policyText, Map<String,PropertyData<?>> propMap, String user)
ObjectStorecreatePolicy in interface ObjectStorename - name of the documentpolicyText - policy text to apply to this policypropMap - map of propertiesuser - the user who creates the documentpublic StoredObject createRelationship(String name, StoredObject sourceObject, StoredObject targetObject, Map<String,PropertyData<?>> propMap, String user, Acl addACEs, Acl removeACEs)
ObjectStorecreateRelationship in interface ObjectStoresourceObject - source of the relationshiptargetObject - target of the relationshippropMap - map of properitiesuser - the user who creates the documentaddACEs - aces that are addedremoveACEs - aces that are removedpublic void storeVersion(DocumentVersion version)
ObjectStorestoreVersion in interface ObjectStorepublic void deleteVersion(DocumentVersion version)
ObjectStoredeleteVersion in interface ObjectStoreversion - version to be deletedpublic void upateObject(StoredObject so)
ObjectStoreupateObject in interface ObjectStoreso - object to be updatedpublic List<StoredObject> getCheckedOutDocuments(String orderBy, String user, IncludeRelationships includeRelationships)
ObjectStoregetCheckedOutDocuments in interface ObjectStoreorderBy - orderBy specification according to CMIS spec.user - user id of user callingincludeRelationships - if true include all relationships in the responsepublic List<StoredObject> getRelationships(String objectId, List<String> typeIds, RelationshipDirection direction)
ObjectStoregetRelationships in interface ObjectStoreobjectId - id of object to get relationships withpublic String getFolderPath(String folderId)
ObjectStoregetFolderPath in interface ObjectStorefolderId - id of folderpublic Acl applyAcl(StoredObject so, Acl addAces, Acl removeAces, AclPropagation aclPropagation, String principalId)
ObjectStoreapplyAcl in interface ObjectStoreso - object where ACLs are appliedaddAces - list of ACEs to be addedremoveAces - list of ACEs to be removedaclPropagation - enum value how to propagate ACLs to child objectspublic Acl applyAcl(StoredObject so, Acl acl, AclPropagation aclPropagation, String principalId)
ObjectStoreapplyAcl in interface ObjectStoreso - object where ACLs are appliedacl - list of ACEs to be appliedaclPropagation - enum value how to propagate ACLs to child objectspublic List<Integer> getAllAclsForUser(String principalId, Permission permission)
public Acl getAcl(int aclId)
ObjectStoregetAcl in interface ObjectStoreaclId - id of ACLpublic int getAclId(StoredObjectImpl so, Acl addACEs, Acl removeACEs)
public ObjectStoreFiling.ChildrenResult getChildren(Folder folder, int maxItems, int skipCount, String user, boolean usePwc)
ObjectStoreFilinggetChildren in interface ObjectStoreFilingfolder - folder to get children frommaxItems - max. number of items to returnskipCount - initial offset where to start fetchinguser - user to determine visible childrenusePwc - if true return private working copy otherwise return latest version;public ObjectStoreFiling.ChildrenResult getFolderChildren(Folder folder, int maxItems, int skipCount, String user)
ObjectStoreFilinggetFolderChildren in interface ObjectStoreFilingfolder - folder to get children frommaxItems - max. number of items to returnskipCount - initial offset where to start fetchingpublic void move(StoredObject so, Folder oldParent, Folder newParent)
ObjectStoreFilingmove in interface ObjectStoreFilingso - object to be movedoldParent - old parent folder for the objectnewParent - new parent folder for the objectpublic void rename(Fileable so, String newName)
ObjectStoreFilingrename in interface ObjectStoreFilingso - object to be renamednewName - new name to be assignedpublic List<String> getParentIds(Filing fileable, String user)
ObjectStoreFilinggetParentIds in interface ObjectStoreFilinguser - user who can see parentspublic boolean hasReadAccess(String principalId, StoredObject so)
public boolean hasWriteAccess(String principalId, StoredObject so)
public boolean hasAllAccess(String principalId, StoredObject so)
public void checkReadAccess(String principalId, StoredObject so)
public void checkWriteAccess(String principalId, StoredObject so)
public void checkAllAccess(String principalId, StoredObject so)
public boolean isTypeInUse(String typeId)
ObjectStoreisTypeInUse in interface ObjectStoretypeId - id of type definition to checkpublic void addParent(StoredObject so, Folder parent)
ObjectStoreMultiFilingaddParent in interface ObjectStoreMultiFilingpublic void removeParent(StoredObject so, Folder parent)
ObjectStoreMultiFilingremoveParent in interface ObjectStoreMultiFilingCopyright © 2009-2013 The Apache Software Foundation. All Rights Reserved.