Skip navigation links

Oracle® Fusion Middleware Java API Reference for Oracle Coherence
12c (12.1.3.0.0)

E47890-01


com.tangosol.config.xml
Class AbstractNamespaceHandler

java.lang.Object
  extended by com.tangosol.config.xml.AbstractNamespaceHandler

All Implemented Interfaces:
NamespaceHandler
Direct Known Subclasses:
CacheConfigNamespaceHandler

public abstract class AbstractNamespaceHandler
extends java.lang.Object
implements NamespaceHandler

An AbstractNamespaceHandler provides a base implementation of a NamespaceHandler with support for implicit and explicit registration of ElementProcessors and AttributeProcessors for those xml attributes and elements occurring in the associated xml namespace.

Since:
Coherence 12.1.2
Author:
bo 2011.06.20

Constructor Summary
AbstractNamespaceHandler()
          Construct an AbstractNamespaceHandler.

 

Method Summary
 AttributeProcessor getAttributeProcessor(java.lang.String localName)
          Obtains the AttributeProcessor registered with the specified localName (in the namespace).
 AttributeProcessor getAttributeProcessor(XmlAttribute attribute)
          Obtains the AttributeProcessor that is suitable for processing the specified XmlAttribute in the xml namespace associated with this NamespaceHandler.
 DocumentPreprocessor getDocumentPreprocessor()
          Obtains the DocumentPreprocessor that must be applied to the XmlElement (ie: document) in which the NamespaceHandler is defined, prior to XmlElements and XmlAttributes being processed defined by this NamespaceHandler.
 ElementProcessor getElementProcessor(java.lang.String localName)
          Obtains the ElementProcessor registered with the specified localName (in the namespace).
 ElementProcessor getElementProcessor(XmlElement element)
          Obtains the ElementProcessor that is suitable for processing the specified XmlElement in the xml namespace associated with this NamespaceHandler.
 void onEndNamespace(ProcessingContext context, XmlElement element, java.lang.String prefix, java.net.URI uri)
          Called when the xml namespace associated with the NamespaceHandler is last encountered in an xml document.
 void onStartNamespace(ProcessingContext context, XmlElement element, java.lang.String prefix, java.net.URI uri)
          Called when the xml namespace associated with the NamespaceHandler is first encountered in an xml document.
protected  AttributeProcessor onUnknownAttribute(XmlAttribute attribute)
          A call-back to handle when an XmlAttribute is unknown to the NamespaceHandler.
protected  ElementProcessor onUnknownElement(XmlElement element)
          A call-back to handle when an XmlElement is unknown to the NamespaceHandler.
 void registerAttributeType(java.lang.String sLocalName, java.lang.Class clzType)
          Registers (internally creates) an appropriate AttributeProcessor for XmlAttributes with the specified local name so that they produce the specified type of value when processed.
 void registerElementType(java.lang.String sLocalName, java.lang.Class clzType)
          Registers (internally creates) an appropriate ElementProcessor for XmlElements with the specified local name so that they produce the specified type of value when processed.
 void registerProcessor(java.lang.Class clzProcessor)
          Registers the specified processor as an ElementProcessor or AttributeProcessor (based on the interfaces it implements) using the XmlSimpleName annotation to determine the localName of the said processor.
 void registerProcessor(java.lang.String sLocalName, AttributeProcessor processor)
          Registers an AttributeProcessor for XmlAttributes with the specified name.
 void registerProcessor(java.lang.String sLocalName, ElementProcessor processor)
          Registers an ElementProcessor for XmlElements with a name with in the context of the NamespaceHandler namespace.
 void setDocumentPreprocessor(DocumentPreprocessor preprocessor)
          Sets the DocumentPreprocessor for the NamespaceHandler.

 

Constructor Detail

AbstractNamespaceHandler

public AbstractNamespaceHandler()
Construct an AbstractNamespaceHandler.

Method Detail

getDocumentPreprocessor

public DocumentPreprocessor getDocumentPreprocessor()
Obtains the DocumentPreprocessor that must be applied to the XmlElement (ie: document) in which the NamespaceHandler is defined, prior to XmlElements and XmlAttributes being processed defined by this NamespaceHandler.
Specified by:
getDocumentPreprocessor in interface NamespaceHandler
Returns:
the DocumentPreprocessor or null if one is not required or defined for the NamespaceHandler

getAttributeProcessor

public AttributeProcessor getAttributeProcessor(XmlAttribute attribute)
Obtains the AttributeProcessor that is suitable for processing the specified XmlAttribute in the xml namespace associated with this NamespaceHandler.
Specified by:
getAttributeProcessor in interface NamespaceHandler
Parameters:
attribute - the XmlAttribute
Returns:
the AttributeProcessor or null if a suitable AttributeProcessor could not be found

getElementProcessor

public ElementProcessor getElementProcessor(XmlElement element)
Obtains the ElementProcessor that is suitable for processing the specified XmlElement in the xml namespace associated with this NamespaceHandler.
Specified by:
getElementProcessor in interface NamespaceHandler
Parameters:
element - the XmlElement
Returns:
the ElementProcessor or null if a suitable ElementProcessor could not be found

