Class DefaultProcessingContext
- java.lang.Object
- 
- com.tangosol.config.xml.DefaultProcessingContext
 
- 
- All Implemented Interfaces:
- ProcessingContext,- ResourceResolver,- AutoCloseable
 
 public class DefaultProcessingContext extends Object implements ProcessingContext, AutoCloseable The default implementation of aProcessingContext.- Since:
- Coherence 12.1.2
- Author:
- bo 2011.06.14
 
- 
- 
Constructor SummaryConstructors Constructor Description DefaultProcessingContext()DefaultProcessingContext(DefaultProcessingContext ctxParent, XmlElement xmlElement)Constructs a sub-ProcessingContextof anotherProcessingContext.DefaultProcessingContext(DocumentProcessor.Dependencies dependencies)Constructs a rootProcessingContextwith the specifiedDocumentProcessorDocumentProcessor.Dependencies.DefaultProcessingContext(DocumentProcessor.Dependencies dependencies, XmlElement xmlElement)Constructs a rootProcessingContextfor a givenXmlElement.DefaultProcessingContext(XmlElement xmlElement)Constructs a rootProcessingContextfor a givenXmlElementusing default DocumentProcessor dependencies.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> voidaddCookie(Class<T> clzCookie, String sName, T value)Adds the specified named and typed cookie to theProcessingContext.<T> voidaddCookie(Class<T> clzCookie, T cookie)Adds the specified cookie to theProcessingContext.voidclose()voiddefinePropertyPath(String sBeanPropertyName, String sXmlPath)Defines the xml path to locate a specific Java Bean property with in anXmlElementin theProcessingContext.NamespaceHandlerensureNamespaceHandler(String sPrefix, NamespaceHandler handler)Ensures that the specifiedNamespaceHandlerfor the specified prefix is defined in thisProcessingContext.NamespaceHandlerensureNamespaceHandler(String sPrefix, URI uri)Ensures that anNamespaceHandlerwith the specifiedURIis available for use in theProcessingContextwith the specified prefix.ClassLoadergetContextClassLoader()Obtains theClassLoaderto use for loading classes in theProcessingContext.<T> TgetCookie(Class<T> clzCookie)Locates and returns the cookie with the specified type.<T> TgetCookie(Class<T> clzCookie, String sName)Locates and returns the cookie with the specified type and name.ParameterResolvergetDefaultParameterResolver()Obtains theParameterResolverto use for resolving parameters defined externally to the document being processed (ie: the operating system or container)DocumentProcessor.DependenciesgetDependencies()ExpressionParsergetExpressionParser()Obtains the configuredExpressionParserfor thisProcessingContext.<T> TgetMandatoryProperty(String sPath, Type typeProperty, XmlElement xmlParent)Obtains the strongly typed value for the property defined at the path relative to the specifiedXmlElement.NamespaceHandlergetNamespaceHandler(String sPrefix)Obtains theNamespaceHandlerwhich is capable of processing the namespace with the specified prefix.NamespaceHandlergetNamespaceHandler(URI uri)Obtains theNamespaceHandlerthat is capable of processing the namespace defined with the specifiedURI.Iterable<NamespaceHandler>getNamespaceHandlers()Obtains theNamespaceHandlers that are currently in scope for thisProcessingContext.URIgetNamespaceURI(String sPrefix)Obtains theURIthat is associated with the specified prefix.<T> TgetOptionalProperty(String sPropertyName, Type typeProperty, T defaultValue, XmlElement xmlElement)Obtains the strongly typed value for the property defined at the path relative to the specifiedXmlElement.ValuegetPropertyValue(String sPropertyName, Type typeProperty, XmlElement xmlParent, boolean fOnlyUsePropertyName)Attempts to resolve the named property of the specified type in the current context and if required will parse the specifiedXmlElementin order to do so.<R> RgetResource(Class<R> clsResource)Attempts to retrieve the resource that was registered with the specified class.<R> RgetResource(Class<R> clsResource, String sResourceName)Attempts to retrieve the resource that was registered with the specified class and name.ResourceRegistrygetResourceRegistry()Obtains theResourceRegistryassociated with theProcessingContext.<B> Binject(B bean, XmlElement xmlElement)Given the information available in theProcessingContext, including the cookies, theResourceRegistrytheXmlElement, itsXmlAttributes and/or children, inject appropriately named and typed values into the specified bean (using setter injection).booleanisPropertyDefined(String sPropertyName, XmlElement xmlParent)Determines if the specified property is defined at the path relative to the specifiedXmlElement.booleanisRootContext()Determines if theProcessingContextis the root.voidloadNamespaceHandlers(XmlElement xmlElement)Load all the customNamespaceHandlerinstances for the specifiedXmlElement.ObjectprocessDocument(XmlElement xmlElement)Request that the specifiedXmlElement(representing the root of an XmlDocument) be processed with appropriateNamespaceHandlers.ObjectprocessDocument(String sXml)Request that the specified xml string (representing an xml document) be processed with appropriateNamespaceHandlers.ObjectprocessDocumentAt(String sLocation)Request that the document specified by the URI/filename (containing the root of an XmlDocument) be processed with appropriateNamespaceHandlers.ObjectprocessDocumentAt(URI uri)Request that the document specified by the URI/filename (containing the root of an XmlDocument) be processed with appropriateNamespaceHandlers.ObjectprocessElement(XmlElement xmlElement)Request the specifiedXmlElementto be processed with an appropriateNamespaceHandlerknown by theProcessingContextor outerProcessingContexts.ObjectprocessElement(String sXml)Request the specified xml string be processed with an appropriateNamespaceHandlerknown by theProcessingContext.Map<String,?>processElementsOf(XmlElement xmlElement)Request that all of the child elements contained with in the specifiedXmlElementbe processed using appropriateNamespaceHandlers known by theProcessingContext.Map<String,?>processForeignElementsOf(XmlElement xmlElement)Request that all of the child elements contained within the specifiedXmlElementthat do not belong to the namespace of the saidXmlElementare processed using appropriate processes.<T> TprocessOnlyElementOf(XmlElement xmlElement)Request that the only child element contained within theXmlElementis processed using an appropriateNamespaceHandlerknown by theProcessingContext.<T> TprocessRemainingElementOf(XmlElement xmlElement)Request that the last remaining unprocessed child element contained within the specifiedXmlElementis processed using an appropriateElementProcessor.Map<String,?>processRemainingElementsOf(XmlElement xmlElement)Request that the last remaining unprocessed children contained within the specifiedXmlElementare processed using appropriateElementProcessors.<T> voidregisterAttributeType(Class<T> clzType)Automatically creates and registers anAttributeProcessorfor the specified type.<T> voidregisterElementType(Class<T> clzType)Automatically creates and registers anElementProcessorfor the specified type.<T> voidregisterProcessor(Class<T> clzType, AttributeProcessor<T> processor)Registers anAttributeProcessorthat may be used to process specific types of values contained inXmlAttributes with in theProcessingContext.<T> voidregisterProcessor(Class<T> clzType, ElementProcessor<T> processor)Registers anElementProcessorthat may be used to process specific types of values contained inXmlElements with in theProcessingContext.
 
- 
- 
- 
Constructor Detail- 
DefaultProcessingContextpublic DefaultProcessingContext() 
 - 
DefaultProcessingContextpublic DefaultProcessingContext(DocumentProcessor.Dependencies dependencies) Constructs a rootProcessingContextwith the specifiedDocumentProcessorDocumentProcessor.Dependencies.- Parameters:
- dependencies- the- DocumentProcessor.Dependenciesfor the- ProcessingContext
 
 - 
DefaultProcessingContextpublic DefaultProcessingContext(XmlElement xmlElement) Constructs a rootProcessingContextfor a givenXmlElementusing default DocumentProcessor dependencies.- Parameters:
- xmlElement- the- XmlElementfor the- ProcessingContext
 
 - 
DefaultProcessingContextpublic DefaultProcessingContext(DefaultProcessingContext ctxParent, XmlElement xmlElement) Constructs a sub-ProcessingContextof anotherProcessingContext.- Parameters:
- ctxParent- the parent- ProcessingContextfor this- ProcessingContext
- xmlElement- the- XmlElementfor the sub-- ProcessingContext
 
 - 
DefaultProcessingContextpublic DefaultProcessingContext(DocumentProcessor.Dependencies dependencies, XmlElement xmlElement) Constructs a rootProcessingContextfor a givenXmlElement.- Parameters:
- dependencies- the- DocumentProcessor.Dependenciesfor the- ProcessingContext
- xmlElement- the- XmlElementfor the- ProcessingContext
 
 
- 
 - 
Method Detail- 
getResourcepublic <R> R getResource(Class<R> clsResource) Attempts to retrieve the resource that was registered with the specified class.- Specified by:
- getResourcein interface- ResourceResolver
- Type Parameters:
- R- the type of the resource
- Parameters:
- clsResource- the class of the resource
- Returns:
- the registered resource or nullif the resource is unknown to theResourceRegistry
 
 - 
getResourcepublic <R> R getResource(Class<R> clsResource, String sResourceName) Attempts to retrieve the resource that was registered with the specified class and name.- Specified by:
- getResourcein interface- ResourceResolver
- Type Parameters:
- R- the type of the resource
- Parameters:
- clsResource- the class of the resource
- sResourceName- the name of the resource
- Returns:
- the registered resource or nullif the resource is unknown to theResourceRegistry
 
 - 
getResourceRegistrypublic ResourceRegistry getResourceRegistry() Obtains theResourceRegistryassociated with theProcessingContext.- Specified by:
- getResourceRegistryin interface- ProcessingContext
- Returns:
- a ResourceRegistry
 
 - 
getDefaultParameterResolverpublic ParameterResolver getDefaultParameterResolver() Obtains theParameterResolverto use for resolving parameters defined externally to the document being processed (ie: the operating system or container)- Specified by:
- getDefaultParameterResolverin interface- ProcessingContext
- Returns:
- the default ParameterResolver.
 
 - 
getContextClassLoaderpublic ClassLoader getContextClassLoader() Obtains theClassLoaderto use for loading classes in theProcessingContext.- Specified by:
- getContextClassLoaderin interface- ProcessingContext
- Returns:
- ClassLoader
 
 - 
addCookiepublic <T> void addCookie(Class<T> clzCookie, String sName, T value) Adds the specified named and typed cookie to theProcessingContext.If a cookie with the same name and type exists in the ProcessingContext, it will be replaced by the specified cookie. If a cookie with the same name and type has been defined in an outerProcessingContext, the specified cookie will hide the cookie defined in the outerProcessingContext.- Specified by:
- addCookiein interface- ProcessingContext
- Type Parameters:
- T- the type of the cookie
- Parameters:
- clzCookie- the class of the cookie
- sName- the name of the cookie
- value- the cookie value
 
 - 
addCookiepublic <T> void addCookie(Class<T> clzCookie, T cookie) Adds the specified cookie to theProcessingContext.If a cookie of the same type and name (being the name of the class of the said cookie) is already registered with the ProcessingContext, it will be replaced by the specified cookie.If a cookie of the same type and name has been defined in an outer ProcessingContext, the specified cookie will hide the cookie defined in the outerProcessingContext.This method is equivalent to calling: addCookie(clz, clz.getName(), cookie);- Specified by:
- addCookiein interface- ProcessingContext
- Type Parameters:
- T- the type of the cookie
- Parameters:
- clzCookie- the class of the cookie
- cookie- the cookie value
 
 - 
getCookiepublic <T> T getCookie(Class<T> clzCookie, String sName) Locates and returns the cookie with the specified type and name.Locating the cookie involves searching the current ProcessingContextfor a matching cookie. If one is not found, the search continues with outerProcessingContexts until a cookie is either located or there are no moreProcessingContexts, in which casenullis returned.- Specified by:
- getCookiein interface- ProcessingContext
- Type Parameters:
- T- the type of the cookie
- Parameters:
- clzCookie- the class of the cookie
- sName- the name of the cookie
- Returns:
- the cookie or nullif not defined
 
 - 
getCookiepublic <T> T getCookie(Class<T> clzCookie) Locates and returns the cookie with the specified type.Locating the cookie involves searching the current ProcessingContextfor a matching cookie. If one is not found, the search continues with outerProcessingContexts until a cookie is either located or there are no moreProcessingContexts, in which casenullis returned.This method is equivalent to calling: getCookie(clz, clz.getName());- Specified by:
- getCookiein interface- ProcessingContext
- Type Parameters:
- T- the type of the cookie
- Parameters:
- clzCookie- the class of the cookie
- Returns:
- the cookie or nullif not defined
 
 - 
definePropertyPathpublic void definePropertyPath(String sBeanPropertyName, String sXmlPath) Defines the xml path to locate a specific Java Bean property with in anXmlElementin theProcessingContext.This method allows "alias" paths for Java Bean properties to be defined so that ProcessingContext.inject(Object, XmlElement)calls may resolve property values correctly.This is an advanced feature. Typically this is only used when: - A Java Bean property name does not match a named value, XmlElementorXmlAttributewith in aProcessingContext.
- A Java Bean property can not be located with in the ProcessingContext.
 - Specified by:
- definePropertyPathin interface- ProcessingContext
- Parameters:
- sBeanPropertyName- the property name of the bean
- sXmlPath- the xmlPath to the property value
 
- A Java Bean property name does not match a named value, 
 - 
registerProcessorpublic <T> void registerProcessor(Class<T> clzType, AttributeProcessor<T> processor) Registers anAttributeProcessorthat may be used to process specific types of values contained inXmlAttributes with in theProcessingContext.When an AttributeProcessorisn't provided by the associatedNamespaceHandlerfor anXmlAttribute, an attempt is made to use a type specificAttributeProcessorto process anXmlAttributefor injection (withProcessingContext.inject(Object, XmlElement)).- Specified by:
- registerProcessorin interface- ProcessingContext
- Type Parameters:
- T- the type
- Parameters:
- clzType- the- Classtype
- processor- the- AttributeProcessorfor the type
 
 - 
registerProcessorpublic <T> void registerProcessor(Class<T> clzType, ElementProcessor<T> processor) Registers anElementProcessorthat may be used to process specific types of values contained inXmlElements with in theProcessingContext.When an ElementProcessorisn't provided by the associatedNamespaceHandlerfor anXmlElement, an attempt is made to use a type specificElementProcessorto process anXmlElementfor injection (withProcessingContext.inject(Object, XmlElement)).- Specified by:
- registerProcessorin interface- ProcessingContext
- Type Parameters:
- T- the type
- Parameters:
- clzType- the- Classtype
- processor- the- ElementProcessorfor the type
 
 - 
registerAttributeTypepublic <T> void registerAttributeType(Class<T> clzType) Automatically creates and registers anAttributeProcessorfor the specified type.Note: This assumes the type supports a String-based orXmlAttribute-based constructor.- Specified by:
- registerAttributeTypein interface- ProcessingContext
- Type Parameters:
- T- the type
- Parameters:
- clzType- the type for which to create and register an- AttributeProcessor
 
 - 
registerElementTypepublic <T> void registerElementType(Class<T> clzType) Automatically creates and registers anElementProcessorfor the specified type.Note: This assumes the type supports a String-based orXmlElement-based constructor.- Specified by:
- registerElementTypein interface- ProcessingContext
- Type Parameters:
- T- the type
- Parameters:
- clzType- the type for which to create and register an- ElementProcessor
 
 - 
getExpressionParserpublic ExpressionParser getExpressionParser() Obtains the configuredExpressionParserfor thisProcessingContext.- Specified by:
- getExpressionParserin interface- ProcessingContext
- Returns:
- the ExpressionParser
 
 - 
processDocumentpublic Object processDocument(XmlElement xmlElement) throws ConfigurationException Request that the specifiedXmlElement(representing the root of an XmlDocument) be processed with appropriateNamespaceHandlers.Should the document root contain any unrecognized xml namespaces, an attempt will be made to load appropriate NamespaceHandlers that of which will be used to process said elements in the document.- Specified by:
- processDocumentin interface- ProcessingContext
- Parameters:
- xmlElement- the root- XmlElementof the XmlDocument to process
- Returns:
- the result of the processing the root element of the document
         represented by the XmlElement
- Throws:
- ConfigurationException- when a configuration problem was encountered
 
 - 
processDocumentAtpublic Object processDocumentAt(URI uri) throws ConfigurationException Request that the document specified by the URI/filename (containing the root of an XmlDocument) be processed with appropriateNamespaceHandlers.Should the document root contain any unrecognized xml namespaces, an attempt will be made to load appropriate NamespaceHandlers that of which will be used to process said elements in the document.- Specified by:
- processDocumentAtin interface- ProcessingContext
- Parameters:
- uri- the- URIof the XmlDocument to process
- Returns:
- the result of the processing the root element of the document
- Throws:
- ConfigurationException- when a configuration problem was encountered
 
 - 
processDocumentAtpublic Object processDocumentAt(String sLocation) throws ConfigurationException Request that the document specified by the URI/filename (containing the root of an XmlDocument) be processed with appropriateNamespaceHandlers.Should the document root contain any unrecognized xml namespaces, an attempt will be made to load appropriate NamespaceHandlers that of which will be used to process said elements in the document.- Specified by:
- processDocumentAtin interface- ProcessingContext
- Parameters:
- sLocation- the URI/filename of the XmlDocument to process
- Returns:
- the result of the processing the root element of the document
- Throws:
- ConfigurationException- when a configuration problem was encountered
 
 - 
processDocumentpublic Object processDocument(String sXml) throws ConfigurationException Request that the specified xml string (representing an xml document) be processed with appropriateNamespaceHandlers.Should the document root contain any unrecognized xml namespaces, an attempt will be made to load appropriate NamespaceHandlers that of which will be used to process said elements in the document.- Specified by:
- processDocumentin interface- ProcessingContext
- Parameters:
- sXml- a string containing an xml document to process
- Returns:
- the result of processing the root element of the document
- Throws:
- ConfigurationException- when a configuration problem was encountered
 
 - 
processElementpublic Object processElement(XmlElement xmlElement) throws ConfigurationException Request the specifiedXmlElementto be processed with an appropriateNamespaceHandlerknown by theProcessingContextor outerProcessingContexts.Note: Should the element contain any unrecognized xml namespaces, an attempt will be made to load appropriate NamespaceHandlers that of which will be used to process said elements.- Specified by:
- processElementin interface- ProcessingContext
- Parameters:
- xmlElement- the- XmlElementto process
- Returns:
- the result of processing the XmlElementwith an appropriateElementProcessor
- Throws:
- ConfigurationException- when a configuration problem was encountered
 
 - 
processElementpublic Object processElement(String sXml) throws ConfigurationException Request the specified xml string be processed with an appropriateNamespaceHandlerknown by theProcessingContext.Note: Should the element contain any unrecognized xml namespaces, an attempt will be made to load appropriate NamespaceHandlers that of which will be used to process said elements.- Specified by:
- processElementin interface- ProcessingContext
- Parameters:
- sXml- the xml to process
- Returns:
- the result of processing the root element of the specified xml
- Throws:
- ConfigurationException- when a configuration problem was encountered
 
 - 
processOnlyElementOfpublic <T> T processOnlyElementOf(XmlElement xmlElement) throws ConfigurationException Request that the only child element contained within theXmlElementis processed using an appropriateNamespaceHandlerknown by theProcessingContext.- Specified by:
- processOnlyElementOfin interface- ProcessingContext
- Type Parameters:
- T- the type
- Parameters:
- xmlElement- the- XmlElementin which the child is defined
- Returns:
- the result of processing the child element
- Throws:
- ConfigurationException- when a configuration problem was encountered, especially if there is zero or more than one child
 
 - 
processElementsOfpublic Map<String,?> processElementsOf(XmlElement xmlElement) throws ConfigurationException Request that all of the child elements contained with in the specifiedXmlElementbe processed using appropriateNamespaceHandlers known by theProcessingContext.This is a convenience method to aid in the processing of all children of an XmlElement. The keys of the returnedMaprepresent the id attributes each childXmlElement. If anXmlElementdoes not have a specified id attribute, a UUID is generated in it's place.- Specified by:
- processElementsOfin interface- ProcessingContext
- Parameters:
- xmlElement- the parent- XmlElementof the children to process
- Returns:
- a Mapfrom identifiable childXmlElements (with id="..." attributes) and their corresponding processed values
- Throws:
- ConfigurationException- when a configuration problem was encountered
 
 - 
processForeignElementsOfpublic Map<String,?> processForeignElementsOf(XmlElement xmlElement) throws ConfigurationException Request that all of the child elements contained within the specifiedXmlElementthat do not belong to the namespace of the saidXmlElementare processed using appropriate processes.This is a convenience method to aid in the processing of all children of an XmlElement. The keys of the returnedMaprepresent the id attributes each childXmlElement. If anXmlElementdoes not have a specified id attribute, a UUID is generated in it's place.- Specified by:
- processForeignElementsOfin interface- ProcessingContext
- Parameters:
- xmlElement- the parent- XmlElementof the children to process
- Returns:
- a Mapfrom identifiable childXmlElements (with id="..." attributes) and their corresponding processed values
- Throws:
- ConfigurationException- when a configuration problem was encountered
 
 - 
processRemainingElementsOfpublic Map<String,?> processRemainingElementsOf(XmlElement xmlElement) throws ConfigurationException Request that the last remaining unprocessed children contained within the specifiedXmlElementare processed using appropriateElementProcessors.This is a convenience method to aid in the processing of an unprocessed child XmlElements of an element. The keys of the returnedMaprepresent the id attributes each childXmlElement. If anXmlElementdoes not have a specified id attribute, a UUID is generated in it's place.- Specified by:
- processRemainingElementsOfin interface- ProcessingContext
- Parameters:
- xmlElement- the parent- XmlElementof the unprocessed children to process
- Returns:
- a Mapfrom identifiable childXmlElements (with id="..." attributes) and their corresponding processed values
- Throws:
- ConfigurationException- when a configuration problem was encountered
 
 - 
processRemainingElementOfpublic <T> T processRemainingElementOf(XmlElement xmlElement) throws ConfigurationException Request that the last remaining unprocessed child element contained within the specifiedXmlElementis processed using an appropriateElementProcessor.This is a convenience method to aid in the processing of an unprocessed child XmlElementof an element.- Specified by:
- processRemainingElementOfin interface- ProcessingContext
- Type Parameters:
- T- the type
- Parameters:
- xmlElement- the parent- XmlElementof the unprocessed child to process
- Returns:
- the result of processing the child element
- Throws:
- ConfigurationException- if there are zero or more than one unprocessed child in the element, or if some other- ConfigurationExceptionoccurred
 
 - 
