|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface I_CmsResourceWrapper
Interface which is used by the CmsObjectWrapper
to create a different view to the
resources in the VFS.
It is possible to create "new" virtual resource in the view to the clients using the
CmsObjectWrapper
or to change the existing ones. For example adding the correct
file extension for resources, because it is not always given that resources of type jsp have
the extension ".jsp". A resource wrapper just could add this extension, so that clients can
handle that resource correctly.
Each method in the implementing classes first have to check in every method if it is
responsible for the action to execute, because the CmsObjectWrapper
iterates
through all configured resource wrappers and the first which feels responsible wins and the
others won't even called.
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. |
boolean |
copyResource(CmsObject cms,
java.lang.String source,
java.lang.String destination,
CmsResource.CmsResourceCopyMode siblingMode)
Copies a resource. |
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. |
boolean |
moveResource(CmsObject cms,
java.lang.String source,
java.lang.String destination)
Moves a resource to the given destination. |
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. |
java.lang.String |
rewriteLink(CmsObject cms,
CmsResource res)
Returns the link how it is for the resource after using this resource wrapper. |
boolean |
unlockResource(CmsObject cms,
java.lang.String resourcename)
Unlocks a resource. |
CmsResource |
wrapResource(CmsObject cms,
CmsResource resource)
Changes the given resource based on the implementation of this wrapper. |
CmsFile |
writeFile(CmsObject cms,
CmsFile resource)
Writes a resource, including it's content. |
Method Detail |
---|
java.util.List addResourcesToFolder(CmsObject cms, java.lang.String resourcename, CmsResourceFilter filter) throws CmsException
cms
- the current users OpenCms contextresourcename
- the full path of the resource where to add the child resources forfilter
- the resource filter to use
CmsResource
s
CmsException
- if something goes wrongCmsObjectWrapper.getResourcesInFolder(String, CmsResourceFilter)
boolean copyResource(CmsObject cms, java.lang.String source, java.lang.String destination, CmsResource.CmsResourceCopyMode siblingMode) throws CmsException, CmsIllegalArgumentException
First should be a check if the source and/or the destination are handled by this resource wrapper.
It is possible that the path in the source or in the destination are virtual paths and so has to be translated into valid paths existing in the VFS to copy the resource.
cms
- the initialized CmsObjectsource
- the name of the resource to copydestination
- the name of the copy destination with complete pathsiblingMode
- indicates how to handle siblings during copy
CmsIllegalArgumentException
- if the destination
argument is null or of length 0
CmsException
- if something goes wrongCmsObjectWrapper.copyResource(String, String, CmsResource.CmsResourceCopyMode)
,
CmsObject.copyResource(String, String, CmsResource.CmsResourceCopyMode)
CmsResource createResource(CmsObject cms, java.lang.String resourcename, int type, byte[] content, java.util.List properties) throws CmsException, CmsIllegalArgumentException
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.
cms
- the initialized CmsObjectresourcename
- the name of the resource to create (full path)type
- the type of the resource to createcontent
- the content for the new resourceproperties
- the properties for the new resource
CmsException
- if something goes wrong
CmsIllegalArgumentException
- if the source
argument is null or of length 0CmsObjectWrapper.createResource(String, int, byte[], List)
,
CmsObject.createResource(String, int, byte[], List)
boolean deleteResource(CmsObject cms, java.lang.String resourcename, CmsResource.CmsResourceDeleteMode siblingMode) throws CmsException
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.
cms
- the initialized CmsObjectresourcename
- the name of the resource to deletesiblingMode
- indicates how to handle siblings of the deleted resource
CmsException
- if something goes wrongCmsObjectWrapper.deleteResource(String, CmsResource.CmsResourceDeleteMode)
,
CmsObject.deleteResource(String, CmsResource.CmsResourceDeleteMode)
CmsLock getLock(CmsObject cms, CmsResource resource) throws CmsException
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.
cms
- the initialized CmsObjectresource
- the resource to check the lock for
CmsException
- if something goes wrongCmsObjectWrapper.getLock(CmsResource)
,
CmsObject.getLock(CmsResource)
boolean isWrappedResource(CmsObject cms, CmsResource res)
cms
- the initialized CmsObjectres
- the resource to check
CmsObjectWrapper.getResourcesInFolder(String, CmsResourceFilter)
boolean lockResource(CmsObject cms, java.lang.String resourcename) throws CmsException
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.
cms
- the current users OpenCms contextresourcename
- the name of the resource to lock (full path)
CmsException
- if something goes wrongCmsObjectWrapper.lockResource(String)
,
CmsObject.lockResource(String)
boolean moveResource(CmsObject cms, java.lang.String source, java.lang.String destination) throws CmsException, CmsIllegalArgumentException
First should be a check if the source and/or the destination are handled by this resource wrapper.
It is possible that the path in the source or in the destination are virtual paths and so has to be translated into valid paths existing in the VFS to move the resource.
cms
- the current cms contextsource
- the name of the resource to movedestination
- the destination resource name
CmsException
- if something goes wrong
CmsIllegalArgumentException
- if the source
argument is null or of length 0CmsObjectWrapper.moveResource(String, String)
,
CmsObject.moveResource(String, String)
CmsFile readFile(CmsObject cms, java.lang.String resourcename, CmsResourceFilter filter) throws CmsException
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.
cms
- the current users OpenCms contextresourcename
- the name of the resource to read (full path)filter
- the resource filter to use while reading
CmsException
- if the file resource could not be read for any reasonCmsObjectWrapper.readFile(String, CmsResourceFilter)
,
CmsObject.readFile(String, CmsResourceFilter)
CmsResource readResource(CmsObject cms, java.lang.String resourcename, CmsResourceFilter filter) throws CmsException
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.
cms
- the current users OpenCms contextresourcename
- The name of the resource to read (full path)filter
- the resource filter to use while reading
CmsException
- if the resource could not be read for any reasonCmsObjectWrapper.readResource(String, CmsResourceFilter)
,
CmsObject.readResource(String, CmsResourceFilter)
java.lang.String restoreLink(CmsObject cms, java.lang.String uri)
Turns the virtual path into a real path to a resource in the VFS.
cms
- the initialized CmsObjecturi
- the (virtual) uri to be restored
rewriteLink(CmsObject, CmsResource)
,
CmsObjectWrapper.restoreLink(String)
java.lang.String rewriteLink(CmsObject cms, CmsResource res)
For example: in the VFS: "/sites/default/index.html" and this resource wrapper adds the extension "jsp" then link returned should be "/sites/default/index.html.jsp".
cms
- the initialized CmsObjectres
- the resource where to rewrite the path
restoreLink(CmsObject, String)
,
CmsObjectWrapper.rewriteLink(String)
boolean unlockResource(CmsObject cms, java.lang.String resourcename) throws CmsException
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.
cms
- the current users OpenCms contextresourcename
- the name of the resource to unlock (full path)
CmsException
- if something goes wrongCmsObjectWrapper.unlockResource(String)
,
CmsObject.unlockResource(String)
CmsResource wrapResource(CmsObject cms, CmsResource resource)
For example, some resource types like CmsResourceTypeJsp
just get a .jsp
extension, while other types like
CmsResourceTypeXmlPage
are "exploded" into a folder /
file structure.
cms
- the current users OpenCms contextresource
- the resource to wrap
CmsResource
object or null
to not change the resourceCmsObjectWrapper.getResourcesInFolder(String, CmsResourceFilter)
CmsFile writeFile(CmsObject cms, CmsFile resource) throws CmsException
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.
cms
- the current cms contextresource
- the resource to apply this operation to
CmsException
- if something goes wrongCmsObjectWrapper.writeFile(CmsFile)
,
CmsObject.writeFile(CmsFile)
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |