|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.chemistry.opencmis.inmemory.storedobj.impl.ObjectStoreImpl
public class ObjectStoreImpl
The object store is the central core of the in-memory repository. It is based on huge HashMap map mapping ids to objects in memory. To allow access from multiple threads a Java concurrent HashMap is used that allows parallel access methods.
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.
Constructor Summary | |
---|---|
ObjectStoreImpl(java.lang.String repositoryId)
|
Method Summary | |
---|---|
void |
clear()
Clear repository and remove all data. |
Document |
createDocument(java.lang.String name,
java.util.Map<java.lang.String,PropertyData<?>> propMap,
java.lang.String user,
Folder folder,
Acl addACEs,
Acl removeACEs)
Create a document as initial step. |
Folder |
createFolder(java.lang.String name)
|
Folder |
createFolder(java.lang.String name,
java.util.Map<java.lang.String,PropertyData<?>> propMap,
java.lang.String user,
Folder parent,
Acl addACEs,
Acl removeACEs)
Create a folder as initial step. |
StoredObject |
createRelationship(StoredObject sourceObject,
StoredObject targetObject,
java.util.Map<java.lang.String,PropertyData<?>> propMap,
java.lang.String user,
Acl addACEs,
Acl removeACEs)
Create a relationship. |
DocumentVersion |
createVersionedDocument(java.lang.String name,
java.util.Map<java.lang.String,PropertyData<?>> propMap,
java.lang.String user,
Folder folder,
Acl addACEs,
Acl removeACEs,
ContentStream contentStream,
VersioningState versioningState)
Create a document that supports versions as initial step. |
void |
deleteObject(java.lang.String objectId,
java.lang.Boolean allVersions,
java.lang.String user)
Deletes an object from the store. |
java.util.List<StoredObject> |
getCheckedOutDocuments(java.lang.String orderBy,
java.lang.String user,
IncludeRelationships includeRelationships)
Return a list of all documents that are checked out in the repository. |
java.util.Set<java.lang.String> |
getIds()
|
StoredObject |
getObjectById(java.lang.String objectId)
get an object by its id |
StoredObject |
getObjectByPath(java.lang.String path,
java.lang.String user)
return an object by path. |
long |
getObjectCount()
For statistics: return the number of objects contained in the system |
Folder |
getRootFolder()
Get the root folder of this object store |
void |
lock()
|
void |
removeVersion(DocumentVersion vers)
|
java.lang.String |
storeObject(StoredObject so)
|
void |
unlock()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ObjectStoreImpl(java.lang.String repositoryId)
Method Detail |
---|
public void lock()
public void unlock()
public Folder getRootFolder()
ObjectStore
getRootFolder
in interface ObjectStore
public StoredObject getObjectByPath(java.lang.String path, java.lang.String user)
ObjectStore
getObjectByPath
in interface ObjectStore
path
- the path to the object
public StoredObject getObjectById(java.lang.String objectId)
ObjectStore
getObjectById
in interface ObjectStore
objectId
- the id of the object
public void deleteObject(java.lang.String objectId, java.lang.Boolean allVersions, java.lang.String user)
ObjectStore
deleteObject
in interface ObjectStore
allVersions
- is TRUE all version of the document are deleted, otherwise just this onepublic void removeVersion(DocumentVersion vers)
public java.lang.String storeObject(StoredObject so)
public java.util.Set<java.lang.String> getIds()
public void clear()
clear
in interface ObjectStore
public long getObjectCount()
ObjectStore
getObjectCount
in interface ObjectStore
public Document createDocument(java.lang.String name, java.util.Map<java.lang.String,PropertyData<?>> propMap, java.lang.String user, Folder folder, 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 folderaddACEs
- aces that are addedremoveACEs
- aces that are removed
public DocumentVersion createVersionedDocument(java.lang.String name, java.util.Map<java.lang.String,PropertyData<?>> propMap, java.lang.String user, Folder folder, 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 folderaddACEs
- aces that are addedremoveACEs
- aces that are removed
public Folder createFolder(java.lang.String name, java.util.Map<java.lang.String,PropertyData<?>> propMap, java.lang.String user, Folder parent, 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 folderaddACEs
- aces that are addedremoveACEs
- aces that are removed
public Folder createFolder(java.lang.String name)
public java.util.List<StoredObject> getCheckedOutDocuments(java.lang.String orderBy, java.lang.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 response
public StoredObject createRelationship(StoredObject sourceObject, StoredObject targetObject, java.util.Map<java.lang.String,PropertyData<?>> propMap, java.lang.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 removed
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |