Class CacheDefaultsPreprocessor
- java.lang.Object
-
- com.tangosol.coherence.config.xml.preprocessor.CacheDefaultsPreprocessor
-
- All Implemented Interfaces:
DocumentElementPreprocessor.ElementPreprocessor
public class CacheDefaultsPreprocessor extends Object implements DocumentElementPreprocessor.ElementPreprocessor
ACacheDefaultsPreprocessoris anDocumentElementPreprocessor.ElementPreprocessorthat introduces (via cloning) default xml content for xml elements where the said content is missing.Ultimately this
DocumentElementPreprocessor.ElementPreprocessoris designed to perform pre-processing of Coherence Cache <defaults> declarations, inserting them into the appropriate places in cache-config.xml documents.- Since:
- Coherence 12.1.2
- Author:
- bo 2011.12.16
- See Also:
OperationalDefaultsPreprocessor
-
-
Constructor Summary
Constructors Constructor Description CacheDefaultsPreprocessor(String sDefaultsParentPath)Constructs aCacheDefaultsPreprocessorwith a specific path to where default element content can be located.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDefaultDefinition(String sRequiredElementParentPath, String sRequiredElementName)Adds a requirement that the specified "default" element must be added to (if not already defined) in the element specified by the defined parent path.booleanpreprocess(ProcessingContext context, XmlElement element)Process anXmlElement, optionally mutating it (or it's children) if required.
-
-
-
Constructor Detail
-
CacheDefaultsPreprocessor
public CacheDefaultsPreprocessor(String sDefaultsParentPath)
Constructs aCacheDefaultsPreprocessorwith a specific path to where default element content can be located.Example:
new DefaultPreprocessor("/defaults");- Parameters:
sDefaultsParentPath- the absolute path to theXmlElementthat contains (is the parent of) the default elements
-
-
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
XmlElements. If you wish to manually traverse or change the entire document, you should instead use aDocumentPreprocessor.- Specified by:
preprocessin interfaceDocumentElementPreprocessor.ElementPreprocessor- Parameters:
context- theProcessingContextin which the pre-processing is occurringelement- theXmlElementto preprocess- Returns:
trueif the specifiedXmlElementshould be re-preprocessed by this and otherDocumentElementPreprocessor.ElementPreprocessors due to theXmlElementbeing modified,falseotherwise.- Throws:
ConfigurationException- if during pre-processing of theXmlElementa configuration issue was discovered (or if pre-processing fails for some reason)
-
addDefaultDefinition
public void addDefaultDefinition(String sRequiredElementParentPath, String sRequiredElementName)
Adds a requirement that the specified "default" element must be added to (if not already defined) in the element specified by the defined parent path.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 call specifies that the "serializer" should be cloned from the defined default path if it doesn't exist in the "/caching-schemes/distributed-scheme" element.
addDefaultDefinition("/caching-schemes/distributed-scheme", "serializer");For example 2: The following call specifies that the "serializer" should be cloned from the defined default path if it doesn't exist in any "distributed-scheme" elements
addDefaultDefinition("distributed-scheme", "serializer");- Parameters:
sRequiredElementParentPath- the path of the parent for the required elementsRequiredElementName- the name of the element that should be cloned (if it doesn't exist in the specified parent path) from the defined default element path
-
-