|
||||||||||
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(String repositoryId)
|
Method Summary | |
---|---|
void |
clear()
Clear repository and remove all data. |
Document |
createDocument(String name)
Create a document as initial step. |
Folder |
createFolder(String name)
Create a folder as initial step. |
VersionedDocument |
createVersionedDocument(String name)
Create a document that supports versions as initial step. |
void |
deleteObject(String objectId)
Deletes an object from the store. |
List<StoredObject> |
getCheckedOutDocuments(String orderBy)
Return a list of all documents that are checked out in the repository. |
Set<String> |
getIds()
|
StoredObject |
getObjectById(String objectId)
get an object by its id |
StoredObject |
getObjectByPath(String path)
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)
|
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(String repositoryId)
Method Detail |
---|
public void lock()
public void unlock()
public Folder getRootFolder()
ObjectStore
getRootFolder
in interface ObjectStore
public StoredObject getObjectByPath(String path)
ObjectStore
getObjectByPath
in interface ObjectStore
path
- the path to the object
public StoredObject getObjectById(String objectId)
ObjectStore
getObjectById
in interface ObjectStore
objectId
- the id of the object
public void deleteObject(String objectId)
ObjectStore
deleteObject
in interface ObjectStore
public void removeVersion(DocumentVersion vers)
public String storeObject(StoredObject so)
public Set<String> getIds()
public void clear()
clear
in interface ObjectStore
public long getObjectCount()
ObjectStore
getObjectCount
in interface ObjectStore
public Document createDocument(String name)
ObjectStore
createDocument
in interface ObjectStore
name
- name of the document
public VersionedDocument createVersionedDocument(String name)
ObjectStore
createVersionedDocument
in interface ObjectStore
name
- name of the document
public Folder createFolder(String name)
ObjectStore
createFolder
in interface ObjectStore
name
- name of the folder
public List<StoredObject> getCheckedOutDocuments(String orderBy)
ObjectStore
getCheckedOutDocuments
in interface ObjectStore
orderBy
- orderBy specification according to CMIS spec.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |