org.opencms.test
Class OpenCmsTestResourceStorage

java.lang.Object
  extended by org.opencms.test.OpenCmsTestResourceStorage

public class OpenCmsTestResourceStorage
extends Object

Storage object for storing all attributes of vfs resources.


Field Summary
static String DEFAULT_STORAGE
          the name of the default storage.
static String GLOBAL_STORAGE
          the name of the default storage.
 
Constructor Summary
OpenCmsTestResourceStorage(String name)
          Creates a new OpenCmsTestResourceStorage.
 
Method Summary
 void add(CmsObject cms, String resourceName, CmsResource resource)
          Adds a CmsResource to the resource storage.
 OpenCmsTestResourceStorageEntry get(String resourceName)
          Gets an entry from the storage.
 String getName()
          Gets the name of the storage.
 CmsResourceState getPreCalculatedState(String resourceName)
          Gets an precalculate resource state from the storage.
 String getSourceNameMapping()
          Returns the source name mapping.
 String getTargetNameMapping()
          Returns the target name mapping.
 String mapResourcename(String resourceName)
          Does the name mapping of a resourceName.
 void resetMapping()
          Resets the mapping for resourcenames.
 void setMapping(String source, String target)
          Sets the mapping for resourcenames.
 int size()
          Returns the size of the storage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_STORAGE

public static String DEFAULT_STORAGE
the name of the default storage.


GLOBAL_STORAGE

public static String GLOBAL_STORAGE
the name of the default storage.

Constructor Detail

OpenCmsTestResourceStorage

public OpenCmsTestResourceStorage(String name)
Creates a new OpenCmsTestResourceStorage.

Parameters:
name - the name of the storage
Method Detail

add

public void add(CmsObject cms,
                String resourceName,
                CmsResource resource)
         throws CmsException
Adds a CmsResource to the resource storage.

Parameters:
cms - the CmsObject
resourceName - the resource name to add
resource - the resource to add
Throws:
CmsException - if something goes wrong

get

public OpenCmsTestResourceStorageEntry get(String resourceName)
                                    throws Exception
Gets an entry from the storage.

Parameters:
resourceName - the name of the resource to get
Returns:
OpenCmsTestResourceStorageEntry with all the attributes of a CmsResource
Throws:
Exception - in case something goes wrong

getName

public String getName()
Gets the name of the storage.

Returns:
the name of the storage

size

public int size()
Returns the size of the storage.

Returns:
the size of the storage

getPreCalculatedState

public CmsResourceState getPreCalculatedState(String resourceName)
                                       throws Exception
Gets an precalculate resource state from the storage.

Parameters:
resourceName - the name of the resource to get the state
Returns:
precalculated resource state
Throws:
Exception - in case something goes wrong

getSourceNameMapping

public String getSourceNameMapping()
Returns the source name mapping.

Returns:
the source name mapping

getTargetNameMapping

public String getTargetNameMapping()
Returns the target name mapping.

Returns:
the the target name mapping

setMapping

public void setMapping(String source,
                       String target)
Sets the mapping for resourcenames.

Parameters:
source - the source resource name
target - the target resource name

resetMapping

public void resetMapping()
Resets the mapping for resourcenames.


mapResourcename

public String mapResourcename(String resourceName)
Does the name mapping of a resourceName.

This is required to find resources in the resource storage afer their path in the vfs has changed (e.g. after a copy operation).

Parameters:
resourceName - the resource name to map
Returns:
mapped resource name