Class CmsResourceWrapperXmlPage
- All Implemented Interfaces:
I_CmsResourceWrapper
Every resource of type "xmlpage" becomes a folder with the same name. That folder contains the locales of the xml page as folders too. In the locale folder there are the elements for that locale as files. The files have the names of the elements with the extension "html". Additionaly there is a file in the root folder of that xml page that contains the controlcode of the xml page. This file has the name "controlcode.xml".
- Since:
- 6.5.6
-
Field Summary
Fields inherited from class org.opencms.file.wrapper.A_CmsResourceWrapper
m_isWrappedResource -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddResourcesToFolder(CmsObject cms, String resourcename, CmsResourceFilter filter) Here it is possible to add additional (virtual) child resources to those already existing in the VFS.booleancopyResource(CmsObject cms, String source, String destination, CmsResource.CmsResourceCopyMode siblingMode) Copies a resource.createResource(CmsObject cms, String resourcename, int type, byte[] content, List<CmsProperty> properties) Creates a new resource of the given resource type with the provided content and properties.booleandeleteResource(CmsObject cms, String resourcename, CmsResource.CmsResourceDeleteMode siblingMode) Deletes a resource given its name.getLock(CmsObject cms, CmsResource resource) Returns the lock for the resource.protected StringgetUriStyleSheet(CmsObject cms, CmsResource res) Returns the OpenCms VFS uri of the style sheet of the resource.protected StringgetUriTemplate(CmsObject cms, CmsResource res) Returns the OpenCms VFS uri of the template of the resource.booleanisWrappedResource(CmsObject cms, CmsResource res) Is called to check if the given resource is handled by this wrapper.booleanlockResource(CmsObject cms, String resourcename, boolean temporary) Locks a resource.booleanmoveResource(CmsObject cms, String source, String destination) Moves a resource to the given destination.protected StringprepareContent(String content, CmsObject cms, CmsResource xmlPage, String path) Prepare the content of a xml page before returning.readFile(CmsObject cms, String resourcename, CmsResourceFilter filter) Reads a file resource (including it's binary content) from the VFS, using the specified resource filter.readResource(CmsObject cms, String resourcename, CmsResourceFilter filter) Reads a resource from the VFS, using the specified resource filter.restoreLink(CmsObject cms, String uri) Returns the link to a existing resource in the VFS for the uri.rewriteLink(CmsObject cms, CmsResource res) Returns the link how it is for the resource after using this resource wrapper.booleanunlockResource(CmsObject cms, String resourcename) Unlocks a resource.wrapResource(CmsObject cms, CmsResource res) Changes the given resource based on the implementation of this wrapper.Writes a resource, including it's content.Methods inherited from class org.opencms.file.wrapper.A_CmsResourceWrapper
configure
-
Constructor Details
-
CmsResourceWrapperXmlPage
public CmsResourceWrapperXmlPage()
-
-
Method Details
-
addResourcesToFolder
public List<CmsResource> addResourcesToFolder(CmsObject cms, String resourcename, CmsResourceFilter filter) throws CmsException Description copied from interface:I_CmsResourceWrapperHere it is possible to add additional (virtual) child resources to those already existing in the VFS.- Specified by:
addResourcesToFolderin interfaceI_CmsResourceWrapper- Overrides:
addResourcesToFolderin classA_CmsResourceWrapper- Parameters:
cms- the current users OpenCms contextresourcename- the full path of the resource where to add the child resources forfilter- the resource filter to use- Returns:
- a list of all additionaly child
sCmsResource - Throws:
CmsException- if something goes wrong- See Also:
-
copyResource
public boolean copyResource(CmsObject cms, String source, String destination, CmsResource.CmsResourceCopyMode siblingMode) throws CmsException, CmsIllegalArgumentException Description copied from interface:I_CmsResourceWrapperCopies a resource.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.
- Specified by:
copyResourcein interfaceI_CmsResourceWrapper- Overrides:
copyResourcein classA_CmsResourceWrapper- Parameters:
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- Returns:
- true if the copy action was handled by this resource wrapper otherwise false
- Throws:
CmsException- if something goes wrongCmsIllegalArgumentException- if thedestinationargument is null or of length 0- See Also:
-
createResource
public CmsResource createResource(CmsObject cms, String resourcename, int type, byte[] content, List<CmsProperty> properties) throws CmsException, CmsIllegalArgumentException Description copied from interface:I_CmsResourceWrapperCreates 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:
createResourcein interfaceI_CmsResourceWrapper- Overrides:
createResourcein classA_CmsResourceWrapper- Parameters:
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- Returns:
- the created resource or null if not handled by this resource wrapper
- Throws:
CmsException- if something goes wrongCmsIllegalArgumentException- if thesourceargument is null or of length 0- See Also:
-
deleteResource
public boolean deleteResource(CmsObject cms, String resourcename, CmsResource.CmsResourceDeleteMode siblingMode) throws CmsException Description copied from interface:I_CmsResourceWrapperDeletes 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:
deleteResourcein interfaceI_CmsResourceWrapper- Overrides:
deleteResourcein classA_CmsResourceWrapper- Parameters:
cms- the initialized CmsObjectresourcename- the name of the resource to deletesiblingMode- 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:
-
getLock
Description copied from interface:I_CmsResourceWrapperReturns 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:
getLockin interfaceI_CmsResourceWrapper- Overrides:
getLockin classA_CmsResourceWrapper- Parameters:
cms- the initialized CmsObjectresource- 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:
-
isWrappedResource
Description copied from interface:I_CmsResourceWrapperIs called to check if the given resource is handled by this wrapper.- Parameters:
cms- the initialized CmsObjectres- the resource to check- Returns:
- true if the resource will be handled by the wrapper otherwise false
- See Also:
-
lockResource
public boolean lockResource(CmsObject cms, String resourcename, boolean temporary) throws CmsException Description copied from interface:I_CmsResourceWrapperLocks 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:
lockResourcein interfaceI_CmsResourceWrapper- Overrides:
lockResourcein classA_CmsResourceWrapper- Parameters:
cms- the current users OpenCms contextresourcename- the name of the resource to lock (full path)temporary- true if the resource should only be locked temporarily- Returns:
- true if this request could be handled by this wrapper or false if not
- Throws:
CmsException- if something goes wrong- See Also:
-
moveResource
public boolean moveResource(CmsObject cms, String source, String destination) throws CmsException, CmsIllegalArgumentException Description copied from interface:I_CmsResourceWrapperMoves a resource to the given destination.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.
- Specified by:
moveResourcein interfaceI_CmsResourceWrapper- Overrides:
moveResourcein classA_CmsResourceWrapper- Parameters:
cms- the current cms contextsource- the name of the resource to movedestination- the destination resource name- Returns:
- true if the move action was handled by this resource wrapper otherwise false
- Throws:
CmsException- if something goes wrongCmsIllegalArgumentException- if thesourceargument is null or of length 0- See Also:
-
readFile
public CmsFile readFile(CmsObject cms, String resourcename, CmsResourceFilter filter) throws CmsException Description copied from interface:I_CmsResourceWrapperReads 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:
readFilein interfaceI_CmsResourceWrapper- Overrides:
readFilein classA_CmsResourceWrapper- Parameters:
cms- the current users OpenCms contextresourcename- 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:
-
readResource
public CmsResource readResource(CmsObject cms, String resourcename, CmsResourceFilter filter) throws CmsException Description copied from interface:I_CmsResourceWrapperReads 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:
readResourcein interfaceI_CmsResourceWrapper- Overrides:
readResourcein classA_CmsResourceWrapper- Parameters:
cms- the current users OpenCms contextresourcename- 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:
-
restoreLink
Description copied from interface:I_CmsResourceWrapperReturns 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:
restoreLinkin interfaceI_CmsResourceWrapper- Overrides:
restoreLinkin classA_CmsResourceWrapper- Parameters:
cms- the initialized CmsObjecturi- 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:
-
rewriteLink
Description copied from interface:I_CmsResourceWrapperReturns the link how it is for the resource after using this resource wrapper.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".
- Specified by:
rewriteLinkin interfaceI_CmsResourceWrapper- Overrides:
rewriteLinkin classA_CmsResourceWrapper- Parameters:
cms- the initialized CmsObjectres- the resource where to rewrite the path- Returns:
- the rewritten path or null if the wrapper is not responsible
- See Also:
-
unlockResource
Description copied from interface:I_CmsResourceWrapperUnlocks 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:
unlockResourcein interfaceI_CmsResourceWrapper- Overrides:
unlockResourcein classA_CmsResourceWrapper- Parameters:
cms- the current users OpenCms contextresourcename- 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:
-
wrapResource
Description copied from interface:I_CmsResourceWrapperChanges the given resource based on the implementation of this wrapper.For example, some resource types like
CmsResourceTypeJspjust get a.jspextension, while other types likeCmsResourceTypeXmlPageare "exploded" into a folder / file structure.- Specified by:
wrapResourcein interfaceI_CmsResourceWrapper- Overrides:
wrapResourcein classA_CmsResourceWrapper- Parameters:
cms- the current users OpenCms contextres- the resource to wrap- Returns:
- a wrapped
CmsResourceobject ornullto not change the resource - See Also:
-
writeFile
Description copied from interface:I_CmsResourceWrapperWrites 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:
writeFilein interfaceI_CmsResourceWrapper- Overrides:
writeFilein classA_CmsResourceWrapper- Parameters:
cms- the current cms contextresource- 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:
-
getUriStyleSheet
Returns the OpenCms VFS uri of the style sheet of the resource.- Parameters:
cms- the initialized CmsObjectres- the resource where to read the style sheet for- Returns:
- the OpenCms VFS uri of the style sheet of resource
-
getUriTemplate
Returns the OpenCms VFS uri of the template of the resource.- Parameters:
cms- the initialized CmsObjectres- the resource where to read the template for- Returns:
- the OpenCms VFS uri of the template of the resource
-
prepareContent
Prepare the content of a xml page before returning.Mainly adds the basic html structure and the css style sheet.
- Parameters:
content- the origin content of the xml page elementcms- the initialized CmsObjectxmlPage- the xml page resourcepath- the full path to set as the title in the html head- Returns:
- the prepared content with the added html structure
-