org.opencms.ade.configuration
Class CmsConfigurationReader

java.lang.Object
  extended by org.opencms.ade.configuration.CmsConfigurationReader

public class CmsConfigurationReader
extends java.lang.Object

A class to parse ADE sitemap or module configuration files and create configuration objects from them.


Field Summary
static java.util.Locale DEFAULT_LOCALE
          The default locale for configuration objects.
static java.lang.String N_CREATE_CONTENTS_LOCALLY
          The create content locally node name.
static java.lang.String N_DEFAULT
          The default node name.
static java.lang.String N_DESCRIPTION
          The description node name.
static java.lang.String N_DETAIL_PAGE
          The detail page node name.
static java.lang.String N_DETAIL_PAGES_DISABLED
          The detail pages disabled node name.
static java.lang.String N_DISABLED
          The disabled node name.
static java.lang.String N_DISCARD_MODEL_PAGES
          The discard model pages node name.
static java.lang.String N_DISCARD_PROPERTIES
          The discard properties node name.
static java.lang.String N_DISCARD_TYPES
          The discard types node name.
static java.lang.String N_DISPLAY_NAME
          The display name node name.
static java.lang.String N_ERROR
          The error node name.
static java.lang.String N_FOLDER
          The folder node name.
static java.lang.String N_FORMATTER
          The formatter node name.
static java.lang.String N_FUNCTION
          The function node name.
static java.lang.String N_FUNCTION_REF
          The function reference node name.
static java.lang.String N_IS_DEFAULT
          The is default node name.
static java.lang.String N_IS_PREVIEW
          The is preview node name.
static java.lang.String N_JSP
          The JSP node name.
static java.lang.String N_MAX_WIDTH
          The max width node name.
static java.lang.String N_MIN_WIDTH
          The min width node name.
static java.lang.String N_MODEL_PAGE
          The model page node name.
static java.lang.String N_NAME
          The folder name node name.
static java.lang.String N_NAME_PATTERN
          The name pattern node name.
static java.lang.String N_ORDER
          The order node name.
static java.lang.String N_PAGE
          The page node name.
static java.lang.String N_PATH
          The folder path node name.
static java.lang.String N_PREFER_FOLDER
          The prefer folder node name.
static java.lang.String N_PROPERTY
          The property node name.
static java.lang.String N_PROPERTY_NAME
          The property name node name.
static java.lang.String N_RESOURCE_TYPE
          The resource type node name.
static java.lang.String N_RULE_REGEX
          The regex rule node name.
static java.lang.String N_RULE_TYPE
          The rule type node name.
static java.lang.String N_TYPE
          The type node name.
static java.lang.String N_TYPE_NAME
          The type name node name.
static java.lang.String N_WIDGET
          The widget node name.
static java.lang.String N_WIDGET_CONFIG
          The widget configuration node name.
 
Constructor Summary
CmsConfigurationReader(CmsObject cms)
          Creates a new configuration reader.
 
Method Summary
protected  boolean getBoolean(I_CmsXmlContentLocation parent, java.lang.String name)
          Helper method to read a boolean value from the XML.
 java.util.List<CmsFunctionReference> getFunctionReferences()
          Returns the list of function references.
protected  java.lang.String getString(I_CmsXmlContentValueLocation location)
          Gets the string value of an XML content location.
protected  CmsADEConfigData mergeConfigurations(java.util.List<CmsADEConfigData> configurations)
          Merges a list of multiple configuration objects into a single configuration object.
 CmsADEConfigData parseConfiguration(java.lang.String basePath, CmsXmlContent content)
          Parses a configuration XML content and creates a configuration object from it.
protected  void parseDetailPage(I_CmsXmlContentLocation node)
          Parses the detail pages from an XML content node.
 CmsFolderOrName parseFolderOrName(java.lang.String basePath, I_CmsXmlContentLocation location)
          Parses a folder which may either be given as a path or as a folder name.
 CmsFormatterBean parseFormatter(java.lang.String typeName, I_CmsXmlContentLocation node)
          Parses a formatter bean.
protected  void parseFunctionReference(I_CmsXmlContentLocation node)
          Parses a function reference node.
 void parseModelPage(I_CmsXmlContentLocation node)
          Parses model page data from the XML content.
 void parseResourceTypeConfig(java.lang.String basePath, I_CmsXmlContentLocation node)
          Parses a resource type configuration element from the XML content.
 CmsADEConfigData parseSitemapConfiguration(java.lang.String basePath, CmsResource configRes)
          Parses the sitemap configuration given the configuration file and base path.
 CmsADEConfigData readModuleConfigurations()
          Reads the configurations of all modules and combines them into a single configuration object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_LOCALE

