public class XMLConfiguration extends Object implements com.sdl.delivery.configuration.Configuration
Configuration
which can hold configuration items and values built from the legacy
XML-based configuration; such as, cd_dynamic_conf.xml
, cd_storage_conf.xml
, etc...Constructor and Description |
---|
XMLConfiguration(Node xmlConfiguration)
Creates an instance of
XMLConfiguration by extracting the configuration from the given
XML node. |
Modifier and Type | Method and Description |
---|---|
com.sdl.delivery.configuration.Configuration |
getConfiguration(com.sdl.delivery.configuration.ConfigurationPath path)
Get the configuration for the given path.
|
com.sdl.delivery.configuration.Configuration |
getConfiguration(String childName)
Gets the child configuration with the given name, if multiple children with same name are present it
will return the first occurrence.
|
List<com.sdl.delivery.configuration.Configuration> |
getConfigurations()
Gets the list of all configurations that are direct descendants of this configuration item.
|
List<com.sdl.delivery.configuration.Configuration> |
getConfigurations(com.sdl.delivery.configuration.ConfigurationPath path)
Get the list of configurations for the given path.
|
String |
getName()
Get the name of the 'Configuration'.
|
String |
getTextContent()
Provide support to get the text content from an xml element.
|
com.sdl.delivery.configuration.Value |
getValue(String name)
Get the generic value from a 'Configuration Value' accessed by the given name.
|
Map<String,com.sdl.delivery.configuration.Value> |
getValues()
Get all the generic values from the list of 'Configuration Values' hold by the 'Configuration Item'.
|
boolean |
hasValue(String name)
Checks whether there is a value of this name present.
|
com.sdl.delivery.configuration.Configuration |
merge(com.sdl.delivery.configuration.Configuration config,
String schemaFile)
Merge given Configuration with the current Configuration.
|
String |
toString()
Overrides the standard
String representation of this object. |
public XMLConfiguration(Node xmlConfiguration)
XMLConfiguration
by extracting the configuration from the given
XML node.xmlConfiguration
- The given XML node. It can not be null
.public String getName()
com.sdl.delivery.configuration.Configuration
getName
in interface com.sdl.delivery.configuration.Configuration
public String getTextContent() throws com.sdl.delivery.configuration.ConfigurationException
com.sdl.delivery.configuration.ConfigurationException
public com.sdl.delivery.configuration.Configuration getConfiguration(com.sdl.delivery.configuration.ConfigurationPath path) throws com.sdl.delivery.configuration.ConfigurationException
com.sdl.delivery.configuration.Configuration
Get the configuration for the given path. Take into account that sometimes a given path could lead to a list of configurations of the same type grouped inside a parent configuration. By using this method, in case of the path lead to a list of configurations of the same type, it would return either the configuration referred by the last configuration step inside the path, or the first configuration of the list if the configuration step does not specify which configuration to select. In the case the path lead to a single configuration, such configuration would be retrieved.
Examples:
Get Configurations for path : URLMappings | StaticMappings | Publications | Publication
URLMappings StaticMappings Publications Publication id = 1 Publication id = 2 Result: Publication(id = 1) or any of the 2 publications in the case a particular Publication is specified in the last step of the path.
Get Configurations for path : URLMappings | StaticMappings | Publications
URLMappings StaticMappings Publications Result: Publications
getConfiguration
in interface com.sdl.delivery.configuration.Configuration
path
- The given path.null
if not found.com.sdl.delivery.configuration.ConfigurationException
public com.sdl.delivery.configuration.Configuration getConfiguration(String childName) throws com.sdl.delivery.configuration.ConfigurationException
com.sdl.delivery.configuration.Configuration
getConfiguration
in interface com.sdl.delivery.configuration.Configuration
childName
- The name of the childcom.sdl.delivery.configuration.ConfigurationException
- If unable to get the child configurationpublic List<com.sdl.delivery.configuration.Configuration> getConfigurations(com.sdl.delivery.configuration.ConfigurationPath path) throws com.sdl.delivery.configuration.ConfigurationException
com.sdl.delivery.configuration.Configuration
Examples:
Get Configuration for path : URLMappings | StaticMappings | Publications | Publication
URLMappings StaticMappings Publications Publication id = 1 Publication id = 2 Result: {Publication(id = 1), Publication(id = 2)}
Get Configurations for path : URLMappings | StaticMappings | Publications
URLMappings StaticMappings Publications Result: {Publications}
getConfigurations
in interface com.sdl.delivery.configuration.Configuration
path
- The given path.null
if not found.com.sdl.delivery.configuration.ConfigurationException
public List<com.sdl.delivery.configuration.Configuration> getConfigurations()
com.sdl.delivery.configuration.Configuration
getConfigurations
in interface com.sdl.delivery.configuration.Configuration
null
if not foundpublic boolean hasValue(String name)
com.sdl.delivery.configuration.Configuration
hasValue
in interface com.sdl.delivery.configuration.Configuration
name
- The name of the value to checkpublic com.sdl.delivery.configuration.Value getValue(String name) throws com.sdl.delivery.configuration.ConfigurationException
com.sdl.delivery.configuration.Configuration
getValue
in interface com.sdl.delivery.configuration.Configuration
name
- The given name to access the 'Configuration Value'.com.sdl.delivery.configuration.ConfigurationException
public Map<String,com.sdl.delivery.configuration.Value> getValues() throws com.sdl.delivery.configuration.ConfigurationException
com.sdl.delivery.configuration.Configuration
getValues
in interface com.sdl.delivery.configuration.Configuration
com.sdl.delivery.configuration.ConfigurationException
public com.sdl.delivery.configuration.Configuration merge(com.sdl.delivery.configuration.Configuration config, String schemaFile) throws com.sdl.delivery.configuration.ConfigurationException
com.sdl.delivery.configuration.Configuration
merge
in interface com.sdl.delivery.configuration.Configuration
config
- to merge with the current one.schemaFile
- the possible schema this configcom.sdl.delivery.configuration.ConfigurationException
- if unable to merge.Copyright (c) 2014-2021 All Rights Reserved by the RWS Group for and on behalf of its affiliates and subsidiaries