isPropertyDefinedpublic boolean isPropertyDefined(String sPropertyName, XmlElement xmlParent) throws ConfigurationException Determines if the specified property is defined at the path relative to the specifiedXmlElement.- Specified by:
- isPropertyDefinedin interface- ProcessingContext
- Parameters:
- sPropertyName- the path to the property
- xmlParent- the- XmlElementin which the property should be searched
- Returns:
- trueif the property is defined,- falseotherwise
- Throws:
- ConfigurationException- if a configuration is not valid
 
 - 
injectpublic <B> B inject(B bean, XmlElement xmlElement) throws ConfigurationExceptionGiven the information available in theProcessingContext, including the cookies, theResourceRegistrytheXmlElement, itsXmlAttributes and/or children, inject appropriately named and typed values into the specified bean (using setter injection).The order in which values are located for injection is as follows; attributed defined by the element, child elements defined by the element, alternative paths to values defined in the ProcessingContext, cookies defined by theProcessingContextand finally theResourceRegistryassociated with theProcessingContext.- Specified by:
- injectin interface- ProcessingContext
- Type Parameters:
- B- the bean type
- Parameters:
- bean- the bean to be injected
- xmlElement- the- XmlElementfrom which values will be derived for injection into the bean
- Returns:
- the provided bean but with properties set based on the available values in the ProcessingContext
- Throws:
- ConfigurationException- if a configuration is not valid
 
 - 
getMandatoryPropertypublic <T> T getMandatoryProperty(String sPath, Type typeProperty, XmlElement xmlParent) throws ConfigurationException Obtains the strongly typed value for the property defined at the path relative to the specifiedXmlElement. If the property is not defined or is of the incorrect type, aConfigurationExceptionis thrown.- Specified by:
- getMandatoryPropertyin interface- ProcessingContext
- Type Parameters:
- T- the type of the property
- Parameters:
- sPath- the path to the property
- typeProperty- the type of the property
- xmlParent- the- XmlElementcontaining the properties for the object
- Returns:
- the property value
- Throws:
- ConfigurationException- if a configuration is not valid, the property can't be located or is of the wrong type
 
 - 
getOptionalPropertypublic <T> T getOptionalProperty(String sPropertyName, Type typeProperty, T defaultValue, XmlElement xmlElement) throws ConfigurationException Obtains the strongly typed value for the property defined at the path relative to the specifiedXmlElement. If the property is not defined, the defaultValue is returned.- Specified by:
- getOptionalPropertyin interface- ProcessingContext
- Type Parameters:
- T- the type of the property
- Parameters:
- sPropertyName- the path to the property
- typeProperty- the type of the property
- defaultValue- the value to return if the property is not found
- xmlElement- the- XmlElementcontaining the properties for the object
- Returns:
- the property value
- Throws:
- ConfigurationException- if a configuration is not valid
 
 - 
loadNamespaceHandlerspublic void loadNamespaceHandlers(XmlElement xmlElement) Load all the customNamespaceHandlerinstances for the specifiedXmlElement.- Specified by:
- loadNamespaceHandlersin interface- ProcessingContext
- Parameters:
- xmlElement- the- XmlElementto load- NamespaceHandlerinstances for
 
 - 
ensureNamespaceHandlerpublic NamespaceHandler ensureNamespaceHandler(String sPrefix, NamespaceHandler handler) throws ConfigurationException Ensures that the specifiedNamespaceHandlerfor the specified prefix is defined in thisProcessingContext.If a NamespaceHandlerfor the prefix does not exist in theProcessingContext, it is added. Otherwise the existingNamespaceHandlerfor the prefix is returned.- Specified by:
- ensureNamespaceHandlerin interface- ProcessingContext
- Parameters:
- sPrefix- the prefix of the xml Namespace to be associated with the- NamespaceHandler
- handler- the- NamespaceHandler
- Returns:
- the registered NamespaceHandlerfor theProcessingContext
- Throws:
- ConfigurationException
 
 - 