onStartNamespace

public void onStartNamespace(ProcessingContext context,
                             XmlElement element,
                             java.lang.String prefix,
                             java.net.URI uri)
Called when the xml namespace associated with the NamespaceHandler is first encountered in an xml document.
Specified by:
onStartNamespace in interface NamespaceHandler
Parameters:
context - the document ProcessingContext in which the xml namespace was encountered
element - the XmlElement in which the xml namespace was encountered
prefix - the prefix of the declared xml namespace
uri - the URI of the declared xml namespace

onEndNamespace

public void onEndNamespace(ProcessingContext context,
                           XmlElement element,
                           java.lang.String prefix,
                           java.net.URI uri)
Called when the xml namespace associated with the NamespaceHandler is last encountered in an xml document.
Specified by:
onEndNamespace in interface NamespaceHandler
Parameters:
context - the document ProcessingContext in which the xml namespace was encountered
element - the XmlElement in which the xml namespace was encountered
prefix - the prefix of the declared xml namespace
uri - the URI of the declared xml namespace

setDocumentPreprocessor

public void setDocumentPreprocessor(DocumentPreprocessor preprocessor)
Sets the DocumentPreprocessor for the NamespaceHandler.
Parameters:
preprocessor - the DocumentPreprocessor

registerProcessor

public void registerProcessor(java.lang.Class clzProcessor)
Registers the specified processor as an ElementProcessor or AttributeProcessor (based on the interfaces it implements) using the XmlSimpleName annotation to determine the localName of the said processor.

Note: The specified class must have a no-args constructor.

Parameters:
clzProcessor - A class that implements either (or both) ElementProcessor or AttributeProcessor that is annotated with @XmlSimpleName to specify it's localName.

registerProcessor

public void registerProcessor(java.lang.String sLocalName,
                              ElementProcessor processor)
Registers an ElementProcessor for XmlElements with a name with in the context of the NamespaceHandler namespace.
Parameters:
sLocalName - The local name of the XmlElement to be processed with the ElementProcessor
processor - The ElementProcessor

registerProcessor

public void registerProcessor(java.lang.String sLocalName,
                              AttributeProcessor processor)
Registers an AttributeProcessor for XmlAttributes with the specified name.
Parameters:
sLocalName - The local name of the XmlAttribute to be processed with the AttributeProcessor
processor - The AttributeProcessor

registerElementType

public void registerElementType(java.lang.String sLocalName,
                                java.lang.Class clzType)
Registers (internally creates) an appropriate ElementProcessor for XmlElements with the specified local name so that they produce the specified type of value when processed.
Parameters:
sLocalName - The local name of the XmlElements to be associated with the type
clzType - The Class of value that should be produced for the XmlElement

registerAttributeType

public void registerAttributeType(java.lang.String sLocalName,
                                  java.lang.Class clzType)
Registers (internally creates) an appropriate AttributeProcessor for XmlAttributes with the specified local name so that they produce the specified type of value when processed.
Parameters:
sLocalName - The local name of the XmlElements to be associated with the type
clzType - The Class of value that should be produced for the XmlAttribute

onUnknownAttribute

protected AttributeProcessor onUnknownAttribute(XmlAttribute attribute)
A call-back to handle when an XmlAttribute is unknown to the NamespaceHandler.

Override this method to provide specialized foreign XmlAttribute processing. By default, null will be returned for unknown XmlAttributes.

Parameters:
attribute - The XmlAttribute that was unknown.
Returns:
An appropriate AttributeProcessor that may be used to process the unknown XmlAttribute or null if no special processing should occur.

onUnknownElement

protected ElementProcessor onUnknownElement(XmlElement element)
A call-back to handle when an XmlElement is unknown to the NamespaceHandler.

Override this method to provide specialized foreign XmlElement processing. By default, unknown XmlElement will return an ElementProcessor that when attempting to process the said element, will throw a ConfigurationException.

Parameters:
element - The XmlElement that was unknown.
Returns:
An appropriate ElementProcessor that may be used to process the unknown XmlElement or null if no special processing should occur.

getAttributeProcessor

public AttributeProcessor getAttributeProcessor(java.lang.String localName)
Obtains the AttributeProcessor registered with the specified localName (in the namespace).
Parameters:
localName - the name of the AttributeProcessor to return
Returns:
the AttributeProcessor or null if not found

getElementProcessor

public ElementProcessor getElementProcessor(java.lang.String localName)
Obtains the ElementProcessor registered with the specified localName (in the namespace).
Parameters:
localName - the name of the ElementProcessor to return
Returns:
the ElementProcessor or null if not found

Skip navigation links

Oracle® Fusion Middleware Java API Reference for Oracle Coherence
12c (12.1.3.0.0)

E47890-01


Copyright © 2000, 2014, Oracle and/or its affiliates. All rights reserved.