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()
ObjectStore
getRootFolder
in interface ObjectStore
public StoredObject getObjectByPath(String path, String user)
ObjectStore
getObjectByPath
in interface ObjectStore
path
- the path to the objectpublic StoredObject getObjectById(String objectId)
ObjectStore
getObjectById
in interface ObjectStore
objectId
- the id of the objectpublic void deleteObject(String objectId, Boolean allVersions, String user)
ObjectStore
deleteObject
in interface ObjectStore
allVersions
- is TRUE all version of the document are deleted, otherwise just this onepublic String storeObject(StoredObject so)
public void clear()
clear
in interface ObjectStore
public long getObjectCount()
ObjectStore
getObjectCount
in interface ObjectStore
public Document createDocument(String name, Map<String,PropertyData<?>> propMap, String user, Folder folder, List<String> policies, Acl addACEs, Acl removeACEs)
ObjectStore
createDocument
in interface ObjectStore
name
- 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)
ObjectStore
createItem
in interface ObjectStore
name
- 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)
ObjectStore
createVersionedDocument
in interface ObjectStore
name
- 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)
ObjectStore
createFolder
in interface ObjectStore
name
- 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)
ObjectStore
createPolicy
in interface ObjectStore
name
- 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)
ObjectStore
createRelationship
in interface ObjectStore
sourceObject
- 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)
ObjectStore
storeVersion
in interface ObjectStore
public void deleteVersion(DocumentVersion version)
ObjectStore
deleteVersion
in interface ObjectStore
version
- version to be deletedpublic void upateObject(StoredObject so)
ObjectStore
upateObject
in interface ObjectStore
so
- object to be updatedpublic List<StoredObject> getCheckedOutDocuments(String orderBy, String user, IncludeRelationships includeRelationships)
ObjectStore
getCheckedOutDocuments
in interface ObjectStore
orderBy
- 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)
ObjectStore
getRelationships
in interface ObjectStore
objectId
- id of object to get relationships withpublic String getFolderPath(String folderId)
ObjectStore
getFolderPath
in interface ObjectStore
folderId
- id of folderpublic Acl applyAcl(StoredObject so, Acl addAces, Acl removeAces, AclPropagation aclPropagation, String principalId)
ObjectStore
applyAcl
in interface ObjectStore
so
- 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)
ObjectStore
applyAcl
in interface ObjectStore
so
- 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)
ObjectStore
getAcl
in interface ObjectStore
aclId
- 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)
ObjectStoreFiling
getChildren
in interface ObjectStoreFiling
folder
- 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)
ObjectStoreFiling
getFolderChildren
in interface ObjectStoreFiling
folder
- 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)
ObjectStoreFiling
move
in interface ObjectStoreFiling
so
- object to be movedoldParent
- old parent folder for the objectnewParent
- new parent folder for the objectpublic void rename(Fileable so, String newName)
ObjectStoreFiling
rename
in interface ObjectStoreFiling
so
- object to be renamednewName
- new name to be assignedpublic List<String> getParentIds(Filing fileable, String user)
ObjectStoreFiling
getParentIds
in interface ObjectStoreFiling
user
- 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)
ObjectStore
isTypeInUse
in interface ObjectStore
typeId
- id of type definition to checkpublic void addParent(StoredObject so, Folder parent)
ObjectStoreMultiFiling
addParent
in interface ObjectStoreMultiFiling
public void removeParent(StoredObject so, Folder parent)
ObjectStoreMultiFiling
removeParent
in interface ObjectStoreMultiFiling
Copyright © 2009-2013 The Apache Software Foundation. All Rights Reserved.