public static final java.util.Locale DEFAULT_LOCALE
The default locale for configuration objects.


N_CREATE_CONTENTS_LOCALLY

public static final java.lang.String N_CREATE_CONTENTS_LOCALLY
The create content locally node name.

See Also:
Constant Field Values

N_DEFAULT

public static final java.lang.String N_DEFAULT
The default node name.

See Also:
Constant Field Values

N_DESCRIPTION

public static final java.lang.String N_DESCRIPTION
The description node name.

See Also:
Constant Field Values

N_DETAIL_PAGE

public static final java.lang.String N_DETAIL_PAGE
The detail page node name.

See Also:
Constant Field Values

N_DETAIL_PAGES_DISABLED

public static final java.lang.String N_DETAIL_PAGES_DISABLED
The detail pages disabled node name.

See Also:
Constant Field Values

N_DISABLED

public static final java.lang.String N_DISABLED
The disabled node name.

See Also:
Constant Field Values

N_DISCARD_MODEL_PAGES

public static final java.lang.String N_DISCARD_MODEL_PAGES
The discard model pages node name.

See Also:
Constant Field Values

N_DISCARD_PROPERTIES

public static final java.lang.String N_DISCARD_PROPERTIES
The discard properties node name.

See Also:
Constant Field Values

N_DISCARD_TYPES

public static final java.lang.String N_DISCARD_TYPES
The discard types node name.

See Also:
Constant Field Values

N_DISPLAY_NAME

public static final java.lang.String N_DISPLAY_NAME
The display name node name.

See Also:
Constant Field Values

N_ERROR

public static final java.lang.String N_ERROR
The error node name.

See Also:
Constant Field Values

N_FOLDER

public static final java.lang.String N_FOLDER
The folder node name.

See Also:
Constant Field Values

N_FORMATTER

public static final java.lang.String N_FORMATTER
The formatter node name.

See Also:
Constant Field Values

N_FUNCTION

public static final java.lang.String N_FUNCTION
The function node name.

See Also:
Constant Field Values

N_FUNCTION_REF

public static final java.lang.String N_FUNCTION_REF
The function reference node name.

See Also:
Constant Field Values

N_IS_DEFAULT

public static final java.lang.String N_IS_DEFAULT
The is default node name.

See Also:
Constant Field Values

N_IS_PREVIEW

public static final java.lang.String N_IS_PREVIEW
The is preview node name.

See Also:
Constant Field Values

N_JSP

public static final java.lang.String N_JSP
The JSP node name.

See Also:
Constant Field Values

N_MAX_WIDTH

public static final java.lang.String N_MAX_WIDTH
The max width node name.

See Also:
Constant Field Values

N_MIN_WIDTH

public static final java.lang.String N_MIN_WIDTH
The min width node name.

See Also:
Constant Field Values

N_MODEL_PAGE

public static final java.lang.String N_MODEL_PAGE
The model page node name.

See Also:
Constant Field Values

N_NAME

public static final java.lang.String N_NAME
The folder name node name.

See Also:
Constant Field Values

N_NAME_PATTERN

public static final java.lang.String N_NAME_PATTERN
The name pattern node name.

See Also:
Constant Field Values

N_ORDER

public static final java.lang.String N_ORDER
The order node name.

See Also:
Constant Field Values

N_PAGE

public static final java.lang.String N_PAGE
The page node name.

See Also:
Constant Field Values

N_PATH

public static final java.lang.String N_PATH
The folder path node name.

See Also:
Constant Field Values

N_PREFER_FOLDER

public static final java.lang.String N_PREFER_FOLDER
The prefer folder node name.

See Also:
Constant Field Values

N_PROPERTY

public static final java.lang.String N_PROPERTY
The property node name.

See Also:
Constant Field Values

N_PROPERTY_NAME

public static final java.lang.String N_PROPERTY_NAME
The property name node name.

See Also:
Constant Field Values

N_RESOURCE_TYPE

public static final java.lang.String N_RESOURCE_TYPE
The resource type node name.

See Also:
Constant Field Values

N_RULE_REGEX

