|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ProcessingContext
A ProcessingContext
provides contextual information concerning the processing of content in an xml document.
ProcessingContext
s additionally provide mechanisms to:
XmlElement
s.ResourceRegistry
provided to the DocumentProcessor
associated with the XmlDocument
being processed.ParameterResolver
provided to the DocumentProcessor
associated with the XmlDocument
being processed.ElementProcessor
s and AttributeProcessor
s that may be used for processing and injecting beans in the ProcessingContext
.Method Summary | |
---|---|
void |
addCookie(java.lang.Class clzCookie, java.lang.String sCookieName, java.lang.Object cookie) Adds the specified named and typed cookie to the ProcessingContext . |
void |
addCookie(java.lang.Class clzCookie, java.lang.Object cookie) Adds the specified cookie to the ProcessingContext . |
void |
definePropertyPath(java.lang.String sBeanPropertyName, java.lang.String sXmlPath) Defines the xml path to locate a specific Java Bean property with in an XmlElement in the ProcessingContext . |
NamespaceHandler |
ensureNamespaceHandler(java.lang.String sPrefix, NamespaceHandler handler) Ensures that the specified NamespaceHandler for the specified prefix is defined in this ProcessingContext . |
NamespaceHandler |
ensureNamespaceHandler(java.lang.String sPrefix, java.net.URI uri) Ensures that an NamespaceHandler with the specified URI is available for use in the ProcessingContext with the specified prefix. |
java.lang.ClassLoader |
getContextClassLoader() Obtains the ClassLoader to use for loading classes in the ProcessingContext . |
java.lang.Object |
getCookie(java.lang.Class clzCookie) Locates and returns the cookie with the specified type. |
java.lang.Object |
getCookie(java.lang.Class clzCookie, java.lang.String sCookieName) 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) |
com.tangosol.config.expression.ExpressionParser |
getExpressionParser() Obtains the configured ExpressionParser for this ProcessingContext . |
java.lang.Object |
getMandatoryProperty(java.lang.String sPath, java.lang.reflect.Type typeProperty, XmlElement xmlElement) Obtains the strongly typed value for the property defined at the path relative to the specified XmlElement . |
NamespaceHandler |
getNamespaceHandler(java.lang.String sPrefix) Obtains the NamespaceHandler which is capable of processing the namespace with the specified prefix. |
NamespaceHandler |
getNamespaceHandler(java.net.URI uri) Obtains the NamespaceHandler that is capable of processing the namespace defined with the specified URI . |
java.lang.Iterable |
getNamespaceHandlers() Obtains the NamespaceHandler s that are currently in scope for this ProcessingContext . |
java.net.URI |
getNamespaceURI(java.lang.String sPrefix) Obtains the URI that is associated with the specified prefix. |
java.lang.Object |
getOptionalProperty(java.lang.String sPath, java.lang.reflect.Type typeProperty, java.lang.Object defaultValue, XmlElement xmlElement) Obtains the strongly typed value for the property defined at the path relative to the specified XmlElement . |
ResourceRegistry |
getResourceRegistry() Obtains the ResourceRegistry associated with the ProcessingContext . |
java.lang.Object |
inject(java.lang.Object bean, XmlElement xmlElement) Given the information available in the ProcessingContext , including the cookies, the ResourceRegistry the XmlElement , its XmlAttribute s and/or children, inject appropriately named and typed values into the specified bean (using setter injection). |
boolean |
isPropertyDefined(java.lang.String sPath, XmlElement xmlElement) Determines if the specified property is defined at the path relative to the specified XmlElement . |
java.lang.Object |
processDocument(java.lang.String sXml) Request that the specified xml string (representing an xml document) be processed with appropriate NamespaceHandler s. |
java.lang.Object |
processDocument(XmlElement xmlElement) Request that the specified XmlElement (representing the root of an XmlDocument) be processed with appropriate NamespaceHandler s. |
java.lang.Object |
processDocumentAt(java.lang.String sLocation) Request that the document specified by the URI/filename (containing the root of an XmlDocument) be processed with appropriate NamespaceHandler s. |
java.lang.Object |
processDocumentAt(java.net.URI uri) Request that the document specified by the URI/filename (containing the root of an XmlDocument) be processed with appropriate NamespaceHandler s. |
java.lang.Object |
processElement(java.lang.String sXml) Request the specified xml string be processed with an appropriate NamespaceHandler known by the ProcessingContext . |
java.lang.Object |
processElement(XmlElement xmlElement) Request the specified XmlElement to be processed with an appropriate NamespaceHandler known by the ProcessingContext or outer ProcessingContext s. |
java.util.Map |
processElementsOf(XmlElement xmlElement) Request that all of the child elements contained with in the specified XmlElement be processed using appropriate NamespaceHandler s known by the ProcessingContext . |
java.util.Map |
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. |
java.lang.Object |
processOnlyElementOf(XmlElement xmlElement) Request that the only child element contained within the XmlElement is processed using an appropriate NamespaceHandler known by the ProcessingContext . |
java.lang.Object |
processRemainingElementOf(XmlElement xmlElement) Request that the last remaining unprocessed child element contained within the specified XmlElement is processed using an appropriate ElementProcessor . |
java.util.Map |
processRemainingElementsOf(XmlElement xmlElement) Request that the last remaining unprocessed children contained within the specified XmlElement are processed using appropriate ElementProcessor s. |
void |
registerAttributeType(java.lang.Class clzType) Automatically creates and registers an AttributeProcessor for the specified type. |
void |
registerElementType(java.lang.Class clzType) Automatically creates and registers an ElementProcessor for the specified type. |
void |
registerProcessor(java.lang.Class clzType, AttributeProcessor processor) Registers an AttributeProcessor that may be used to process specific types of values contained in XmlAttribute s with in the ProcessingContext . |
void |
registerProcessor(java.lang.Class clzType, ElementProcessor processor) Registers an ElementProcessor that may be used to process specific types of values contained in XmlElement s with in the ProcessingContext . |
Methods inherited from interface com.tangosol.util.ResourceResolver |
---|
getResource, getResource |
Method Detail |
---|
ResourceRegistry getResourceRegistry()
ResourceRegistry
associated with the ProcessingContext
.ResourceRegistry
java.lang.ClassLoader getContextClassLoader()
ClassLoader
to use for loading classes in the ProcessingContext
.ClassLoader
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)ParameterResolver
.void addCookie(java.lang.Class clzCookie, java.lang.String sCookieName, java.lang.Object cookie)
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
.
clzCookie
- the class of the cookiesCookieName
- the name of the cookiecookie
- the cookie valuevoid addCookie(java.lang.Class clzCookie, java.lang.Object 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);
clzCookie
- the class of the cookiecookie
- the cookie valuejava.lang.Object getCookie(java.lang.Class clzCookie, java.lang.String sCookieName)
Locating the cookie involves searching the current ProcessingContext
for a matching cookie. If one is not found, the search continues with outer ProcessingContext
s until a cookie is either located or there are no more ProcessingContext
s, in which case null
is returned.
clzCookie
- the class of the cookiesCookieName
- the name of the cookienull
if not definedjava.lang.Object getCookie(java.lang.Class clzCookie)
Locating the cookie involves searching the current ProcessingContext
for a matching cookie. If one is not found, the search continues with outer ProcessingContext
s until a cookie is either located or there are no more ProcessingContext
s, in which case null
is returned.
This method is equivalent to calling: getCookie(clz, clz.getName());
clzCookie
- the class of the cookienull
if not definedvoid definePropertyPath(java.lang.String sBeanPropertyName, java.lang.String sXmlPath)
XmlElement
in the ProcessingContext
.
This method allows "alias" paths for Java Bean properties to be defined so that 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
.
sBeanPropertyName
- the property name of the beansXmlPath
- the xmlPath to the property valuevoid registerProcessor(java.lang.Class clzType, AttributeProcessor processor)
AttributeProcessor
that may be used to process specific types of values contained in XmlAttribute
s 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 inject(Object, XmlElement)
).
clzType
- the Class
typeprocessor
- the AttributeProcessor
for the typevoid registerProcessor(java.lang.Class clzType, ElementProcessor processor)
ElementProcessor
that may be used to process specific types of values contained in XmlElement
s 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 inject(Object, XmlElement)
).
clzType
- the Class
typeprocessor
- the ElementProcessor
for the typevoid registerAttributeType(java.lang.Class clzType)
AttributeProcessor
for the specified type.
Note: This assumes the type supports a String
-based or XmlAttribute
-based constructor.
clzType
- the type for which to create and register an AttributeProcessor
void registerElementType(java.lang.Class clzType)
ElementProcessor
for the specified type.
Note: This assumes the type supports a String
-based or XmlElement
-based constructor.
clzType
- the type for which to create and register an ElementProcessor
com.tangosol.config.expression.ExpressionParser getExpressionParser()
ExpressionParser
for this ProcessingContext
.ExpressionParser
NamespaceHandler ensureNamespaceHandler(java.lang.String sPrefix, java.net.URI uri)
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.sPrefix
- the prefix of the Xml Namespace to use for the NamespaceHandler
uri
- 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 URI
ConfigurationException
- when a configuration problem was encounteredNamespaceHandler ensureNamespaceHandler(java.lang.String sPrefix, NamespaceHandler handler)
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.
sPrefix
- the prefix of the xml Namespace to be associated with the NamespaceHandler
handler
- the NamespaceHandler
NamespaceHandler
for the ProcessingContext
NamespaceHandler getNamespaceHandler(java.net.URI uri)
NamespaceHandler
that is capable of processing the namespace defined with the specified URI
.uri
- the Xml Namespace URI
of the NamespaceHandler
to locatenull
if a NamespaceHandler
could not be located for the specified URI
NamespaceHandler getNamespaceHandler(java.lang.String sPrefix)
NamespaceHandler
which is capable of processing the namespace with the specified prefix.sPrefix
- the prefix of the xml namespacenull
if a NamespaceHandler
could not be located for the specified prefixjava.net.URI getNamespaceURI(java.lang.String sPrefix)
URI
that is associated with the specified prefix.sPrefix
- the XML namespace prefix of the URI
to locatenull
if a URI
could not be located for the specified URI
java.lang.Iterable getNamespaceHandlers()
NamespaceHandler
s that are currently in scope for this ProcessingContext
.Iterable
over the NamespaceHandler
s in scope.java.lang.Object processDocumentAt(java.net.URI uri) throws ConfigurationException
NamespaceHandler
s.
Should the document root contain any unrecognized xml namespaces, an attempt will be made to load appropriate NamespaceHandler
s that of which will be used to process said elements in the document.
uri
- the URI
of the XmlDocument to processConfigurationException
- when a configuration problem was encounteredjava.lang.Object processDocumentAt(java.lang.String sLocation) throws ConfigurationException
NamespaceHandler
s.
Should the document root contain any unrecognized xml namespaces, an attempt will be made to load appropriate NamespaceHandler
s that of which will be used to process said elements in the document.
sLocation
- the URI/filename of the XmlDocument to processConfigurationException
- when a configuration problem was encounteredjava.lang.Object processDocument(XmlElement xmlElement) throws ConfigurationException
XmlElement
(representing the root of an XmlDocument) be processed with appropriate NamespaceHandler
s.
Should the document root contain any unrecognized xml namespaces, an attempt will be made to load appropriate NamespaceHandler
s that of which will be used to process said elements in the document.
xmlElement
- the root XmlElement
of the XmlDocument to processXmlElement
ConfigurationException
- when a configuration problem was encounteredjava.lang.Object processDocument(java.lang.String sXml) throws ConfigurationException
NamespaceHandler
s.
Should the document root contain any unrecognized xml namespaces, an attempt will be made to load appropriate NamespaceHandler
s that of which will be used to process said elements in the document.
sXml
- a string containing an xml document to processConfigurationException
- when a configuration problem was encounteredjava.lang.Object processElement(XmlElement xmlElement) throws ConfigurationException
XmlElement
to be processed with an appropriate NamespaceHandler
known by the ProcessingContext
or outer ProcessingContext
s.
Note: Should the element contain any unrecognized xml namespaces, an attempt will be made to load appropriate NamespaceHandler
s that of which will be used to process said elements.
xmlElement
- the XmlElement
to processXmlElement
with an appropriate ElementProcessor
ConfigurationException
- when a configuration problem was encounteredjava.lang.Object processElement(java.lang.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 NamespaceHandler
s that of which will be used to process said elements.
sXml
- the xml to processConfigurationException
- when a configuration problem was encounteredjava.util.Map processElementsOf(XmlElement xmlElement) throws ConfigurationException
XmlElement
be processed using appropriate NamespaceHandler
s 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.
xmlElement
- the parent XmlElement
of the children to processMap
from identifiable child XmlElement
s (with id="O___" attributes) and their corresponding processed valuesConfigurationException
- when a configuration problem was encounteredjava.util.Map 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.
xmlElement
- the parent XmlElement
of the children to processMap
from identifiable child XmlElement
s (with attributes) and their corresponding processed valuesConfigurationException
- when a configuration problem was encounteredjava.lang.Object processOnlyElementOf(XmlElement xmlElement) throws ConfigurationException
XmlElement
is processed using an appropriate NamespaceHandler
known by the ProcessingContext
.xmlElement
- the XmlElement
in which the child is definedConfigurationException
- when a configuration problem was encountered, especially if there is zero or more than one childjava.lang.Object 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.
xmlElement
- 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
occurredjava.util.Map processRemainingElementsOf(XmlElement xmlElement) throws ConfigurationException
XmlElement
are processed using appropriate ElementProcessor
s.
This is a convenience method to aid in the processing of an unprocessed child XmlElement
s 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.
xmlElement
- the parent XmlElement
of the unprocessed children to processMap
from identifiable child XmlElement
s (with attributes) and their corresponding processed valuesConfigurationException
- when a configuration problem was encounteredjava.lang.Object inject(java.lang.Object bean, XmlElement xmlElement) throws ConfigurationException
ProcessingContext
, including the cookies, the ResourceRegistry
the XmlElement
, its XmlAttribute
s 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
.
bean
- the bean to be injectedxmlElement
- the XmlElement
from which values will be derived for injection into the beanProcessingContext
ConfigurationException
- if a configuration is not validboolean isPropertyDefined(java.lang.String sPath, XmlElement xmlElement) throws ConfigurationException
XmlElement
.sPath
- the path to the propertyxmlElement
- the XmlElement
in which the property should be searchedtrue
if the property is defined, false
otherwiseConfigurationException
- if a configuration is not validjava.lang.Object getMandatoryProperty(java.lang.String sPath, java.lang.reflect.Type typeProperty, XmlElement xmlElement) throws ConfigurationException
XmlElement
. If the property is not defined or is of the incorrect type, a ConfigurationException
is thrown.sPath
- the path to the propertytypeProperty
- the type of the propertyxmlElement
- 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 typejava.lang.Object getOptionalProperty(java.lang.String sPath, java.lang.reflect.Type typeProperty, java.lang.Object defaultValue, XmlElement xmlElement) throws ConfigurationException
XmlElement
. If the property is not defined, the defaultValue is returned.sPath
- 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 valid
|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |