Package org.opencms.ade.configuration
Class CmsConfigurationReader
- java.lang.Object
-
- 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
Fields Modifier and Type Field Description static java.util.LocaleDEFAULT_LOCALEThe default locale for configuration objects.static java.lang.StringN_ADD_CONTENT_RESTRICTIONThe AddContentReplacements node name.static java.lang.StringN_ADD_FORMATTERNode name for added formatters.static java.lang.StringN_ADD_FORMATTERSNode name for the nested content with the added formatters.static java.lang.StringN_ADD_PLUGINThe AddPlugin node name.static java.lang.StringN_ADD_PLUGINSThe AddPlugins node name.static java.lang.StringN_ATTRIBUTEThe Attribute node name.static java.lang.StringN_CREATE_CONTENTS_LOCALLYThe create content locally node name.static java.lang.StringN_DEFAULTThe default node name.static java.lang.StringN_DESCRIPTIONThe description node name.static java.lang.StringN_DETAIL_PAGEThe detail page node name.static java.lang.StringN_DETAIL_PAGES_DISABLEDThe detail pages disabled node name.static java.lang.StringN_DISABLEDThe disabled node name.static java.lang.StringN_DISCARD_MODEL_PAGESThe discard model pages node name.static java.lang.StringN_DISCARD_PROPERTIESThe discard properties node name.static java.lang.StringN_DISCARD_TYPESThe discard types node name.static java.lang.StringN_DISPLAY_NAMEThe display name node name.static java.lang.StringN_ELEMENT_VIEWThe element view node name.static java.lang.StringN_ERRORThe error node name.static java.lang.StringN_EXCLUDE_EXTERNAL_DETAIL_CONTENTSThe 'exclude external detail contents' node name.static java.lang.StringN_FOLDERThe folder node name.static java.lang.StringN_FORMATTERThe formatter node name.static java.lang.StringN_FUNCTIONThe function node name.static java.lang.StringN_FUNCTION_DEFAULT_PAGEThe function node name.static java.lang.StringN_FUNCTION_REFThe function reference node name.static java.lang.StringN_INCLUDE_IN_SITE_SELECTORThe 'include in site selector' node name.static java.lang.StringN_IS_DEFAULTThe is default node name.static java.lang.StringN_IS_PREVIEWThe is preview node name.static java.lang.StringN_JSPThe JSP node name.static java.lang.StringN_KEYThe Key node name.static java.lang.StringN_LOCALIZATIONThe localization node name.static java.lang.StringN_MASTER_CONFIGThe master configuration node name.static java.lang.StringN_MAX_WIDTHThe max width node name.static java.lang.StringN_MIN_WIDTHThe min width node name.static java.lang.StringN_MODEL_PAGEThe model page node name.static java.lang.StringN_NAMEThe folder name node name.static java.lang.StringN_NAME_PATTERNThe name pattern node name.static java.lang.StringN_ORDERThe order node name.static java.lang.StringN_PAGEThe page node name.static java.lang.StringN_PATHThe folder path node name.static java.lang.StringN_PLUGINThe Plugin node name.static java.lang.StringN_PREFER_DETAIL_PAGES_FOR_LOCAL_CONTENTSThe PreferDetailPagesForLocalContents node name.static java.lang.StringN_PREFER_FOLDERThe prefer folder node name.static java.lang.StringN_PROPERTYThe property node name.static java.lang.StringN_PROPERTY_NAMEThe property name node name.static java.lang.StringN_REMOVE_ALL_FORMATTERSNode name for the "Remove all formatters"-option.static java.lang.StringN_REMOVE_ALL_FUNCTIONSField name for the 'Remove all functions' setting.static java.lang.StringN_REMOVE_ALL_PLUGINSThe RemoveAllPlugins node name.static java.lang.StringN_REMOVE_ALL_SHARED_SETTING_OVERRIDESThe RemoveAllSharedSettingOverrides node name.static java.lang.StringN_REMOVE_FORMATTERNode name for removed formatters.static java.lang.StringN_REMOVE_FORMATTERSNode name for the nested content with the removed formatters.static java.lang.StringN_REMOVE_FUNCTIONSThe remove function node name.static java.lang.StringN_REMOVE_PLUGINThe RemovePlugin node name.static java.lang.StringN_REMOVE_PLUGINSThe RemovePlugins node name.static java.lang.StringN_RESOURCE_TYPEThe resource type node name.static java.lang.StringN_RULE_REGEXThe regex rule node name.static java.lang.StringN_RULE_TYPEThe rule type node name.static java.lang.StringN_SHARED_SETTING_OVERRIDEThe SharedSettingOverride node name.static java.lang.StringN_TYPEThe type node name.static java.lang.StringN_TYPE_NAMEThe type name node name.static java.lang.StringN_TYPE_ORDERING_MODEThe node name for the type ordering mode.static java.lang.StringN_USE_FORMATTER_KEYSNode name.static java.lang.StringN_VALUEThe Value node name.static java.lang.StringN_VISIBILITYThe widget node name.static java.lang.StringN_WIDGETThe widget node name.static java.lang.StringN_WIDGET_CONFIGThe widget configuration node name.static java.lang.StringVIEW_SCHEMEScheme for explorer type view links.
-
Constructor Summary
Constructors Constructor Description CmsConfigurationReader(CmsObject cms)Creates a new configuration reader.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleangetBoolean(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.java.util.List<CmsModelPageConfigWithoutResource>getModelPageConfigs()Returns the modelPageConfigs.static java.lang.StringgetString(CmsObject cms, I_CmsXmlContentValueLocation location)Gets the string value of an XML content location.protected java.lang.StringgetString(I_CmsXmlContentValueLocation location)Gets the string value of an XML content location.java.util.Set<java.lang.String>parseAddFormatters(I_CmsXmlContentLocation node)Parses the formatters to add.CmsADEConfigDataInternalparseConfiguration(java.lang.String basePath, CmsXmlContent content)Parses a configuration XML content and creates a configuration object from it.protected voidparseDetailPage(I_CmsXmlContentLocation node)Parses the detail pages from an XML content node.CmsContentFolderDescriptorparseFolderOrName(java.lang.String basePath, I_CmsXmlContentLocation location)Parses a folder which may either be given as a path or as a folder name.CmsFormatterBeanparseFormatter(java.lang.String typeName, I_CmsXmlContentLocation node)Parses a formatter bean.protected CmsFormatterChangeSetparseFormatterChangeSet(java.lang.String basePath, I_CmsXmlContentLocation node, boolean removeAllFormatters, boolean removeFunctions, java.util.Set<CmsUUID> functions, java.util.Set<CmsUUID> functionsToRemove)Parses the formatter change set.protected voidparseFunctionReference(I_CmsXmlContentLocation node)Parses a function reference node.voidparseModelPage(I_CmsXmlContentLocation node)Parses model page data from the XML content.static CmsPropertyConfigparseProperty(CmsObject cms, I_CmsXmlContentLocation field)Helper method to parse a property.java.util.Set<java.lang.String>parseRemoveFormatters(I_CmsXmlContentLocation node)Parses the set of formatters to remove.voidparseResourceTypeConfig(java.lang.String basePath, I_CmsXmlContentLocation node)Parses a resource type configuration element from the XML content.CmsADEConfigDataInternalparseSitemapConfiguration(java.lang.String basePath, CmsResource configRes)Parses the sitemap configuration given the configuration file and base path.java.util.List<CmsADEConfigDataInternal>readModuleConfigurations()Reads the configurations of all modules and combines them into a single configuration object.
-
-
-
Field Detail
-
DEFAULT_LOCALE
public static final java.util.Locale DEFAULT_LOCALE
The default locale for configuration objects.
-
N_ADD_CONTENT_RESTRICTION
public static final java.lang.String N_ADD_CONTENT_RESTRICTION
The AddContentReplacements node name.- See Also:
- Constant Field Values
-
N_ADD_FORMATTER
public static final java.lang.String N_ADD_FORMATTER
Node name for added formatters.- See Also:
- Constant Field Values
-
N_ADD_FORMATTERS
public static final java.lang.String N_ADD_FORMATTERS
Node name for the nested content with the added formatters.- See Also:
- Constant Field Values
-
N_ADD_PLUGIN
public static final java.lang.String N_ADD_PLUGIN
The AddPlugin node name.- See Also:
- Constant Field Values
-
N_ADD_PLUGINS
public static final java.lang.String N_ADD_PLUGINS
The AddPlugins node name.- See Also:
- Constant Field Values
-
N_ATTRIBUTE
public static final java.lang.String N_ATTRIBUTE
The Attribute node name.- See Also:
- Constant Field Values
-
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_SHARED_SETTING_OVERRIDE
public static final java.lang.String N_SHARED_SETTING_OVERRIDE
The SharedSettingOverride node name.- See Also:
- Constant Field Values
-
N_REMOVE_ALL_SHARED_SETTING_OVERRIDES
public static final java.lang.String N_REMOVE_ALL_SHARED_SETTING_OVERRIDES
The RemoveAllSharedSettingOverrides 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_ELEMENT_VIEW
public static final java.lang.String N_ELEMENT_VIEW
The element view 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_EXCLUDE_EXTERNAL_DETAIL_CONTENTS
public static final java.lang.String N_EXCLUDE_EXTERNAL_DETAIL_CONTENTS
The 'exclude external detail contents' 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_DEFAULT_PAGE
public static final java.lang.String N_FUNCTION_DEFAULT_PAGE
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_INCLUDE_IN_SITE_SELECTOR
public static final java.lang.String N_INCLUDE_IN_SITE_SELECTOR
The 'include in site selector' 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_KEY
public static final java.lang.String N_KEY
The Key node name.- See Also:
- Constant Field Values
-
N_LOCALIZATION
public static final java.lang.String N_LOCALIZATION
The localization node name.- See Also:
- Constant Field Values
-
N_MASTER_CONFIG
public static final java.lang.String N_MASTER_CONFIG
The master configuration 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_PLUGIN
public static final java.lang.String N_PLUGIN
The Plugin node name.- See Also:
- Constant Field Values
-
N_PREFER_DETAIL_PAGES_FOR_LOCAL_CONTENTS
public static final java.lang.String N_PREFER_DETAIL_PAGES_FOR_LOCAL_CONTENTS
The PreferDetailPagesForLocalContents 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_REMOVE_ALL_FORMATTERS
public static final java.lang.String N_REMOVE_ALL_FORMATTERS
Node name for the "Remove all formatters"-option.- See Also:
- Constant Field Values
-
N_REMOVE_ALL_FUNCTIONS
public static final java.lang.String N_REMOVE_ALL_FUNCTIONS
Field name for the 'Remove all functions' setting.- See Also:
- Constant Field Values
-
N_REMOVE_ALL_PLUGINS
public static final java.lang.String N_REMOVE_ALL_PLUGINS
The RemoveAllPlugins node name.- See Also:
- Constant Field Values
-
N_REMOVE_FORMATTER
public static final java.lang.String N_REMOVE_FORMATTER
Node name for removed formatters.- See Also:
- Constant Field Values
-
N_REMOVE_FORMATTERS
public static final java.lang.String N_REMOVE_FORMATTERS
Node name for the nested content with the removed formatters.- See Also:
- Constant Field Values
-
N_REMOVE_FUNCTIONS
public static final java.lang.String N_REMOVE_FUNCTIONS
The remove function node name.- See Also:
- Constant Field Values
-
N_REMOVE_PLUGIN
public static final java.lang.String N_REMOVE_PLUGIN
The RemovePlugin node name.- See Also:
- Constant Field Values
-
N_REMOVE_PLUGINS
public static final java.lang.String N_REMOVE_PLUGINS
The RemovePlugins 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_TYPE_ORDERING_MODE
public static final java.lang.String N_TYPE_ORDERING_MODE
The node name for the type ordering mode.- See Also:
- Constant Field Values
-
N_USE_FORMATTER_KEYS
public static final java.lang.String N_USE_FORMATTER_KEYS
Node name.- See Also:
- Constant Field Values
-
N_VALUE
public static final java.lang.String N_VALUE
The Value node name.- See Also:
- Constant Field Values
-
N_VISIBILITY
public static final java.lang.String N_VISIBILITY
The widget 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
-
VIEW_SCHEME
public static final java.lang.String VIEW_SCHEME
Scheme for explorer type view links.- 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
-
getString
public static java.lang.String getString(CmsObject cms, I_CmsXmlContentValueLocation location)
Gets the string value of an XML content location.- Parameters:
cms- the CMS context to uselocation- an XML content location- Returns:
- the string value of that XML content location
-
parseProperty
public static CmsPropertyConfig parseProperty(CmsObject cms, I_CmsXmlContentLocation field)
Helper method to parse a property.- Parameters:
cms- the CMS context to usefield- the location of the parent value- Returns:
- the parsed property configuration
-
getFunctionReferences
public java.util.List<CmsFunctionReference> getFunctionReferences()
Returns the list of function references.- Returns:
- the list of function references
-
getModelPageConfigs
public java.util.List<CmsModelPageConfigWithoutResource> getModelPageConfigs()
Returns the modelPageConfigs.- Returns:
- the modelPageConfigs
-
parseAddFormatters
public java.util.Set<java.lang.String> parseAddFormatters(I_CmsXmlContentLocation node)
Parses the formatters to add.- Parameters:
node- the parent node- Returns:
- the set of keys of the formatters to add
-
parseConfiguration
public CmsADEConfigDataInternal 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 pathcontent- the XML content- Returns:
- the created configuration object with the data from the XML content
- Throws:
CmsException- if something goes wrong
-
parseFolderOrName
public CmsContentFolderDescriptor 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 configurationlocation- 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 parsednode- the node from which to parse the formatter data- Returns:
- the formatter bean from the XML
-
parseModelPage
public void parseModelPage(I_CmsXmlContentLocation node)
Parses model page data from the XML content.- Parameters:
node- the XML content node
-
parseRemoveFormatters
public java.util.Set<java.lang.String> parseRemoveFormatters(I_CmsXmlContentLocation node)
Parses the set of formatters to remove.- Parameters:
node- the parent node- Returns:
- the set of formatters to remove
-
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 configurationnode- the XML configuration node- Throws:
CmsException- if something goes wrong
-
parseSitemapConfiguration
public CmsADEConfigDataInternal parseSitemapConfiguration(java.lang.String basePath, CmsResource configRes) throws CmsException
Parses the sitemap configuration given the configuration file and base path.- Parameters:
basePath- the base pathconfigRes- the configuration file resource- Returns:
- the parsed configuration data
- Throws:
CmsException- if something goes wrong
-
readModuleConfigurations
public java.util.List<CmsADEConfigDataInternal> 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 nodename- 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
-
parseDetailPage
protected void parseDetailPage(I_CmsXmlContentLocation node)
Parses the detail pages from an XML content node.- Parameters:
node- the XML content node
-
parseFormatterChangeSet
protected CmsFormatterChangeSet parseFormatterChangeSet(java.lang.String basePath, I_CmsXmlContentLocation node, boolean removeAllFormatters, boolean removeFunctions, java.util.Set<CmsUUID> functions, java.util.Set<CmsUUID> functionsToRemove)
Parses the formatter change set.- Parameters:
basePath- the configuration base pathnode- the parent noderemoveAllFormatters- flag, indicating if all formatters that are not explicitly added should be removedremoveFunctions- if true, remove functionsfunctions- the functions to addfunctionsToRemove- the functions to remove- Returns:
- the formatter change set
-
parseFunctionReference
protected void parseFunctionReference(I_CmsXmlContentLocation node)
Parses a function reference node.- Parameters:
node- the function reference node
-
-