Class OperationalDefaultsPreprocessor
- java.lang.Object
-
- com.tangosol.coherence.config.xml.preprocessor.OperationalDefaultsPreprocessor
-
- All Implemented Interfaces:
DocumentElementPreprocessor.ElementPreprocessor
public class OperationalDefaultsPreprocessor extends Object implements DocumentElementPreprocessor.ElementPreprocessor
AOperationalDefaultsPreprocessor
is anDocumentElementPreprocessor.ElementPreprocessor
that introduces (via cloning) default xml content for xml elements where the said content is missing.Ultimately this
DocumentElementPreprocessor.ElementPreprocessor
is designed to perform pre-processing of Coherence cache-config.xml files to inject appropriate Operational Config elements defined separately in tangosol-coherence.*.xml files.- Since:
- Coherence 12.1.2
- Author:
- bo 2012.01.10
-
-
Constructor Summary
Constructors Constructor Description OperationalDefaultsPreprocessor()
Constructs aOperationalDefaultsPreprocessor
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDefaultsDefinition(String sPath, XmlElement defaultsElement)
Defines that elements matching the specified path must contain the child elements defined by the default element.boolean
preprocess(ProcessingContext context, XmlElement element)
Process anXmlElement
, optionally mutating it (or it's children) if required.
-
-
-
Constructor Detail
-
OperationalDefaultsPreprocessor
public OperationalDefaultsPreprocessor()
Constructs aOperationalDefaultsPreprocessor
.
-
-
Method Detail
-
preprocess
public boolean preprocess(ProcessingContext context, XmlElement element) throws ConfigurationException
Process anXmlElement
, optionally mutating it (or it's children) if required.Note: An implementation of this interface should avoid attempting to traverse child
XmlElement
s. If you wish to manually traverse or change the entire document, you should instead use aDocumentPreprocessor
.- Specified by:
preprocess
in interfaceDocumentElementPreprocessor.ElementPreprocessor
- Parameters:
context
- theProcessingContext
in which the pre-processing is occurringelement
- theXmlElement
to preprocess- Returns:
true
if the specifiedXmlElement
should be re-preprocessed by this and otherDocumentElementPreprocessor.ElementPreprocessor
s due to theXmlElement
being modified,false
otherwise.- Throws:
ConfigurationException
- if during pre-processing of theXmlElement
a configuration issue was discovered (or if pre-processing fails for some reason)
-
addDefaultsDefinition
public void addDefaultsDefinition(String sPath, XmlElement defaultsElement)
Defines that elements matching the specified path must contain the child elements defined by the default element. If not the missing children must be cloned from the default element into the element matching the path during pre-processing.Paths used by this method are based those defined by the
XmlHelper.findElement(XmlElement, String)
method, with the exception that ".." is not supported.For example 1: The following specifies that the elements matching the absolute path "/caching-schemes/distributed-scheme" must contain the children defined by the xmlDistributedSchemeDefaults element. If not, they must be cloned into place.
addDefaultsDefinition("/caching-schemes/distributed-scheme", xmlDistributedSchemeDefaults);
For example 2: The following specifies that the elements matching the relative path "distributed-scheme" must contain the children defined by the xmlDistributedSchemeDefaults element. If not, they must be cloned into place.
addDefaultsDefinition("distributed-scheme", xmlDistributedSchemeDefaults);
- Parameters:
sPath
- The path of elements requiring the defaultsdefaultsElement
- The xml element containing the required defaults for the specified path
-
-