public class TransactionStorage extends AbstractTreeStorage
Modifier and Type | Class and Description |
---|---|
class |
TransactionStorage.OperationData |
Constructor and Description |
---|
TransactionStorage(ITreeStorage storage,
TreeInstancer vstorage,
java.util.List<ITransactionListener> tListeners) |
Modifier and Type | Method and Description |
---|---|
void |
apply() |
void |
apply(ITreeStorage aStorage) |
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 newNodeId)
Change id of node
|
void |
clearCachedCache(java.util.UUID uid)
Clear inner caches for node with given UUID
|
void |
clearCaches()
Clear all inner caches
|
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 |
dispose() |
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.util.LinkedList<TransactionStorage.OperationData> |
getLastOperationsData() |
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 resName)
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
|
ITreeStorage |
getStorage() |
java.util.Map<java.lang.String,AttributeDefinition> |
getStorageAttributes(java.util.UUID uuid) |
java.util.Map<java.lang.String,Version> |
getVersions(java.util.UUID uuid)
Get versions objects related to node with given UUID
|
ITreeStorage |
getVStorage() |
boolean |
isResourceExists(java.util.UUID uuid,
java.lang.String resName)
Method to check if some resource exists on node with given UUID
|
boolean |
isResourceInTransaction(java.util.UUID uuid,
java.lang.String resName) |
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 uuid,
java.util.UUID newParent)
Move node with given UUID to new parent
|
void |
remove(java.util.UUID uuid)
Remove attribute with given UUID
|
void |
rollback() |
void |
rollback(ITreeStorage aStorage) |
void |
saveStorageAttributes(java.util.UUID uuid,
ChangesSet<Attribute> changes) |
void |
saveVersions(java.util.UUID uuid,
ChangesSet<Version> changes)
Save versions for given node.
|
void |
setName(java.lang.String name) |
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.
|
createNode, createNode, getAttributes, getCacheStorage, getDeltaTarget, getNodeRawType, getRootStorage, getVersionsStorage, saveAttributes, setDeltaTarget
public TransactionStorage(ITreeStorage storage, TreeInstancer vstorage, java.util.List<ITransactionListener> tListeners)
public java.util.Map<java.lang.String,Version> getVersions(java.util.UUID uuid)
ITreeStorage
getVersions
in interface ITreeStorage
getVersions
in class AbstractTreeStorage
uuid
- UUID of nodepublic void saveVersions(java.util.UUID uuid, ChangesSet<Version> changes)
ITreeStorage
saveVersions
in interface ITreeStorage
saveVersions
in class AbstractTreeStorage
uuid
- UUID of nodechanges
- set of changed versionspublic java.lang.String getName()
ITreeStorage
getName
in interface ITreeStorage
getName
in class AbstractTreeStorage
public void setName(java.lang.String name)
public java.util.UUID getRootNode()
ITreeStorage
getRootNode
in interface ITreeStorage
getRootNode
in class AbstractTreeStorage
public java.util.UUID getParent(java.util.UUID uuid)
ITreeStorage
getParent
in interface ITreeStorage
getParent
in class AbstractTreeStorage
uuid
- UUID of nodepublic java.lang.String getNodeId(java.util.UUID uuid)
ITreeStorage
getNodeId
in interface ITreeStorage
getNodeId
in class AbstractTreeStorage
uuid
- UUID of nodepublic 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 boolean canLoad(java.util.UUID uuid)
ITreeStorage
canLoad
in interface ITreeStorage
canLoad
in class AbstractTreeStorage
uuid
- UUID of nodepublic java.net.URI getNodeResourcePath(java.util.UUID uuId)
ITreeStorage
getNodeResourcePath
in interface ITreeStorage
getNodeResourcePath
in class AbstractTreeStorage
uuId
- UUID of nodepublic java.util.Set<java.lang.String> listResources(java.util.UUID uuid)
ITreeStorage
listResources
in interface ITreeStorage
listResources
in class AbstractTreeStorage
uuid
- UUID of nodepublic ITreeStorage getStorage()
public 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 void changeNodeId(java.util.UUID uuid, java.lang.String newNodeId)
ITreeStorage
changeNodeId
in interface ITreeStorage
changeNodeId
in class AbstractTreeStorage
uuid
- UUID of nodenewNodeId
- string identifierpublic void saveStorageAttributes(java.util.UUID uuid, ChangesSet<Attribute> changes)
saveStorageAttributes
in class AbstractTreeStorage
public void moveNodeTo(java.util.UUID uuid, java.util.UUID newParent)
ITreeStorage
moveNodeTo
in interface ITreeStorage
moveNodeTo
in class AbstractTreeStorage
uuid
- UUID of nodenewParent
- UUID of new parentpublic void apply()
public void apply(ITreeStorage aStorage)
public void rollback()
public void rollback(ITreeStorage aStorage)
public boolean isResourceInTransaction(java.util.UUID uuid, java.lang.String resName)
public 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 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 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 void dispose()
public 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.util.LinkedList<TransactionStorage.OperationData> getLastOperationsData()
public ITreeStorage getVStorage()
public ITreeStorage getBaseStorage()
ITreeStorage
public void clearCachedCache(java.util.UUID uid)
ITreeStorage
clearCachedCache
in interface ITreeStorage
clearCachedCache
in class AbstractTreeStorage
uid
- UUID of nodepublic void clearCaches()
ITreeStorage
clearCaches
in interface ITreeStorage
clearCaches
in class AbstractTreeStorage
public java.io.File getResource(java.util.UUID uuid, java.lang.String resName)
ITreeStorage
uuid
- UUID of noderesName
- name of resourcepublic java.nio.file.Path getLocation()
ITreeStorage