ensureNamespaceHandlerpublic NamespaceHandler ensureNamespaceHandler(String sPrefix, URI uri) throws ConfigurationException Ensures that anNamespaceHandlerwith the specifiedURIis available for use in theProcessingContextwith the specified prefix. If aNamespaceHandlerwith the specified prefix andURIis not defined by theProcessingContext, one is instantiated, registered and returned.- Specified by:
- ensureNamespaceHandlerin interface- ProcessingContext
- Parameters:
- sPrefix- the prefix of the Xml Namespace to use for the- NamespaceHandler
- uri- the- URIdetailing the location of the- NamespaceHandler. Typically this will be a java class URI, specified as "class://fully.qualified.class.name"
- Returns:
- an instance of the NamespaceHandlerthat is suitable for processing the prefix andURI
- Throws:
- ConfigurationException- when a configuration problem was encountered
 
 - 
getNamespaceHandlerpublic NamespaceHandler getNamespaceHandler(String sPrefix) Obtains theNamespaceHandlerwhich is capable of processing the namespace with the specified prefix.- Specified by:
- getNamespaceHandlerin interface- ProcessingContext
- Parameters:
- sPrefix- the prefix of the xml namespace
- Returns:
- nullif a- NamespaceHandlercould not be located for the specified prefix
 
 - 
getNamespaceHandlerpublic NamespaceHandler getNamespaceHandler(URI uri) Obtains theNamespaceHandlerthat is capable of processing the namespace defined with the specifiedURI.- Specified by:
- getNamespaceHandlerin interface- ProcessingContext
- Parameters:
- uri- the Xml Namespace- URIof the- NamespaceHandlerto locate
- Returns:
- nullif a- NamespaceHandlercould not be located for the specified- URI
 
 - 
getNamespaceURIpublic URI getNamespaceURI(String sPrefix) Obtains theURIthat is associated with the specified prefix.- Specified by:
- getNamespaceURIin interface- ProcessingContext
- Parameters:
- sPrefix- the XML namespace prefix of the- URIto locate
- Returns:
- nullif a- URIcould not be located for the specified- URI
 
 - 
getNamespaceHandlerspublic Iterable<NamespaceHandler> getNamespaceHandlers() Obtains theNamespaceHandlers that are currently in scope for thisProcessingContext.- Specified by:
- getNamespaceHandlersin interface- ProcessingContext
- Returns:
- An Iterableover theNamespaceHandlers in scope.
 
 - 
getDependenciespublic DocumentProcessor.Dependencies getDependencies() - Returns:
- the DocumentProcessor.Dependencies
 
 - 
getPropertyValuepublic Value getPropertyValue(String sPropertyName, Type typeProperty, XmlElement xmlParent, boolean fOnlyUsePropertyName) throws ConfigurationException Attempts to resolve the named property of the specified type in the current context and if required will parse the specifiedXmlElementin order to do so.- Parameters:
- sPropertyName- the name or xml path to the property
- typeProperty- the required type of the property value
- xmlParent- the parent element in which the property may be found
- fOnlyUsePropertyName- when- truethe specified property name must be used resolve the property value. when- falseattempts may be made to resolve the property just the type name if the specified property name doesn't resolve a property
- Returns:
- The Valuerepresenting the property ornullif the property could not be located
- Throws:
- ConfigurationException- if the property was but could not be processed or is of the incorrect type
 
 - 
isRootContextpublic boolean isRootContext() Determines if theProcessingContextis the root. ie: has no parent.- Returns:
- trueif the- ProcessingContextis the root scope,- falseotherwise
 
 - 
closepublic void close() - Specified by:
- closein interface- AutoCloseable
 
 
- 
 
-