public class DefaultProcessingContext extends Object implements ProcessingContext, AutoCloseable
ProcessingContext.| Constructor and Description | 
|---|
DefaultProcessingContext()
 | 
DefaultProcessingContext(DefaultProcessingContext ctxParent,
                        XmlElement xmlElement)
Constructs a sub- 
ProcessingContext of another ProcessingContext. | 
DefaultProcessingContext(DocumentProcessor.Dependencies dependencies)
Constructs a root  
ProcessingContext with the specified DocumentProcessor DocumentProcessor.Dependencies. | 
DefaultProcessingContext(DocumentProcessor.Dependencies dependencies,
                        XmlElement xmlElement)
Constructs a root  
ProcessingContext for a given XmlElement. | 
DefaultProcessingContext(XmlElement xmlElement)
Constructs a root  
ProcessingContext for a given XmlElement using default DocumentProcessor
 dependencies. | 
| Modifier and Type | Method and Description | 
|---|---|
<T> void | 
addCookie(Class<T> clzCookie,
         String sName,
         T value)
Adds the specified named and typed cookie to the  
ProcessingContext. | 
<T> void | 
addCookie(Class<T> clzCookie,
         T cookie)
Adds the specified cookie to the  
ProcessingContext. | 
void | 
close()  | 
void | 
definePropertyPath(String sBeanPropertyName,
                  String sXmlPath)
Defines the xml path to locate a specific Java Bean property with in an  
XmlElement in the
 ProcessingContext. | 
NamespaceHandler | 
ensureNamespaceHandler(String sPrefix,
                      NamespaceHandler handler)
Ensures that the specified  
NamespaceHandler for the specified prefix is defined in this
 ProcessingContext. | 
NamespaceHandler | 
ensureNamespaceHandler(String sPrefix,
                      URI uri)
Ensures that an  
NamespaceHandler with the specified URI is available for use in the
 ProcessingContext with the specified prefix. | 
ClassLoader | 
getContextClassLoader()
Obtains the  
ClassLoader to use for loading classes in the ProcessingContext. | 
<T> T | 
getCookie(Class<T> clzCookie)
Locates and returns the cookie with the specified type. 
 | 
<T> T | 
getCookie(Class<T> clzCookie,
         String sName)
Locates and returns the cookie with the specified type and name. 
 | 
com.tangosol.config.expression.ParameterResolver | 
getDefaultParameterResolver()
Obtains the  
ParameterResolver to use for resolving parameters
 defined externally to the document being processed (ie: the
 operating system or container) | 
DocumentProcessor.Dependencies | 
getDependencies()
 | 
com.tangosol.config.expression.ExpressionParser | 
getExpressionParser()
Obtains the configured  
ExpressionParser for this ProcessingContext. | 
<T> T | 
getMandatoryProperty(String sPath,
                    Type typeProperty,
                    XmlElement xmlParent)
Obtains the strongly typed value for the property defined at the path relative to the specified
  
XmlElement. | 
NamespaceHandler | 
getNamespaceHandler(String sPrefix)
Obtains the  
NamespaceHandler which is capable of processing the namespace with the specified prefix. | 
NamespaceHandler | 
getNamespaceHandler(URI uri)
Obtains the  
NamespaceHandler that is capable of processing the namespace defined with the specified
 URI. | 
Iterable<NamespaceHandler> | 
getNamespaceHandlers()
Obtains the  
NamespaceHandlers that are currently in scope
 for this ProcessingContext. | 
URI | 
getNamespaceURI(String sPrefix)
Obtains the  
URI that is associated with the specified prefix. | 
<T> T | 
getOptionalProperty(String sPropertyName,
                   Type typeProperty,
                   T defaultValue,
                   XmlElement xmlElement)
Obtains the strongly typed value for the property defined at the path relative to the specified
  
XmlElement. | 
com.tangosol.config.expression.Value | 
getPropertyValue(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 specified  
XmlElement in order to do so. | 
<R> R | 
getResource(Class<R> clsResource)
Attempts to retrieve the resource that was registered with the
 specified class. 
 | 
<R> R | 
getResource(Class<R> clsResource,
           String sResourceName)
Attempts to retrieve the resource that was registered with the
 specified class and name. 
 | 
ResourceRegistry | 
getResourceRegistry()
Obtains the  
ResourceRegistry associated with the ProcessingContext. | 
<B> B | 
inject(B bean,
      XmlElement xmlElement)
Given the information available in the  
ProcessingContext, including the cookies, the
 ResourceRegistry the XmlElement, its
 XmlAttributes and/or children, inject appropriately named and typed values into the specified
 bean (using setter injection). | 
boolean | 
isPropertyDefined(String sPropertyName,
                 XmlElement xmlParent)
Determines if the specified property is defined at the path relative to the specified  
XmlElement. | 
boolean | 
isRootContext()
Determines if the  
ProcessingContext is the root. | 
Object | 
processDocument(String sXml)
Request that the specified xml string
 (representing an xml document) be processed with appropriate
  
NamespaceHandlers. | 
Object | 
processDocument(XmlElement xmlElement)
Request that the specified  
XmlElement
 (representing the root of an XmlDocument)
 be processed with appropriate NamespaceHandlers. | 
Object | 
processDocumentAt(String sLocation)
Request that the document specified by the URI/filename
 (containing the root of an XmlDocument)
 be processed with appropriate  
NamespaceHandlers. | 
Object | 
processDocumentAt(URI uri)
Request that the document specified by the URI/filename
 (containing the root of an XmlDocument)
 be processed with appropriate  
NamespaceHandlers. | 
Object | 
processElement(String sXml)
Request the specified xml string be processed with an appropriate  
NamespaceHandler
 known by the ProcessingContext. | 
Object | 
processElement(XmlElement xmlElement)
Request the specified  
XmlElement to be processed with an appropriate NamespaceHandler
 known by the ProcessingContext or outer ProcessingContexts. | 
Map<String,?> | 
processElementsOf(XmlElement xmlElement)
Request that all of the child elements contained with in the specified  
XmlElement be
 processed using appropriate NamespaceHandlers known by the ProcessingContext. | 
Map<String,?> | 
processForeignElementsOf(XmlElement xmlElement)
Request that all of the child elements contained within the specified  
XmlElement that do not belong
 to the namespace of the said XmlElement are processed using appropriate processes. | 
<T> T | 
processOnlyElementOf(XmlElement xmlElement)
Request that the only child element contained within the  
XmlElement is processed
 using an appropriate NamespaceHandler known by the ProcessingContext. | 
<T> T | 
processRemainingElementOf(XmlElement xmlElement)
Request that the last remaining unprocessed child element contained within the specified  
XmlElement
 is processed using an appropriate ElementProcessor. | 
Map<String,?> | 
processRemainingElementsOf(XmlElement xmlElement)
Request that the last remaining unprocessed children contained within the specified  
XmlElement
 are processed using appropriate ElementProcessors. | 
<T> void | 
registerAttributeType(Class<T> clzType)
Automatically creates and registers an  
AttributeProcessor for the specified type. | 
<T> void | 
registerElementType(Class<T> clzType)
Automatically creates and registers an  
ElementProcessor for the specified type. | 
<T> void | 
registerProcessor(Class<T> clzType,
                 AttributeProcessor<T> processor)
Registers an  
AttributeProcessor that may be used to process specific types of values
 contained in XmlAttributes with in the ProcessingContext. | 
<T> void | 
registerProcessor(Class<T> clzType,
                 ElementProcessor<T> processor)
Registers an  
ElementProcessor that may be used to process specific types of values
 contained in XmlElements with in the ProcessingContext. | 
public DefaultProcessingContext()
public DefaultProcessingContext(DocumentProcessor.Dependencies dependencies)
ProcessingContext with the specified DocumentProcessor DocumentProcessor.Dependencies.dependencies - the DocumentProcessor.Dependencies for the ProcessingContextpublic DefaultProcessingContext(XmlElement xmlElement)
ProcessingContext for a given XmlElement using default DocumentProcessor
 dependencies.xmlElement - the XmlElement for the ProcessingContextpublic DefaultProcessingContext(DefaultProcessingContext ctxParent, XmlElement xmlElement)
ProcessingContext of another ProcessingContext.ctxParent - the parent ProcessingContext for this ProcessingContextxmlElement - the XmlElement for the sub-ProcessingContextpublic DefaultProcessingContext(DocumentProcessor.Dependencies dependencies, XmlElement xmlElement)
ProcessingContext for a given XmlElement.dependencies - the DocumentProcessor.Dependencies for the ProcessingContextxmlElement - the XmlElement for the ProcessingContextpublic <R> R getResource(Class<R> clsResource)
getResource in interface ResourceResolverR - the type of the resourceclsResource - the class of the resourcenull if the resource is
         unknown to the ResourceRegistrypublic <R> R getResource(Class<R> clsResource, String sResourceName)
getResource in interface ResourceResolverR - the type of the resourceclsResource - the class of the resourcesResourceName - the name of the resourcenull if the resource is
         unknown to the ResourceRegistrypublic ResourceRegistry getResourceRegistry()
ResourceRegistry associated with the ProcessingContext.getResourceRegistry in interface ProcessingContextResourceRegistrypublic com.tangosol.config.expression.ParameterResolver getDefaultParameterResolver()
ParameterResolver to use for resolving parameters
 defined externally to the document being processed (ie: the
 operating system or container)getDefaultParameterResolver in interface ProcessingContextParameterResolver.public ClassLoader getContextClassLoader()
ClassLoader to use for loading classes in the ProcessingContext.getContextClassLoader in interface ProcessingContextClassLoaderpublic <T> void addCookie(Class<T> clzCookie, String sName, T value)
ProcessingContext.
 
 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 outer ProcessingContext,
 the specified cookie will hide the cookie defined in the outer ProcessingContext.
addCookie in interface ProcessingContextT - the type of the cookieclzCookie - the class of the cookiesName - the name of the cookievalue - the cookie valuepublic <T> void addCookie(Class<T> clzCookie, T cookie)
ProcessingContext.
 
 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 outer ProcessingContext.
 
 This method is equivalent to calling:
 addCookie(clz, clz.getName(), cookie);
addCookie in interface ProcessingContextT - the type of the cookieclzCookie - the class of the cookiecookie - the cookie valuepublic <T> T getCookie(Class<T> clzCookie, String sName)
 Locating the cookie involves searching the current
 ProcessingContext for a matching cookie.  If one is not found,
 the search continues with outer ProcessingContexts until a
 cookie is either located or there are no more ProcessingContexts,
 in which case null is returned.
getCookie in interface ProcessingContextT - the type of the cookieclzCookie - the class of the cookiesName - the name of the cookienull if not definedpublic <T> T getCookie(Class<T> clzCookie)
 Locating the cookie involves searching the current
 ProcessingContext for a matching cookie.  If one is not found,
 the search continues with outer ProcessingContexts until a
 cookie is either located or there are no more ProcessingContexts,
 in which case null is returned.
 
 This method is equivalent to calling:
 getCookie(clz, clz.getName());
getCookie in interface ProcessingContextT - the type of the cookieclzCookie - the class of the cookienull if not definedpublic void definePropertyPath(String sBeanPropertyName, String sXmlPath)
XmlElement in the
 ProcessingContext.
 
 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:
XmlElement or XmlAttribute
          with in a ProcessingContext.
      ProcessingContext.
 definePropertyPath in interface ProcessingContextsBeanPropertyName - the property name of the beansXmlPath - the xmlPath to the property valuepublic <T> void registerProcessor(Class<T> clzType, AttributeProcessor<T> processor)
AttributeProcessor that may be used to process specific types of values
 contained in XmlAttributes with in the ProcessingContext.
 
 When an AttributeProcessor isn't provided by the associated NamespaceHandler for an
 XmlAttribute, an attempt is made to use a type specific AttributeProcessor to process an
 XmlAttribute for injection (with ProcessingContext.inject(Object, XmlElement)).
registerProcessor in interface ProcessingContextT - the typeclzType - the Class typeprocessor - the AttributeProcessor for the typepublic <T> void registerProcessor(Class<T> clzType, ElementProcessor<T> processor)
ElementProcessor that may be used to process specific types of values
 contained in XmlElements with in the ProcessingContext.
 
 When an ElementProcessor isn't provided by the associated NamespaceHandler for an
 XmlElement, an attempt is made to use a type specific ElementProcessor to process an
 XmlElement for injection (with ProcessingContext.inject(Object, XmlElement)).
registerProcessor in interface ProcessingContextT - the typeclzType - the Class typeprocessor - the ElementProcessor for the typepublic <T> void registerAttributeType(Class<T> clzType)
AttributeProcessor for the specified type.
 
 Note: This assumes the type supports a String-based or XmlAttribute-based constructor.
registerAttributeType in interface ProcessingContextT - the typeclzType - the type for which to create and register an AttributeProcessorpublic <T> void registerElementType(Class<T> clzType)
ElementProcessor for the specified type.
 
 Note: This assumes the type supports a String-based or XmlElement-based constructor.
registerElementType in interface ProcessingContextT - the typeclzType - the type for which to create and register an ElementProcessorpublic com.tangosol.config.expression.ExpressionParser getExpressionParser()
ExpressionParser for this ProcessingContext.getExpressionParser in interface ProcessingContextExpressionParserpublic Object processDocument(XmlElement xmlElement) throws ConfigurationException
XmlElement
 (representing the root of an XmlDocument)
 be processed with appropriate NamespaceHandlers.
 
 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.
processDocument in interface ProcessingContextxmlElement - the root XmlElement of the XmlDocument to processXmlElementConfigurationException - when a configuration problem was encounteredpublic Object processDocumentAt(URI uri) throws ConfigurationException
NamespaceHandlers.
 
 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.
processDocumentAt in interface ProcessingContexturi - the URI of the XmlDocument to processConfigurationException - when a configuration problem was encounteredpublic Object processDocumentAt(String sLocation) throws ConfigurationException
NamespaceHandlers.
 
 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.
processDocumentAt in interface ProcessingContextsLocation - the URI/filename of the XmlDocument to processConfigurationException - when a configuration problem was encounteredpublic Object processDocument(String sXml) throws ConfigurationException
NamespaceHandlers.
 
 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.
processDocument in interface ProcessingContextsXml - a string containing an xml document to processConfigurationException - when a configuration problem was encounteredpublic Object processElement(XmlElement xmlElement) throws ConfigurationException
XmlElement to be processed with an appropriate NamespaceHandler
 known by the ProcessingContext or outer ProcessingContexts.
 
 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.
processElement in interface ProcessingContextxmlElement - the XmlElement to processXmlElement with an
         appropriate ElementProcessorConfigurationException - when a configuration problem was encounteredpublic Object processElement(String sXml) throws ConfigurationException
NamespaceHandler
 known by the ProcessingContext.
 
 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.
processElement in interface ProcessingContextsXml - the xml to processConfigurationException - when a configuration problem was encounteredpublic <T> T processOnlyElementOf(XmlElement xmlElement) throws ConfigurationException
XmlElement is processed
 using an appropriate NamespaceHandler known by the ProcessingContext.processOnlyElementOf in interface ProcessingContextT - the typexmlElement - the XmlElement in which the child is definedConfigurationException - when a configuration problem was encountered,
         especially if there is zero or more than one childpublic Map<String,?> processElementsOf(XmlElement xmlElement) throws ConfigurationException
XmlElement be
 processed using appropriate NamespaceHandlers known by the ProcessingContext.
 
 This is a convenience method to aid in the processing of all children of an XmlElement. The keys
 of the returned Map represent the id attributes each child XmlElement.  If an XmlElement
 does not have a specified id attribute, a UUID is generated in it's place.
processElementsOf in interface ProcessingContextxmlElement - the parent XmlElement of the children to processMap from identifiable child XmlElements (with id="..." attributes)
         and their corresponding processed valuesConfigurationException - when a configuration problem was encounteredpublic Map<String,?> processForeignElementsOf(XmlElement xmlElement) throws ConfigurationException
XmlElement that do not belong
 to the namespace of the said XmlElement are processed using appropriate processes.
 
 This is a convenience method to aid in the processing of all children of an XmlElement. The keys
 of the returned Map represent the id attributes each child XmlElement.  If an XmlElement
 does not have a specified id attribute, a UUID is generated in it's place.
processForeignElementsOf in interface ProcessingContextxmlElement - the parent XmlElement of the children to processMap from identifiable child XmlElements (with id="..." attributes)
         and their corresponding processed valuesConfigurationException - when a configuration problem was encounteredpublic Map<String,?> processRemainingElementsOf(XmlElement xmlElement) throws ConfigurationException
XmlElement
 are processed using appropriate ElementProcessors.
 
 This is a convenience method to aid in the processing of an unprocessed child XmlElements of an element.
 The keys of the returned Map represent the id attributes each child XmlElement.  If an
 XmlElement does not have a specified id attribute, a UUID is generated in it's place.
processRemainingElementsOf in interface ProcessingContextxmlElement - the parent XmlElement of the unprocessed children to processMap from identifiable child XmlElements (with id="..." attributes)
         and their corresponding processed valuesConfigurationException - when a configuration problem was encounteredpublic <T> T processRemainingElementOf(XmlElement xmlElement) throws ConfigurationException
XmlElement
 is processed using an appropriate ElementProcessor.
 
 This is a convenience method to aid in the processing of an unprocessed child XmlElement of an element.
processRemainingElementOf in interface ProcessingContextT - the typexmlElement - the parent XmlElement of the unprocessed child to processConfigurationException - if there are zero or more than one unprocessed child in the element, or
                                if some other ConfigurationException occurredpublic boolean isPropertyDefined(String sPropertyName, XmlElement xmlParent) throws ConfigurationException
XmlElement.isPropertyDefined in interface ProcessingContextsPropertyName - the path to the propertyxmlParent - the XmlElement in which the property should be searchedtrue if the property is defined, false otherwiseConfigurationException - if a configuration is not validpublic <B> B inject(B bean,
                    XmlElement xmlElement)
             throws ConfigurationException
ProcessingContext, including the cookies, the
 ResourceRegistry the XmlElement, its
 XmlAttributes 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 the ProcessingContext and finally the ResourceRegistry associated with the
 ProcessingContext.
inject in interface ProcessingContextB - the bean typebean - the bean to be injectedxmlElement - the XmlElement from which values will be derived for injection into the beanProcessingContextConfigurationException - if a configuration is not validpublic <T> T getMandatoryProperty(String sPath, Type typeProperty, XmlElement xmlParent) throws ConfigurationException
XmlElement. If the property is not defined or is of the incorrect type, a ConfigurationException
 is thrown.getMandatoryProperty in interface ProcessingContextT - the type of the propertysPath - the path to the propertytypeProperty - the type of the propertyxmlParent - the XmlElement containing the properties for the objectConfigurationException - if a configuration is not valid, the property can't be located or is of the
                                wrong typepublic <T> T getOptionalProperty(String sPropertyName, Type typeProperty, T defaultValue, XmlElement xmlElement) throws ConfigurationException
XmlElement. If the property is not defined, the defaultValue is returned.getOptionalProperty in interface ProcessingContextT - the type of the propertysPropertyName - the path to the propertytypeProperty - the type of the propertydefaultValue - the value to return if the property is not foundxmlElement - the XmlElement containing the properties for the objectConfigurationException - if a configuration is not validpublic NamespaceHandler ensureNamespaceHandler(String sPrefix, NamespaceHandler handler) throws ConfigurationException
NamespaceHandler for the specified prefix is defined in this
 ProcessingContext.
 
 If a NamespaceHandler for the prefix does not exist in the ProcessingContext, it is added.
 Otherwise the existing NamespaceHandler for the prefix is returned.
ensureNamespaceHandler in interface ProcessingContextsPrefix - the prefix of the xml Namespace to be associated with the NamespaceHandlerhandler - the NamespaceHandlerNamespaceHandler for the ProcessingContextConfigurationExceptionpublic NamespaceHandler ensureNamespaceHandler(String sPrefix, URI uri) throws ConfigurationException
NamespaceHandler with the specified URI is available for use in the
 ProcessingContext with the specified prefix.  If a NamespaceHandler with the specified
 prefix and URI is not defined by the ProcessingContext, one is instantiated, registered
 and returned.ensureNamespaceHandler in interface ProcessingContextsPrefix - the prefix of the Xml Namespace to use for the NamespaceHandleruri - the URI detailing the location of the NamespaceHandler. Typically this
                 will be a java class URI, specified as "class://fully.qualified.class.name"NamespaceHandler that is suitable for processing the prefix and URIConfigurationException - when a configuration problem was encounteredpublic NamespaceHandler getNamespaceHandler(String sPrefix)
NamespaceHandler which is capable of processing the namespace with the specified prefix.getNamespaceHandler in interface ProcessingContextsPrefix - the prefix of the xml namespacenull if a NamespaceHandler could not be located for the specified prefixpublic NamespaceHandler getNamespaceHandler(URI uri)
NamespaceHandler that is capable of processing the namespace defined with the specified
 URI.getNamespaceHandler in interface ProcessingContexturi - the Xml Namespace URI of the NamespaceHandler to locatenull if a NamespaceHandler could not be located for the specified URIpublic URI getNamespaceURI(String sPrefix)
URI that is associated with the specified prefix.getNamespaceURI in interface ProcessingContextsPrefix - the XML namespace prefix of the URI to locatenull if a URI could not be located for the specified URIpublic Iterable<NamespaceHandler> getNamespaceHandlers()
NamespaceHandlers that are currently in scope
 for this ProcessingContext.getNamespaceHandlers in interface ProcessingContextIterable over the NamespaceHandlers in scope.public DocumentProcessor.Dependencies getDependencies()
DocumentProcessor.Dependenciespublic com.tangosol.config.expression.Value getPropertyValue(String sPropertyName, Type typeProperty, XmlElement xmlParent, boolean fOnlyUsePropertyName) throws ConfigurationException
XmlElement in order to do so.sPropertyName - the name or xml path to the propertytypeProperty - the required type of the property valuexmlParent - the parent element in which the property may be foundfOnlyUsePropertyName - when true the specified property name must be
                              used resolve the property value.  when false
                              attempts may be made to resolve the property just the type
                              name if the specified property name doesn't resolve a propertyValue representing the property or null if the property
         could not be locatedConfigurationException - if the property was but could not be processed or is
                                 of the incorrect typepublic boolean isRootContext()
ProcessingContext is the root.  ie: has no parent.true if the ProcessingContext is the root scope, false otherwisepublic void close()
close in interface AutoCloseable