Package org.opencms.configuration
Class CmsConfigurationManager
java.lang.Object
org.opencms.configuration.CmsConfigurationManager
- All Implemented Interfaces:
I_CmsConfigurationParameterHandler,I_CmsXmlConfiguration
Configuration manager for digesting the OpenCms XML configuration.
Reads the individual configuration class nodes first and creaes new instances of the "base" configuration classes.
- Since:
- 6.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe location of the OpenCms configuration DTD if the default prefix is the system ID.static final StringThe default prefix for the OpenCms configuration DTD.static final StringThe name of the default XML file for this configuration.static final StringLocation of the optional XSLT file used to transform the configuration.static final StringThe name of the DTD file for this configuration.protected static final StringThe config node.protected static final StringThe configurations node.static final StringThe "opencms" root node of the XML configuration.static final StringPostfix for original configuration files.Fields inherited from interface org.opencms.configuration.I_CmsConfigurationParameterHandler
ADD_PARAMETER_METHOD, INIT_CONFIGURATION_METHODFields inherited from interface org.opencms.configuration.I_CmsXmlConfiguration
A_ALIAS, A_CLASS, A_COUNT, A_DEFAULT, A_DESTINATION, A_ENABLED, A_FROM, A_HANDLER, A_ICON, A_ID, A_KEY, A_MODE, A_NAME, A_ORDER, A_PASSWORD, A_PORT, A_PROTOCOL, A_SUFFIX, A_TO, A_TYPE, A_URI, A_USER, A_VALUE, N_EXPORTPOINT, N_EXPORTPOINTS, N_NAME, N_PARAM, N_PROPERTY, N_RESOURCE, N_SITE, N_VALUE -
Constructor Summary
ConstructorsConstructorDescriptionCmsConfigurationManager(String baseFolder) Creates a new OpenCms configuration manager. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConfiguration(I_CmsXmlConfiguration configuration) Adds a configuration object to the configuration manager.voidaddConfigurationParameter(String paramName, String paramValue) Adds a configuration parameter to this parameter configurable class instance.voidaddXmlDigesterRules(org.apache.commons.digester3.Digester digester) Digests an XML node and creates an instance of this configurable class.org.dom4j.ElementgenerateXml(org.dom4j.Element parent) Generates the XML element for this configurable class.org.dom4j.DocumentgenerateXml(I_CmsXmlConfiguration configuration) Creates the XML document build from the provided configuration.Returns the backup folder.Returns the properties read fromopencms.properties.getConfiguration(Class<?> clazz) Returns a specific configuration from the list of initialized configurations.Returns the list of all initialized configurations.Returns the name of the DTD file for this XML configuration, e.g.Returns the internal system location of the DTD file for this XML configuration, e.g.Returns the external system id prefix of the DTD file for this XML configuration, e.g.Returns the name of the XML input file for this configuration, e.g.voidInitializes a configuration after all parameters have been added.voidLoads the OpenCms configuration from the given XML file.voidsetAdminCms(CmsObject cms) Sets the admin CmsObject.voidsetConfiguration(CmsParameterConfiguration propertyConfiguration) Sets the configuration read from theopencms.properties.voidwriteConfiguration(Class<?> clazz) Writes the XML configuration for the provided configuration instance.
-
Field Details
-
DEFAULT_DTD_LOCATION
The location of the OpenCms configuration DTD if the default prefix is the system ID.- See Also:
-
DEFAULT_XSLT_FILENAME
Location of the optional XSLT file used to transform the configuration.- See Also:
-
DEFAULT_DTD_PREFIX
The default prefix for the OpenCms configuration DTD.- See Also:
-
DEFAULT_XML_FILE_NAME
The name of the default XML file for this configuration.- See Also:
-
DTD_FILE_NAME
The name of the DTD file for this configuration.- See Also:
-
N_ROOT
The "opencms" root node of the XML configuration.- See Also:
-
POSTFIX_ORI
Postfix for original configuration files.- See Also:
-
N_CONFIG
The config node.- See Also:
-
N_CONFIGURATION
The configurations node.- See Also:
-
-
Constructor Details
-
CmsConfigurationManager
Creates a new OpenCms configuration manager.- Parameters:
baseFolder- base folder where XML configurations to load are located
-
-
Method Details
-
addConfiguration
Adds a configuration object to the configuration manager.- Parameters:
configuration- the configuration to add
-
addConfigurationParameter
Description copied from interface:I_CmsConfigurationParameterHandlerAdds a configuration parameter to this parameter configurable class instance.- Specified by:
addConfigurationParameterin interfaceI_CmsConfigurationParameterHandler- Parameters:
paramName- the name of the parameterparamValue- the value for the parameter- See Also:
-
addXmlDigesterRules
Description copied from interface:I_CmsXmlConfigurationDigests an XML node and creates an instance of this configurable class.- Specified by:
addXmlDigesterRulesin interfaceI_CmsXmlConfiguration- Parameters:
digester- the digester to use- See Also:
-
generateXml
Description copied from interface:I_CmsXmlConfigurationGenerates the XML element for this configurable class.- Specified by:
generateXmlin interfaceI_CmsXmlConfiguration- Parameters:
parent- the parent element in the XML tree- Returns:
- the XML element for this configurable class
- See Also:
-
generateXml
Creates the XML document build from the provided configuration.- Parameters:
configuration- the configuration to build the XML for- Returns:
- the XML document build from the provided configuration
-
getBackupFolder
Returns the backup folder.- Returns:
- the backup folder
-
getConfiguration
Returns the properties read fromopencms.properties.- Specified by:
getConfigurationin interfaceI_CmsConfigurationParameterHandler- Returns:
- the parameters of this configurable class instance,
or
nullif the class does not need any parameters - See Also:
-
getConfiguration
Returns a specific configuration from the list of initialized configurations.- Parameters:
clazz- the configuration class that should be returned- Returns:
- the initialized configuration class instance, or
nullif this is not found
-
getConfigurations
Returns the list of all initialized configurations.- Returns:
- the list of all initialized configurations
-
getDtdFilename
Description copied from interface:I_CmsXmlConfigurationReturns the name of the DTD file for this XML configuration, e.g.opencms-configuration.dtd.- Specified by:
getDtdFilenamein interfaceI_CmsXmlConfiguration- Returns:
- the name of the DTD file for this XML configuration
- See Also:
-
getDtdSystemLocation
Description copied from interface:I_CmsXmlConfigurationReturns the internal system location of the DTD file for this XML configuration, e.g.org/opencms/configuration/.If this is not
null, then the DTD is not read through the web URL, but an internal name resolution is added that resolves the system id of the DTD to.I_CmsXmlConfiguration.getDtdSystemLocation()+I_CmsXmlConfiguration.getDtdUrlPrefix()- Specified by:
getDtdSystemLocationin interfaceI_CmsXmlConfiguration- Returns:
- the system location of the DTD file for this XML configuration
- See Also:
-
getDtdUrlPrefix
Description copied from interface:I_CmsXmlConfigurationReturns the external system id prefix of the DTD file for this XML configuration, e.g.http://www.opencms.org/dtd/6.0/.The full system id for the DTD is calculated like this:
.I_CmsXmlConfiguration.getDtdSystemLocation()+I_CmsXmlConfiguration.getDtdUrlPrefix()- Specified by:
getDtdUrlPrefixin interfaceI_CmsXmlConfiguration- Returns:
- the system id prefix of the DTD file for this XML configuration
- See Also:
-
getXmlFileName
Description copied from interface:I_CmsXmlConfigurationReturns the name of the XML input file for this configuration, e.g.opencms.xml.- Specified by:
getXmlFileNamein interfaceI_CmsXmlConfiguration- Returns:
- the name of the XML input file for this configuration
- See Also:
-
initConfiguration
Description copied from interface:I_CmsConfigurationParameterHandlerInitializes a configuration after all parameters have been added.- Specified by:
initConfigurationin interfaceI_CmsConfigurationParameterHandler- See Also:
-
loadXmlConfiguration
Loads the OpenCms configuration from the given XML file.- Throws:
SAXException- in case of XML parse errorsIOException- in case of file IO errors
-
setAdminCms
Sets the admin CmsObject.- Parameters:
cms- the admin CmsObject
-
setConfiguration
Sets the configuration read from theopencms.properties.- Parameters:
propertyConfiguration- the configuration read from theopencms.properties- See Also:
-
writeConfiguration
Writes the XML configuration for the provided configuration instance.- Parameters:
clazz- the configuration class to write the XML for- Throws:
IOException- in case of I/O errors while writingCmsConfigurationException- if the given class is not a valid configuration class
-