org.opencms.ade.configuration
Class CmsConfigurationReader

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

public class CmsConfigurationReader
extends Object

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


Field Summary
static Locale DEFAULT_LOCALE
          The default locale for configuration objects.
static String N_FOLDER_NAME
          The Name node name.
static String N_FOLDER_PATH
          The Path node name.
static String N_RESOURCE_TYPE
          The Type node name.
 
Constructor Summary
CmsConfigurationReader(CmsObject cms)
          Creates a new configuration reader.
 
Method Summary
protected  boolean getBoolean(I_CmsXmlContentLocation parent, String name)
          Helper method to read a boolean value from the XML.
 List<CmsFunctionReference> getFunctionReferences()
          Returns the list of function references.
protected  String getString(I_CmsXmlContentValueLocation location)
          Gets the string value of an XML content location.
protected  CmsADEConfigData mergeConfigurations(List<CmsADEConfigData> configurations)
          Merges a list of multiple configuration objects into a single configuration object.
 CmsADEConfigData parseConfiguration(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(String basePath, I_CmsXmlContentLocation location)
          Parses a folder which may either be given as a path or as a folder name.
 CmsFormatterBean parseFormatter(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(String basePath, I_CmsXmlContentLocation node)
          Parses a resource type configuration element from the XML content.
 CmsADEConfigData parseSitemapConfiguration(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 Locale DEFAULT_LOCALE
The default locale for configuration objects.


N_FOLDER_NAME

public static final String N_FOLDER_NAME
The Name node name.

See Also:
Constant Field Values

N_FOLDER_PATH

public static final String N_FOLDER_PATH
The Path node name.

See Also:
Constant Field Values

N_RESOURCE_TYPE

public static final String N_RESOURCE_TYPE
The Type 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 List<CmsFunctionReference> getFunctionReferences()
Returns the list of function references.

Returns:
the list of function references

parseConfiguration

public CmsADEConfigData parseConfiguration(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(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(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(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(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,
                             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 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(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