org.opencms.file.wrapper
Class CmsResourceWrapperPropertyFile

java.lang.Object
  extended by org.opencms.file.wrapper.A_CmsResourceWrapper
      extended by org.opencms.file.wrapper.CmsResourceWrapperPropertyFile
All Implemented Interfaces:
I_CmsResourceWrapper

public class CmsResourceWrapperPropertyFile
extends A_CmsResourceWrapper

Adds a folder in every existing folder with the name "__properties" which contains property files for every resource in the existing folder.

Empty folders don't have the property folder visible.

The names of the property files are the same as the resource they belong to with the extension "properties". To keep the correct sorting the names of folders gets additionaly the prefix "__" to keep them at the beginning of the list.

When creating new folders, the property folder gets visible after a time period of 60 seconds. For new resources the property file appears after that period too. In this time period it is possible to create the property folder and the property files manually. The properties in the created property files will be set at the resource they belong to.

Since:
6.5.6
Version:
$Revision: 1.9 $
Author:
Peter Bonrad

Field Summary
 
Fields inherited from class org.opencms.file.wrapper.A_CmsResourceWrapper
m_isWrappedResource
 
Constructor Summary
CmsResourceWrapperPropertyFile()
           
 
Method Summary
 java.util.List addResourcesToFolder(CmsObject cms, java.lang.String resourcename, CmsResourceFilter filter)
          Here it is possible to add additional (virtual) child resources to those already existing in the VFS.
 CmsResource createResource(CmsObject cms, java.lang.String resourcename, int type, byte[] content, java.util.List properties)
          Creates a new resource of the given resource type with the provided content and properties.
 boolean deleteResource(CmsObject cms, java.lang.String resourcename, CmsResource.CmsResourceDeleteMode siblingMode)
          Deletes a resource given its name.
 CmsLock getLock(CmsObject cms, CmsResource resource)
          Returns the lock for the resource.
 boolean isWrappedResource(CmsObject cms, CmsResource res)
          Is called to check if the given resource is handled by this wrapper.
 boolean lockResource(CmsObject cms, java.lang.String resourcename)
          Locks a resource.
 CmsFile readFile(CmsObject cms, java.lang.String resourcename, CmsResourceFilter filter)
          Reads a file resource (including it's binary content) from the VFS, using the specified resource filter.
 CmsResource readResource(CmsObject cms, java.lang.String resourcename, CmsResourceFilter filter)
          Reads a resource from the VFS, using the specified resource filter.
 java.lang.String restoreLink(CmsObject cms, java.lang.String uri)
          Returns the link to a existing resource in the VFS for the uri.
 boolean unlockResource(CmsObject cms, java.lang.String resourcename)
          Unlocks a resource.
 CmsFile writeFile(CmsObject cms, CmsFile resource)
          Writes a resource, including it's content.
 
Methods inherited from class org.opencms.file.wrapper.A_CmsResourceWrapper
copyResource, moveResource, rewriteLink, wrapResource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CmsResourceWrapperPropertyFile

public CmsResourceWrapperPropertyFile()
Method Detail

addResourcesToFolder

public java.util.List addResourcesToFolder(CmsObject cms,
                                           java.lang.String resourcename,
                                           CmsResourceFilter filter)
                                    throws CmsException
Description copied from interface: I_CmsResourceWrapper
Here it is possible to add additional (virtual) child resources to those already existing in the VFS.

Specified by:
addResourcesToFolder in interface I_CmsResourceWrapper
Overrides:
addResourcesToFolder in class A_CmsResourceWrapper
Parameters:
cms - the current users OpenCms context
resourcename - the full path of the resource where to add the child resources for
filter - the resource filter to use
Returns:
a list of all additionaly child CmsResources
Throws:
CmsException - if something goes wrong
See Also:
A_CmsResourceWrapper.addResourcesToFolder(CmsObject, String, CmsResourceFilter)

createResource

public CmsResource createResource(CmsObject cms,
                                  java.lang.String resourcename,
                                  int type,
                                  byte[] content,
                                  java.util.List properties)
                           throws CmsException,
                                  CmsIllegalArgumentException
Description copied from interface: I_CmsResourceWrapper
Creates a new resource of the given resource type with the provided content and properties.

First should be a check if the resourcename is handled by this resource wrapper.

It is possible that the path in the resourcename is a virtual path and so has to be translated into a valid path existing in the VFS to create the resource.

Specified by:
createResource in interface I_CmsResourceWrapper
Overrides:
createResource in class A_CmsResourceWrapper
Parameters:
cms - the initialized CmsObject
resourcename - the name of the resource to create (full path)
type - the type of the resource to create
content - the content for the new resource
properties - the properties for the new resource
Returns:
the created resource or null if not handled by this resource wrapper
Throws:
CmsException - if something goes wrong
CmsIllegalArgumentException - if the source argument is null or of length 0
See Also:
A_CmsResourceWrapper.createResource(org.opencms.file.CmsObject, java.lang.String, int, byte[], java.util.List)

deleteResource

public boolean deleteResource(CmsObject cms,
                              java.lang.String resourcename,
                              CmsResource.CmsResourceDeleteMode siblingMode)
                       throws CmsException
Description copied from interface: I_CmsResourceWrapper
Deletes a resource given its name.

First should be a check if the resourcename is handled by this resource wrapper.

It is possible that the path in the resourcename is a virtual path and so has to be translated into a valid path existing in the VFS to delete the resource.

Specified by:
deleteResource in interface I_CmsResourceWrapper
Overrides:
deleteResource in class A_CmsResourceWrapper
Parameters:
cms - the initialized CmsObject
resourcename - the name of the resource to delete
siblingMode - indicates how to handle siblings of the deleted resource
Returns:
true if the delete action was handled by this resource wrapper otherwise false
Throws:
CmsException - if something goes wrong
See Also:
A_CmsResourceWrapper.deleteResource(org.opencms.file.CmsObject, java.lang.String, org.opencms.file.CmsResource.CmsResourceDeleteMode)

getLock

public CmsLock getLock(CmsObject cms,
                       CmsResource resource)
                throws CmsException
Description copied from interface: I_CmsResourceWrapper
Returns the lock for the resource.

First should be a check if the resource is handled by this resource wrapper.

It is possible that the path in the resource is a virtual path and so has to be translated into a valid path existing in the VFS to get the lock for the resource.

Specified by:
getLock in interface I_CmsResourceWrapper
Overrides:
getLock in class A_CmsResourceWrapper
Parameters:
cms - the initialized CmsObject
resource - the resource to check the lock for
Returns:
the lock state of the resource or null if the action couldn't be handled by this resource wrapper
Throws:
CmsException - if something goes wrong
See Also:
A_CmsResourceWrapper.getLock(org.opencms.file.CmsObject, org.opencms.file.CmsResource)

isWrappedResource

public boolean isWrappedResource(CmsObject cms,
                                 CmsResource res)
Description copied from interface: I_CmsResourceWrapper
Is called to check if the given resource is handled by this wrapper.

Parameters:
cms - the initialized CmsObject
res - the resource to check
Returns:
true if the resource will be handled by the wrapper otherwise false
See Also:
I_CmsResourceWrapper.isWrappedResource(org.opencms.file.CmsObject, org.opencms.file.CmsResource)

lockResource

public boolean lockResource(CmsObject cms,
                            java.lang.String resourcename)
                     throws CmsException
Description copied from interface: I_CmsResourceWrapper
Locks a resource.

First should be a check if the resourcename is handled by this resource wrapper.

It is possible that the path in the resourcename is a virtual path and so has to be translated into a valid path existing in the VFS to lock the resource.

Specified by:
lockResource in interface I_CmsResourceWrapper
Overrides:
lockResource in class A_CmsResourceWrapper
Parameters:
cms - the current users OpenCms context
resourcename - the name of the resource to lock (full path)
Returns:
true if this request could be handled by this wrapper or false if not
Throws:
CmsException - if something goes wrong
See Also:
A_CmsResourceWrapper.lockResource(org.opencms.file.CmsObject, java.lang.String)

readFile

public CmsFile readFile(CmsObject cms,
                        java.lang.String resourcename,
                        CmsResourceFilter filter)
                 throws CmsException
Description copied from interface: I_CmsResourceWrapper
Reads a file resource (including it's binary content) from the VFS, using the specified resource filter.

First should be a check if the resourcename is handled by this resource wrapper.

It is possible that the path in the resourcename is a virtual path and so has to be translated into a valid path existing in the VFS to read the resource.

Specified by:
readFile in interface I_CmsResourceWrapper
Overrides:
readFile in class A_CmsResourceWrapper
Parameters:
cms - the current users OpenCms context
resourcename - the name of the resource to read (full path)
filter - the resource filter to use while reading
Returns:
the file resource that was read or null if it could not be handled by this resource wrapper
Throws:
CmsException - if the file resource could not be read for any reason
See Also:
A_CmsResourceWrapper.readFile(org.opencms.file.CmsObject, java.lang.String, org.opencms.file.CmsResourceFilter)

readResource

public CmsResource readResource(CmsObject cms,
                                java.lang.String resourcename,
                                CmsResourceFilter filter)
                         throws CmsException
Description copied from interface: I_CmsResourceWrapper
Reads a resource from the VFS, using the specified resource filter.

First should be a check if the resourcename is handled by this resource wrapper.

It is possible that the path in the resourcename is a virtual path and so has to be translated into a valid path existing in the VFS to read the resource.

Specified by:
readResource in interface I_CmsResourceWrapper
Overrides:
readResource in class A_CmsResourceWrapper
Parameters:
cms - the current users OpenCms context
resourcename - The name of the resource to read (full path)
filter - the resource filter to use while reading
Returns:
the resource that was read or null if it could not be handled by this resource wrapper
Throws:
CmsException - if the resource could not be read for any reason
See Also:
A_CmsResourceWrapper.readResource(org.opencms.file.CmsObject, java.lang.String, org.opencms.file.CmsResourceFilter)

restoreLink

public java.lang.String restoreLink(CmsObject cms,
                                    java.lang.String uri)
Description copied from interface: I_CmsResourceWrapper
Returns the link to a existing resource in the VFS for the uri.

Turns the virtual path into a real path to a resource in the VFS.

Specified by:
restoreLink in interface I_CmsResourceWrapper
Overrides:
restoreLink in class A_CmsResourceWrapper
Parameters:
cms - the initialized CmsObject
uri - the (virtual) uri to be restored
Returns:
the uri where to find the resource in the VFS or null if the wrapper is not responsible
See Also:
A_CmsResourceWrapper.restoreLink(org.opencms.file.CmsObject, java.lang.String)

unlockResource

public boolean unlockResource(CmsObject cms,
                              java.lang.String resourcename)
                       throws CmsException
Description copied from interface: I_CmsResourceWrapper
Unlocks a resource.

First should be a check if the resourcename is handled by this resource wrapper.

It is possible that the path in the resourcename is a virtual path and so has to be translated into a valid path existing in the VFS to unlock the resource.

Specified by:
unlockResource in interface I_CmsResourceWrapper
Overrides:
unlockResource in class A_CmsResourceWrapper
Parameters:
cms - the current users OpenCms context
resourcename - the name of the resource to unlock (full path)
Returns:
true if this request could be handled by this wrapper of false if not
Throws:
CmsException - if something goes wrong
See Also:
A_CmsResourceWrapper.unlockResource(org.opencms.file.CmsObject, java.lang.String)

writeFile

public CmsFile writeFile(CmsObject cms,
                         CmsFile resource)
                  throws CmsException
Description copied from interface: I_CmsResourceWrapper
Writes a resource, including it's content.

First should be a check if the resource is handled by this resource wrapper.

It is possible that the path in the resource is a virtual path and so has to be translated into a valid path existing in the VFS to write the resource.

Specified by:
writeFile in interface I_CmsResourceWrapper
Overrides:
writeFile in class A_CmsResourceWrapper
Parameters:
cms - the current cms context
resource - the resource to apply this operation to
Returns:
the written resource or null if the action could not be handled by this resource wrapper
Throws:
CmsException - if something goes wrong
See Also:
A_CmsResourceWrapper.writeFile(org.opencms.file.CmsObject, org.opencms.file.CmsFile)