org.opencms.file.types
Class CmsResourceTypeXmlContent

java.lang.Object
  extended by org.opencms.file.types.A_CmsResourceType
      extended by org.opencms.file.types.A_CmsResourceTypeLinkParseable
          extended by org.opencms.file.types.CmsResourceTypeXmlContent
All Implemented Interfaces:
I_CmsConfigurationParameterHandler, I_CmsResourceType, I_CmsLinkParseable
Direct Known Subclasses:
CmsResourceTypeXmlAdeConfiguration, CmsResourceTypeXmlContainerPage

public class CmsResourceTypeXmlContent
extends A_CmsResourceTypeLinkParseable

Resource type descriptor for the type "xmlcontent".

Since:
6.0.0

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.opencms.file.types.I_CmsResourceType
I_CmsResourceType.Formatter
 
Field Summary
static java.lang.String CONFIGURATION_SCHEMA
          Configuration key for the (optional) schema.
 
Fields inherited from class org.opencms.file.types.A_CmsResourceType
CONFIGURATION_GALLERY_JAVASCRIPT_PATH, CONFIGURATION_GALLERY_PREVIEW_PROVIDER, CONFIGURATION_GALLERY_TYPE_NAMES, CONFIGURATION_INTERNAL, DEFAULT_GALLERY_PREVIEW_PROVIDER, m_addititionalModuleResourceType, m_className, m_configuration, m_copyResources, m_defaultProperties, m_frozen, m_galleryPreviewProvider, m_mappings, m_moduleName, m_typeId, m_typeName, MACRO_RESOURCE_FOLDER_PATH, MACRO_RESOURCE_FOLDER_PATH_TOUCH, MACRO_RESOURCE_NAME, MACRO_RESOURCE_PARENT_PATH, MACRO_RESOURCE_ROOT_PATH, MACRO_RESOURCE_SITE_PATH
 
Fields inherited from interface org.opencms.file.types.I_CmsResourceType
ADD_MAPPING_METHOD, ADD_RESOURCE_TYPE_METHOD, CONFIGURATION_PROPERTY_CREATE, CONFIGURATION_RESOURCE_TYPE_ID, CONFIGURATION_RESOURCE_TYPE_NAME, PROPERTY_ON_RESOURCE, PROPERTY_ON_STRUCTURE
 
Fields inherited from interface org.opencms.configuration.I_CmsConfigurationParameterHandler
ADD_PARAMETER_METHOD, INIT_CONFIGURATION_METHOD
 
Constructor Summary
CmsResourceTypeXmlContent()
           
 
Method Summary
 void addConfigurationParameter(java.lang.String paramName, java.lang.String paramValue)
          Adds a configuration parameter to this parameter configurable class instance.
 CmsResource createResource(CmsObject cms, CmsSecurityManager securityManager, java.lang.String resourcename, byte[] content, java.util.List<CmsProperty> properties)
          Creates a new resource of the given resource type with the provided content and properties.
 java.lang.String getCachePropertyDefault()
          Returns the default for the cache property setting of this resource type.
 CmsParameterConfiguration getConfiguration()
          Returns the parameters of this configurable class instance, or null if the class does not need any parameters.
 CmsFormatterConfiguration getFormattersForResource(CmsObject cms, CmsResource resource)
          Returns the formatter configuration for the given resource.
 java.lang.String getGalleryPreviewProvider()
          Returns the gallery preview provider class name.
 int getLoaderId()
          Returns the loader type id of this resource type.
protected  java.util.Locale getLocaleForNewContent(CmsObject cms, CmsSecurityManager securityManager, java.lang.String resourcename, java.util.List<CmsProperty> properties)
          Gets the locale which should be used for creating an empty content.
 java.lang.String getSchema()
          Returns the configured xsd schema uri.
protected  CmsLink getXsdLink(CmsObject cms, CmsXmlContent xmlContent)
          Creates a new link object for the schema definition.
 void initialize(CmsObject cms)
          Initializes this resource type.
