org.silverpeas.util.data
Class TemporaryWorkspaceTranslation

java.lang.Object
  extended by org.silverpeas.util.data.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
 void create()
          Create the workspace.
 boolean exists()
          Indicates if the workspace exists.
static TemporaryWorkspaceTranslation from(String identifier)
          Gets an instance from the given identifier.
<T extends Serializable>
T
get(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.
 long lastModified()
          Gets the last time the workspace was modified.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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.

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.


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.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2016 Silverpeas. All Rights Reserved.