org.opencms.file.types
Class CmsResourceTypeXmlContent

java.lang.Object
  extended byorg.opencms.file.types.A_CmsResourceType
      extended byorg.opencms.file.types.A_CmsResourceTypeLinkParseable
          extended byorg.opencms.file.types.CmsResourceTypeXmlContent
All Implemented Interfaces:
I_CmsConfigurationParameterHandler, I_CmsLinkParseable, I_CmsResourceType

public class CmsResourceTypeXmlContent
extends A_CmsResourceTypeLinkParseable

Resource type descriptor for the type "xmlcontent".

Since:
6.0.0
Version:
$Revision: 1.28 $
Author:
Alexander Kandzior

Field Summary
static java.lang.String CONFIGURATION_SCHEMA
          Configuration key for the (optional) schema.
 
Fields inherited from class org.opencms.file.types.A_CmsResourceType
m_addititionalModuleResourceType, m_className, m_copyResources, m_defaultProperties, m_frozen, m_mappings, m_typeId, m_typeName, MACRO_RESOURCE_FOLDER_PATH, 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 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.
 java.util.Map getConfiguration()
          Returns the configuration of this parameter configurable class instance, or null if the class does not need to be configured.
 int getLoaderId()
          Returns the loader type id of this resource type.
static boolean isXmlContent(CmsResource resource)
          Returns true in case the given resource is an XML content.
 java.util.List 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, getClassName, getConfiguredCopyResources, getConfiguredDefaultProperties, getConfiguredMappings, getMacroResolver, getResourceType, getTypeId, getTypeName, hashCode, importResource, initConfiguration, initConfiguration, initConfiguration, initialize, isAdditionalModuleResourceType, isFolder, isIdentical, lockResource, moveResource, processCopyResources, processDefaultProperties, removeResourceFromProject, replaceResource, restoreResource, restoreResourceBackup, setAdditionalModuleResourceType, setDateExpired, setDateLastModified, setDateReleased, 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
See Also:
A_CmsResourceType.addConfigurationParameter(java.lang.String, java.lang.String)

createResource

public CmsResource createResource(CmsObject cms,
                                  CmsSecurityManager securityManager,
                                  java.lang.String resourcename,
                                  byte[] content,
                                  java.util.List 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
Throws:
CmsException
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
See Also:
I_CmsResourceType.getCachePropertyDefault()

getConfiguration

public java.util.Map getConfiguration()
Description copied from interface: I_CmsConfigurationParameterHandler
Returns the configuration of this parameter configurable class instance, or null if the class does not need to be configured.

All elements in the configuration are key, value String pairs, set using the I_CmsConfigurationParameterHandler.addConfigurationParameter(String, String) method during initialization of the loader.

Implementations will (should) not to return a direct reference to the internal configuration but just a copy of it, to avoid unwanted external manipulation.

Specified by:
getConfiguration in interface I_CmsConfigurationParameterHandler
Overrides:
getConfiguration in class A_CmsResourceType
See Also:
A_CmsResourceType.getConfiguration()

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
See Also:
I_CmsResourceType.getLoaderId()

parseLinks

public java.util.List 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
Throws:
CmsException
See Also:
I_CmsResourceType.writeFile(org.opencms.file.CmsObject, CmsSecurityManager, CmsFile)