static boolean isXmlContent(CmsResource resource)
          Returns true in case the given resource is an XML content.
 java.util.List<CmsLink> parseLinks(CmsObject cms, CmsFile file)
          Returns a list of all links from the specified file.
 CmsFile writeFile(CmsObject cms, CmsSecurityManager securityManager, CmsFile resource)
          Writes a resource, including it's content.
 
Methods inherited from class org.opencms.file.types.A_CmsResourceTypeLinkParseable
isDirectEditable
 
Methods inherited from class org.opencms.file.types.A_CmsResourceType
addCopyResource, addDefaultProperty, addMappingType, changeLock, chflags, chtype, copyResource, copyResourceToProject, createRelations, createSibling, deleteResource, equals, getAdjustLinksFolder, getClassName, getConfiguredCopyResources, getConfiguredDefaultProperties, getConfiguredMappings, getGalleryTypes, getMacroResolver, getModuleName, getResourceType, getTypeId, getTypeName, hashCode, importResource, initConfiguration, initConfiguration, isAdditionalModuleResourceType, isFolder, isIdentical, lockResource, moveResource, processCopyResources, processDefaultProperties, removeResourceFromProject, replaceResource, restoreResource, setAdditionalModuleResourceType, setAdjustLinksFolder, setDateExpired, setDateLastModified, setDateReleased, setModuleName, toString, undelete, undoChanges, unlockResource, updateRelationForUndo, writePropertyObject, writePropertyObjects
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CONFIGURATION_SCHEMA

public static final java.lang.String CONFIGURATION_SCHEMA
Configuration key for the (optional) schema.

See Also:
Constant Field Values
Constructor Detail

CmsResourceTypeXmlContent

public CmsResourceTypeXmlContent()
Method Detail

isXmlContent

public static boolean isXmlContent(CmsResource resource)
Returns true in case the given resource is an XML content.

Internally this checks if the content loader for the given resource is identical to the XML content loader.

Parameters:
resource - the resource to check
Returns:
true in case the given resource is an XML content
Since:
7.0.2

addConfigurationParameter

public void addConfigurationParameter(java.lang.String paramName,
                                      java.lang.String paramValue)
Description copied from interface: I_CmsConfigurationParameterHandler
Adds a configuration parameter to this parameter configurable class instance.

Specified by:
addConfigurationParameter in interface I_CmsConfigurationParameterHandler
Overrides:
addConfigurationParameter in class A_CmsResourceType
Parameters:
paramName - the name of the parameter
paramValue - the value for the parameter
See Also:
A_CmsResourceType.addConfigurationParameter(java.lang.String, java.lang.String)

getGalleryPreviewProvider

public java.lang.String getGalleryPreviewProvider()
Description copied from interface: I_CmsResourceType
Returns the gallery preview provider class name.

Specified by:
getGalleryPreviewProvider in interface I_CmsResourceType
Overrides:
getGalleryPreviewProvider in class A_CmsResourceType
Returns:
the gallery preview provider class name
See Also:
A_CmsResourceType.getGalleryPreviewProvider()

createResource

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

Specified by:
createResource in interface I_CmsResourceType
Overrides:
createResource in class A_CmsResourceType
Parameters:
cms - the initialized CmsObject
securityManager - the initialized OpenCms security manager
resourcename - the name of the resource to create (full path)
content - the content for the new resource
properties - the properties for the new resource
Returns:
the created resource
Throws:
CmsException - if something goes wrong
See Also:
I_CmsResourceType.createResource(org.opencms.file.CmsObject, org.opencms.db.CmsSecurityManager, java.lang.String, byte[], java.util.List)

getCachePropertyDefault

public java.lang.String getCachePropertyDefault()
Description copied from interface: I_CmsResourceType
Returns the default for the cache property setting of this resource type.

The cache property is used by the Flex cache implementation to build the cache key that controls the caching behaviour of a resource.

If null is returnd, this is the same as turning the cache off by default for this resource type.

Specified by:
getCachePropertyDefault in interface I_CmsResourceType
Overrides:
getCachePropertyDefault in class A_CmsResourceType
Returns:
the default for the cache property setting of this resource type
See Also:
I_CmsResourceType.getCachePropertyDefault()

