public class MemoryStorage extends AbstractTreeStorage
Constructor and Description |
---|
MemoryStorage() |
MemoryStorage(java.util.UUID root) |
Modifier and Type | Method and Description |
---|---|
boolean |
canLoad(java.util.UUID uuid)
Method to check if node with given UUID can be loaded from this storage
|
void |
changeNodeId(java.util.UUID uuid,
java.lang.String id)
Change id of node
|
void |
createStorage(java.lang.String name)
Method to be called during new storage creation.
|
void |
createStorageNode(java.util.UUID parentUUId,
java.util.UUID uuid,
java.lang.String id,
java.util.Map<java.lang.String,AttributeDefinition> attrs) |
void |
deleteResource(java.util.UUID uuid,
java.lang.String resName)
Delete resource with given name from node
|
void |
deleteStorage()
Delete storage
|
void |
emulateDeltaChanged(java.util.UUID uuid,
ChangesSet<Attribute> what,
java.util.Map<java.lang.String,AttributeDefinition> attributes) |
void |
emulateDeltaCreate(java.util.UUID parentUUId,
java.util.UUID uuid,
java.lang.String type,
java.lang.String id,
java.util.Map<java.lang.String,AttributeDefinition> attributes) |
void |
emulateDeltaDelete(java.util.UUID uuid) |
void |
emulateDeltaMove(java.util.UUID uuid,
java.util.UUID newParent) |
ITreeStorage |
getBaseStorage()
Get base storage.
|
java.util.Collection<java.util.UUID> |
getChildren(java.util.UUID uuid)
Get list of children UUIDs for given node in tree
|
java.nio.file.Path |
getLocation()
Get location of storage if any.
|
java.lang.String |
getName()
Get name - string identifier of storage.
|
java.lang.String |
getNodeId(java.util.UUID uuid)
Get id of node with given UUUID
|
java.net.URI |
getNodeResourcePath(java.util.UUID uuId)
Get path for node with given UUID where resources are located
|
java.util.UUID |
getParent(java.util.UUID uuid)
Get UUID of parent element of node with given UUID in tree
|
java.io.File |
getResource(java.util.UUID uuid,
java.lang.String name)
Get resource from node with given UUID in form of File
|
java.io.InputStream |
getResourceContents(java.util.UUID uuid,
java.lang.String resName)
Get content of resource from node with given UUID if it exists
|
java.util.UUID |
getRootNode()
Get UUID of root node of tree
|
java.util.Map<java.lang.String,AttributeDefinition> |
getStorageAttributes(java.util.UUID uuid) |
boolean |
isResourceExists(java.util.UUID uuid,
java.lang.String resName)
Method to check if some resource exists on node with given UUID
|
java.util.Set<java.lang.String> |
listResources(java.util.UUID uuid)
List names of resources from node with given UUID
|
void |
moveNodeTo(java.util.UUID node,
java.util.UUID parent)
Move node with given UUID to new parent
|
void |
remove(java.util.UUID uuid)
Remove attribute with given UUID
|
void |
saveStorageAttributes(java.util.UUID uuid,
ChangesSet<Attribute> changes) |
void |
setResourceContents(java.util.UUID uuid,
java.lang.String resName,
java.io.InputStream in,
java.lang.Object data)
Set content of resource on node with given UUID.
|
clearCachedCache, clearCaches, createNode, createNode, getAttributes, getCacheStorage, getDeltaTarget, getNodeRawType, getRootStorage, getVersions, getVersionsStorage, saveAttributes, saveVersions, setDeltaTarget
public MemoryStorage()
public MemoryStorage(java.util.UUID root)
public void emulateDeltaCreate(java.util.UUID parentUUId, java.util.UUID uuid, java.lang.String type, java.lang.String id, java.util.Map<java.lang.String,AttributeDefinition> attributes)
public void emulateDeltaDelete(java.util.UUID uuid)
public void emulateDeltaMove(java.util.UUID uuid, java.util.UUID newParent)
public void emulateDeltaChanged(java.util.UUID uuid, ChangesSet<Attribute> what, java.util.Map<java.lang.String,AttributeDefinition> attributes)
public java.util.UUID getRootNode()
ITreeStorage
getRootNode
in interface ITreeStorage
getRootNode
in class AbstractTreeStorage
public java.lang.String getNodeId(java.util.UUID uuid)
ITreeStorage
getNodeId
in interface ITreeStorage
getNodeId
in class AbstractTreeStorage
uuid
- UUID of nodepublic void createStorageNode(java.util.UUID parentUUId, java.util.UUID uuid, java.lang.String id, java.util.Map<java.lang.String,AttributeDefinition> attrs)
public void remove(java.util.UUID uuid)
ITreeStorage
remove
in interface ITreeStorage
remove
in class AbstractTreeStorage
uuid
- UUID of node to be removepublic java.util.Map<java.lang.String,AttributeDefinition> getStorageAttributes(java.util.UUID uuid)
getStorageAttributes
in class AbstractTreeStorage
public java.util.Collection<java.util.UUID> getChildren(java.util.UUID uuid)
ITreeStorage
getChildren
in interface ITreeStorage
getChildren
in class AbstractTreeStorage
uuid
- UUID of nodepublic java.util.UUID getParent(java.util.UUID uuid)
ITreeStorage
getParent
in interface ITreeStorage
getParent
in class AbstractTreeStorage
uuid
- UUID of nodepublic boolean canLoad(java.util.UUID uuid)
ITreeStorage
canLoad
in interface ITreeStorage
canLoad
in class AbstractTreeStorage
uuid
- UUID of nodepublic void changeNodeId(java.util.UUID uuid, java.lang.String id)
ITreeStorage
changeNodeId
in interface ITreeStorage
changeNodeId
in class AbstractTreeStorage
uuid
- UUID of nodeid
- string identifierpublic void moveNodeTo(java.util.UUID node, java.util.UUID parent)
ITreeStorage
moveNodeTo
in interface ITreeStorage
moveNodeTo
in class AbstractTreeStorage
node
- UUID of nodeparent
- UUID of new parentpublic void saveStorageAttributes(java.util.UUID uuid, ChangesSet<Attribute> changes)
saveStorageAttributes
in class AbstractTreeStorage
public java.net.URI getNodeResourcePath(java.util.UUID uuId)
ITreeStorage
getNodeResourcePath
in interface ITreeStorage
getNodeResourcePath
in class AbstractTreeStorage
uuId
- UUID of nodepublic java.io.InputStream getResourceContents(java.util.UUID uuid, java.lang.String resName)
ITreeStorage
getResourceContents
in interface ITreeStorage
getResourceContents
in class AbstractTreeStorage
uuid
- UUID of noderesName
- name of resourcepublic void setResourceContents(java.util.UUID uuid, java.lang.String resName, java.io.InputStream in, java.lang.Object data)
ITreeStorage
setResourceContents
in interface ITreeStorage
setResourceContents
in class AbstractTreeStorage
uuid
- UUID of noderesName
- name of resourcein
- new content of resourcedata
- additional datapublic boolean isResourceExists(java.util.UUID uuid, java.lang.String resName)
ITreeStorage
isResourceExists
in interface ITreeStorage
isResourceExists
in class AbstractTreeStorage
uuid
- UUID of noderesName
- name of resource to checkpublic void deleteResource(java.util.UUID uuid, java.lang.String resName)
ITreeStorage
deleteResource
in interface ITreeStorage
deleteResource
in class AbstractTreeStorage
uuid
- UUID of noderesName
- name of resourcepublic java.util.Set<java.lang.String> listResources(java.util.UUID uuid)
ITreeStorage
listResources
in interface ITreeStorage
listResources
in class AbstractTreeStorage
uuid
- UUID of nodepublic void createStorage(java.lang.String name)
ITreeStorage
createStorage
in interface ITreeStorage
createStorage
in class AbstractTreeStorage
name
- name of future storagepublic void deleteStorage()
ITreeStorage
deleteStorage
in interface ITreeStorage
deleteStorage
in class AbstractTreeStorage
public java.lang.String getName()
ITreeStorage
getName
in interface ITreeStorage
getName
in class AbstractTreeStorage
public ITreeStorage getBaseStorage()
ITreeStorage
public java.io.File getResource(java.util.UUID uuid, java.lang.String name)
ITreeStorage
uuid
- UUID of nodename
- name of resourcepublic java.nio.file.Path getLocation()
ITreeStorage