public class ResourceStorage extends AbstractTreeStorage implements IUUIDsCached
Modifier and Type | Class and Description |
---|---|
static class |
ResourceStorage.ResourceMap |
Modifier and Type | Field and Description |
---|---|
boolean |
forceNow |
static java.lang.String |
RESOURCE_POSTFIX |
Constructor and Description |
---|
ResourceStorage(org.eclipse.core.resources.IProject project) |
Modifier and Type | Method and Description |
---|---|
boolean |
areUUIDsChanged() |
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 |
clearAll() |
void |
clearCachedCache(java.util.UUID uuId)
Clear inner caches for node with given UUID
|
void |
clearCaches()
Clear all inner caches
|
void |
clearPersistent(java.util.UUID uuId) |
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 name)
Delete resource with given name from node
|
void |
deleteStorage()
Delete storage
|
ITreeStorage |
getBaseStorage()
Get base storage.
|
java.util.Collection<java.util.UUID> |
getChildren(java.util.UUID parentUUId)
Get list of children UUIDs for given node in tree
|
DeltaProcessor |
getDeltaProcessor() |
java.util.UUID |
getFileUUID(org.eclipse.core.resources.IFile file) |
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(org.eclipse.core.resources.IFile file) |
java.util.UUID |
getParent(java.util.UUID uuid)
Get UUID of parent element of node with given UUID in tree
|
java.lang.String |
getPersistent(java.util.UUID uid,
java.lang.String marker,
java.lang.String key) |
java.util.Map<java.lang.String,java.lang.String> |
getPersistents(java.util.UUID uid,
java.lang.String marker,
java.util.Set<java.lang.String> keys) |
org.eclipse.core.resources.IProject |
getProject() |
org.eclipse.core.resources.IFile |
getResource(java.util.UUID uuid) |
org.eclipse.core.resources.IFile |
getResource(java.util.UUID uuid,
boolean lock) |
java.io.File |
getResource(java.util.UUID uuid,
java.lang.String resName)
Get resource from node with given UUID in form of File
|
org.eclipse.core.resources.IResourceChangeListener |
getResourceChangeListener() |
java.io.InputStream |
getResourceContents(java.util.UUID uuid,
java.lang.String resName)
Get content of resource from node with given UUID if it exists
|
org.eclipse.core.resources.IFolder |
getResourceFolder(java.util.UUID uuid) |
ResourceStorage.ResourceMap |
getResourceMap() |
java.util.UUID |
getRootNode()
Get UUID of root node of tree
|
java.util.Map<java.lang.String,AttributeDefinition> |
getStorageAttributes(java.util.UUID uuid) |
java.util.UUID |
getUUId(org.eclipse.core.resources.IFile file) |
java.util.UUID |
getUUId(org.eclipse.core.resources.IFile file,
boolean withcache) |
boolean |
inCache(org.eclipse.core.resources.IFile f) |
void |
initRoot() |
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
|
boolean |
lockProject() |
void |
moveNodeTo(java.util.UUID curNodeUUId,
java.util.UUID newParentUUId)
Move node with given UUID to new parent
|
static java.lang.String |
readFile(org.eclipse.core.resources.IFile file) |
static java.lang.String |
readFile(org.eclipse.compare.IStreamContentAccessor file) |
void |
remove(java.util.UUID uuid)
Remove attribute with given UUID
|
void |
saveStorageAttributes(java.util.UUID uuid,
ChangesSet<Attribute> changes) |
boolean |
saveUUIDs() |
void |
setPersistent(java.util.UUID uid,
java.lang.String marker,
java.lang.String key,
java.lang.String val) |
void |
setPersistents(java.util.UUID uid,
java.lang.String marker,
java.util.Map<java.lang.String,java.lang.String> vals) |
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.
|
void |
unLockProject() |
createNode, createNode, getAttributes, getCacheStorage, getDeltaTarget, getNodeRawType, getRootStorage, getVersions, getVersionsStorage, saveAttributes, saveVersions, setDeltaTarget
public static final java.lang.String RESOURCE_POSTFIX
public boolean forceNow
public ResourceStorage(org.eclipse.core.resources.IProject project)
public org.eclipse.core.resources.IResourceChangeListener getResourceChangeListener()
public DeltaProcessor getDeltaProcessor()
public org.eclipse.core.resources.IFolder getResourceFolder(java.util.UUID uuid)
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 java.util.Map<java.lang.String,AttributeDefinition> getStorageAttributes(java.util.UUID uuid)
getStorageAttributes
in class AbstractTreeStorage
public void clearCaches()
ITreeStorage
clearCaches
in interface ITreeStorage
clearCaches
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 void clearPersistent(java.util.UUID uuId)
public java.lang.String getPersistent(java.util.UUID uid, java.lang.String marker, java.lang.String key)
public java.util.Map<java.lang.String,java.lang.String> getPersistents(java.util.UUID uid, java.lang.String marker, java.util.Set<java.lang.String> keys)
public void setPersistent(java.util.UUID uid, java.lang.String marker, java.lang.String key, java.lang.String val)
public void setPersistents(java.util.UUID uid, java.lang.String marker, java.util.Map<java.lang.String,java.lang.String> vals)
public java.util.UUID getParent(org.eclipse.core.resources.IFile file)
public boolean inCache(org.eclipse.core.resources.IFile f)
public java.util.UUID getUUId(org.eclipse.core.resources.IFile file)
public java.util.UUID getUUId(org.eclipse.core.resources.IFile file, boolean withcache)
public java.util.UUID getFileUUID(org.eclipse.core.resources.IFile file)
public java.util.Collection<java.util.UUID> getChildren(java.util.UUID parentUUId)
ITreeStorage
getChildren
in interface ITreeStorage
getChildren
in class AbstractTreeStorage
parentUUId
- UUID of nodepublic boolean canLoad(java.util.UUID uuid)
ITreeStorage
canLoad
in interface ITreeStorage
canLoad
in class AbstractTreeStorage
uuid
- UUID of nodepublic static java.lang.String readFile(org.eclipse.core.resources.IFile file)
public static java.lang.String readFile(org.eclipse.compare.IStreamContentAccessor file)
public java.net.URI getNodeResourcePath(java.util.UUID uuId)
ITreeStorage
getNodeResourcePath
in interface ITreeStorage
getNodeResourcePath
in class AbstractTreeStorage
uuId
- UUID of nodepublic org.eclipse.core.resources.IProject getProject()
public 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 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.util.Set<java.lang.String> listResources(java.util.UUID uuid)
ITreeStorage
listResources
in interface ITreeStorage
listResources
in class AbstractTreeStorage
uuid
- UUID of nodepublic java.lang.String getName()
ITreeStorage
getName
in interface ITreeStorage
getName
in class AbstractTreeStorage
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 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 remove(java.util.UUID uuid)
ITreeStorage
remove
in interface ITreeStorage
remove
in class AbstractTreeStorage
uuid
- UUID of node to be removepublic void saveStorageAttributes(java.util.UUID uuid, ChangesSet<Attribute> changes)
saveStorageAttributes
in class AbstractTreeStorage
public void moveNodeTo(java.util.UUID curNodeUUId, java.util.UUID newParentUUId)
ITreeStorage
moveNodeTo
in interface ITreeStorage
moveNodeTo
in class AbstractTreeStorage
curNodeUUId
- UUID of nodenewParentUUId
- UUID of new parentpublic 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 name)
ITreeStorage
deleteResource
in interface ITreeStorage
deleteResource
in class AbstractTreeStorage
uuid
- UUID of nodename
- name of resourcepublic 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 ResourceStorage.ResourceMap getResourceMap()
public org.eclipse.core.resources.IFile getResource(java.util.UUID uuid)
public org.eclipse.core.resources.IFile getResource(java.util.UUID uuid, boolean lock)
public boolean lockProject()
public void unLockProject()
public ITreeStorage getBaseStorage()
ITreeStorage
getBaseStorage
in interface ITreeStorage
public void clearAll()
public void clearCachedCache(java.util.UUID uuId)
ITreeStorage
clearCachedCache
in interface ITreeStorage
clearCachedCache
in class AbstractTreeStorage
uuId
- UUID of nodepublic boolean saveUUIDs()
saveUUIDs
in interface IUUIDsCached
public void initRoot()
public boolean areUUIDsChanged()
areUUIDsChanged
in interface IUUIDsCached
public java.io.File getResource(java.util.UUID uuid, java.lang.String resName)
ITreeStorage
getResource
in interface ITreeStorage
uuid
- UUID of noderesName
- name of resourcepublic java.nio.file.Path getLocation()
ITreeStorage
getLocation
in interface ITreeStorage