getConfiguration

public CmsParameterConfiguration getConfiguration()
Description copied from interface: I_CmsConfigurationParameterHandler
Returns the parameters of this configurable class instance, or null if the class does not need any parameters.

Specified by:
getConfiguration in interface I_CmsConfigurationParameterHandler
Overrides:
getConfiguration in class A_CmsResourceType
Returns:
the parameters of this configurable class instance, or null if the class does not need any parameters
See Also:
A_CmsResourceType.getConfiguration()

getFormattersForResource

public CmsFormatterConfiguration getFormattersForResource(CmsObject cms,
                                                          CmsResource resource)
Description copied from interface: I_CmsResourceType
Returns the formatter configuration for the given resource.

Specified by:
getFormattersForResource in interface I_CmsResourceType
Overrides:
getFormattersForResource in class A_CmsResourceType
Parameters:
cms - the current cms context
resource - the resource to get the formatter configuration for
Returns:
the formatter configuration for the given resource
See Also:
A_CmsResourceType.getFormattersForResource(org.opencms.file.CmsObject, org.opencms.file.CmsResource)

getLoaderId

public int getLoaderId()
Description copied from interface: I_CmsResourceType
Returns the loader type id of this resource type.

Specified by:
getLoaderId in interface I_CmsResourceType
Specified by:
getLoaderId in class A_CmsResourceType
Returns:
the loader type id of this resource type
See Also:
I_CmsResourceType.getLoaderId()

getSchema

public java.lang.String getSchema()
Returns the configured xsd schema uri.

Returns:
the configured xsd schema uri, or null if not set

initialize

public void initialize(CmsObject cms)
Description copied from interface: I_CmsResourceType
Initializes this resource type.

This method will be called once during the OpenCms initialization processs. The VFS will already be available at the time the method is called.

Specified by:
initialize in interface I_CmsResourceType
Overrides:
initialize in class A_CmsResourceType
Parameters:
cms - a OpenCms context initialized with "Admin" permissions
See Also:
A_CmsResourceType.initialize(org.opencms.file.CmsObject)

parseLinks

public java.util.List<CmsLink> parseLinks(CmsObject cms,
                                          CmsFile file)
Description copied from interface: I_CmsLinkParseable
Returns a list of all links from the specified file.

Implementations of this method must return an empty list, or better Collections.EMPTY_LIST, if no link is found at all.

Implementations of this method should return the list of links including internal (OpenCms VFS) and external links (http, https, mailto, ftp, etc.).

Parameters:
cms - the current user's context
file - the file to be parsed
Returns:
a list of CmsLink objects with the URIs of all linked resources
See Also:
I_CmsLinkParseable.parseLinks(org.opencms.file.CmsObject, org.opencms.file.CmsFile)

writeFile

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

Applies only to resources of type CmsFile that have a binary content attached.

Specified by:
writeFile in interface I_CmsResourceType
Overrides:
writeFile in class A_CmsResourceType
Parameters:
cms - the current cms context
securityManager - the initialized OpenCms security manager
resource - the resource to apply this operation to
Returns:
the written resource
Throws:
CmsException - if something goes wrong
See Also:
I_CmsResourceType.writeFile(org.opencms.file.CmsObject, CmsSecurityManager, CmsFile)

getLocaleForNewContent

protected java.util.Locale getLocaleForNewContent(CmsObject cms,
                                                  CmsSecurityManager securityManager,
                                                  java.lang.String resourcename,
                                                  java.util.List<CmsProperty> properties)
Gets the locale which should be used for creating an empty content.

Parameters:
cms - the current CMS context
securityManager - the security manager
resourcename - the name of the resource to create
properties - the properties for the resource to create
Returns:
the locale to use

getXsdLink

protected CmsLink getXsdLink(CmsObject cms,
                             CmsXmlContent xmlContent)
Creates a new link object for the schema definition.

Parameters:
cms - the current CMS context
xmlContent - the xml content to crete the link for
Returns:
the generated link