Package org.silverpeas.core.io.temp
Class TemporaryWorkspaceTranslation
- java.lang.Object
-
- org.silverpeas.core.io.temp.TemporaryWorkspaceTranslation
-
public class TemporaryWorkspaceTranslation extends Object
If a treatment uses a real resource identifier for a temporary resource, it is possible that someone else accesses this temporary resource without any right.
So, this class provides a set of tool to handle workspace which the root path of the workspace is translated.- Author:
- Yohann Chastagnier
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
create()
Create the workspace.boolean
empty()
Indicates if the workspace is empty.boolean
exists()
Indicates if the workspace exists.static TemporaryWorkspaceTranslation
from(String identifier)
Gets an instance from the given identifier.<T extends Serializable>
Tget(String key)
Gets from context a value from a key that has been stored into the context instance.File
getRootPath()
Gets the root path of the workspace.boolean
isWorkInProgress()
long
lastModified()
Gets the last time the workspace was modified.void
markWorkInProgress()
TemporaryWorkspaceTranslation
put(String key, Serializable value)
Puts into workspace a string value linked to a key.boolean
remove()
Removes the workspace from the filesystem.static boolean
startWithTranslationDescriptorPrefix(String path)
Indicates if the given path corresponds to a temporary workspace translation.String
toString()
void
updateLastModifiedDate()
Updates the last modified date of workspace.
-
-
-
Method Detail
-
startWithTranslationDescriptorPrefix
public static boolean startWithTranslationDescriptorPrefix(String path)
Indicates if the given path corresponds to a temporary workspace translation.- Parameters:
path
- the path to verify.- Returns:
- true if the given path is a translation, false otherwise.
-
from
public static TemporaryWorkspaceTranslation from(String identifier)
Gets an instance from the given identifier.- Parameters:
identifier
- an identifier.- Returns:
- an instance of
TemporaryWorkspaceTranslation
.
-
remove
public boolean remove()
Removes the workspace from the filesystem.- Returns:
- true if deletion is completely effective, false otherwise.
-
exists
public boolean exists()
Indicates if the workspace exists.- Returns:
- true if it exists, false otherwise.
-
empty
public boolean empty()
Indicates if the workspace is empty.- Returns:
- true if it is empty, false otherwise.
-
lastModified
public long lastModified()
Gets the last time the workspace was modified.- Returns:
-
updateLastModifiedDate
public void updateLastModifiedDate()
Updates the last modified date of workspace.
-
getRootPath
public File getRootPath()
Gets the root path of the workspace.- Returns:
-
create
public void create()
Create the workspace.
-
markWorkInProgress
public void markWorkInProgress()
-
isWorkInProgress
public boolean isWorkInProgress()
-
put
public TemporaryWorkspaceTranslation put(String key, Serializable value)
Puts into workspace a string value linked to a key.- Parameters:
key
- the key.value
- the value.- Returns:
- the current instance.
-
get
public <T extends Serializable> T get(String key)
Gets from context a value from a key that has been stored into the context instance.- Parameters:
key
- the key associated to the searched value.- Returns:
- the value if any, null if the expected type does not match with the one of the existing value.
-
-