public static final java.lang.String N_RULE_REGEX
The regex rule node name.

See Also:
Constant Field Values

N_RULE_TYPE

public static final java.lang.String N_RULE_TYPE
The rule type node name.

See Also:
Constant Field Values

N_TYPE

public static final java.lang.String N_TYPE
The type node name.

See Also:
Constant Field Values

N_TYPE_NAME

public static final java.lang.String N_TYPE_NAME
The type name node name.

See Also:
Constant Field Values

N_WIDGET

public static final java.lang.String N_WIDGET
The widget node name.

See Also:
Constant Field Values

N_WIDGET_CONFIG

public static final java.lang.String N_WIDGET_CONFIG
The widget configuration node name.

See Also:
Constant Field Values
Constructor Detail

CmsConfigurationReader

public CmsConfigurationReader(CmsObject cms)
Creates a new configuration reader.

Parameters:
cms - the CMS context which should be used to read the configuration data.

Method Detail

getFunctionReferences

public java.util.List<CmsFunctionReference> getFunctionReferences()
Returns the list of function references.

Returns:
the list of function references

parseConfiguration

public CmsADEConfigData parseConfiguration(java.lang.String basePath,
                                           CmsXmlContent content)
                                    throws CmsException
Parses a configuration XML content and creates a configuration object from it.

Parameters:
basePath - the base path
content - the XML content
Returns:
the created configuration object with the data from the XML content
Throws:
CmsException - if something goes wrong

parseFolderOrName

public CmsFolderOrName parseFolderOrName(java.lang.String basePath,
                                         I_CmsXmlContentLocation location)
                                  throws CmsException
Parses a folder which may either be given as a path or as a folder name.

Parameters:
basePath - the base path for the configuration
location - the XML content node from which to parse the folder
Returns:
the folder bean
Throws:
CmsException - if something goes wrong

parseFormatter

public CmsFormatterBean parseFormatter(java.lang.String typeName,
                                       I_CmsXmlContentLocation node)
Parses a formatter bean.

Parameters:
typeName - the type name for which the formatter is being parsed
node - the node from which to parse the formatter data
Returns:
the formatter bean from the XML

parseModelPage

public void parseModelPage(I_CmsXmlContentLocation node)
                    throws CmsException
Parses model page data from the XML content.

Parameters:
node - the XML content node
Throws:
CmsException - if something goes wrong

parseResourceTypeConfig

public void parseResourceTypeConfig(java.lang.String basePath,
                                    I_CmsXmlContentLocation node)
                             throws CmsException
Parses a resource type configuration element from the XML content.

Parameters:
basePath - the base path of the configuration
node - the XML configuration node
Throws:
CmsException - if something goes wrong

parseSitemapConfiguration

public CmsADEConfigData parseSitemapConfiguration(java.lang.String basePath,
                                                  CmsResource configRes)
                                           throws CmsException
Parses the sitemap configuration given the configuration file and base path.

Parameters:
basePath - the base path
configRes - the configuration file resource
Returns:
the parsed configuration data
Throws:
CmsException - if something goes wrong

readModuleConfigurations

public CmsADEConfigData readModuleConfigurations()
Reads the configurations of all modules and combines them into a single configuration object.

Returns:
the combined configuration object

getBoolean

protected boolean getBoolean(I_CmsXmlContentLocation parent,
                             java.lang.String name)
Helper method to read a boolean value from the XML.

If the element is not found in the XML, false is returned.

Parameters:
parent - the parent node
name - the name of the XML content value
Returns:
the boolean value

getString

protected java.lang.String getString(I_CmsXmlContentValueLocation location)
Gets the string value of an XML content location.

Parameters:
location - an XML content location
Returns:
the string value of that XML content location

mergeConfigurations

protected CmsADEConfigData mergeConfigurations(java.util.List<CmsADEConfigData> configurations)
Merges a list of multiple configuration objects into a single configuration object.

Parameters:
configurations - the list of configuration objects.

Returns:
the merged configuration object

parseDetailPage

protected void parseDetailPage(I_CmsXmlContentLocation node)
                        throws CmsException
Parses the detail pages from an XML content node.

Parameters:
node - the XML content node
Throws:
CmsException - if something goes wrong

parseFunctionReference

protected void parseFunctionReference(I_CmsXmlContentLocation node)
Parses a function reference node.

Parameters:
node - the function reference node