org.apache.ws.jaxme.impl
Class JMUnmarshallerHandlerImpl

java.lang.Object
  extended by org.apache.ws.jaxme.impl.JMUnmarshallerHandlerImpl
All Implemented Interfaces:
UnmarshallerHandler, JMUnmarshallerHandler, org.xml.sax.ContentHandler

public class JMUnmarshallerHandlerImpl
extends java.lang.Object
implements JMUnmarshallerHandler

Implementation of a JMUnmarshallerHandler; the UnmarshallerHandler receives SAX events which he silently discards, as long as the first startElement event is seen. Depending on namespace URI and local name, the Unmarshallerhandler creates a new instance of JMHandler and from now on forwards all SAX events to the JMHandler.


Constructor Summary
JMUnmarshallerHandlerImpl(JMUnmarshaller pUnmarshaller)
          Creates a new instance, controlled by the given JMUnmarshaller.
 
Method Summary
 void addElementParser(JMSAXElementParser pParser)
          Adds a parser for an nested element to the stack of parsers.
 void addSimpleAtomicState()
          Indicates, that the handler is parsing a simple, atomic element.
 void characters(char[] pChars, int pOffset, int pLen)
           
 void endDocument()
           
 void endElement(java.lang.String pNamespaceURI, java.lang.String pLocalName, java.lang.String pQName)
           
 void endPrefixMapping(java.lang.String pPrefix)
           
 DatatypeConverterInterface getDatatypeConverter()
          Returns an instance of DatatypeConverterInterface.
 org.xml.sax.Locator getDocumentLocator()
          Returns an instance of Locator, if it has been set, or null.
 JMUnmarshaller getJMUnmarshaller()
          Returns the JMUnmarshaller, which created this handler.
 int getLevel()
          Returns the current level of nested elements.
 NamespaceSupport getNamespaceSupport()
          Returns an instance of NamespaceSupport.
 Observer getObserver()
          Returns the observer, which will be notified, when the element has been parsed.
 java.lang.Object getResult()
          Returns the unmarshalled object.
 void ignorableWhitespace(char[] pChars, int pStart, int pLen)
           
 void parseConversionEvent(java.lang.String pMsg, java.lang.Exception pException)
          Posts a ParseConversionEvent.
 void processingInstruction(java.lang.String pTarget, java.lang.String pData)
           
 void setDocumentLocator(org.xml.sax.Locator pLocator)
           
 void setObserver(Observer pObserver)
          Sets an observer, which will be notified, when the element has been parsed.
 void skippedEntity(java.lang.String pName)
           
 void startDocument()
           
 void startElement(java.lang.String pNamespaceURI, java.lang.String pLocalName, java.lang.String pQName, org.xml.sax.Attributes pAttrs)
           
 void startPrefixMapping(java.lang.String pPrefix, java.lang.String pURI)
           
 boolean testGroupParser(JMSAXGroupParser pParser, java.lang.String pNamespaceURI, java.lang.String pLocalName, java.lang.String pQName, org.xml.sax.Attributes pAttrs)
          Tests, whether the group parser accepts the element.
 void validationEvent(int pSeverity, java.lang.String pMsg, java.lang.String pErrorCode, java.lang.Exception pException)
          Posts a ValidationEvent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JMUnmarshallerHandlerImpl

public JMUnmarshallerHandlerImpl(JMUnmarshaller pUnmarshaller)
Creates a new instance, controlled by the given JMUnmarshaller.

Method Detail

getLevel

public int getLevel()
Description copied from interface: JMUnmarshallerHandler
Returns the current level of nested elements.

Specified by:
getLevel in interface JMUnmarshallerHandler

setObserver

public void setObserver(Observer pObserver)
Sets an observer, which will be notified, when the element has been parsed.

Specified by:
setObserver in interface JMUnmarshallerHandler

getObserver

public Observer getObserver()
Returns the observer, which will be notified, when the element has been parsed.

Specified by:
getObserver in interface JMUnmarshallerHandler

getJMUnmarshaller

public JMUnmarshaller getJMUnmarshaller()
Returns the JMUnmarshaller, which created this handler.

Specified by:
getJMUnmarshaller in interface JMUnmarshallerHandler

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator pLocator)
Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Specified by:
startDocument in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Specified by:
endDocument in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

startPrefixMapping

public void startPrefixMapping(java.lang.String pPrefix,
                               java.lang.String pURI)
                        throws org.xml.sax.SAXException
Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

endPrefixMapping

public void endPrefixMapping(java.lang.String pPrefix)
                      throws org.xml.sax.SAXException
Specified by:
endPrefixMapping in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

testGroupParser

public boolean testGroupParser(JMSAXGroupParser pParser,
                               java.lang.String pNamespaceURI,
                               java.lang.String pLocalName,
                               java.lang.String pQName,
                               org.xml.sax.Attributes pAttrs)
                        throws org.xml.sax.SAXException
Tests, whether the group parser accepts the element. If so, adds the group parser to the stack.

Throws:
org.xml.sax.SAXException

addElementParser

public void addElementParser(JMSAXElementParser pParser)
Adds a parser for an nested element to the stack of parsers.


startElement

public void startElement(java.lang.String pNamespaceURI,
                         java.lang.String pLocalName,
                         java.lang.String pQName,
                         org.xml.sax.Attributes pAttrs)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String pNamespaceURI,
                       java.lang.String pLocalName,
                       java.lang.String pQName)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

characters

public void characters(char[] pChars,
                       int pOffset,
                       int pLen)
                throws org.xml.sax.SAXException
Specified by:
characters in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

ignorableWhitespace

public void ignorableWhitespace(char[] pChars,
                                int pStart,
                                int pLen)
                         throws org.xml.sax.SAXException
Specified by:
ignorableWhitespace in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

processingInstruction

public void processingInstruction(java.lang.String pTarget,
                                  java.lang.String pData)
                           throws org.xml.sax.SAXException
Specified by:
processingInstruction in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

parseConversionEvent

public void parseConversionEvent(java.lang.String pMsg,
                                 java.lang.Exception pException)
                          throws org.xml.sax.SAXException
Posts a ParseConversionEvent.

Throws:
org.xml.sax.SAXException

validationEvent

public void validationEvent(int pSeverity,
                            java.lang.String pMsg,
                            java.lang.String pErrorCode,
                            java.lang.Exception pException)
                     throws org.xml.sax.SAXException
Posts a ValidationEvent.

Throws:
org.xml.sax.SAXException

skippedEntity

public void skippedEntity(java.lang.String pName)
                   throws org.xml.sax.SAXException
Specified by:
skippedEntity in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

getResult

public java.lang.Object getResult()
                           throws JAXBException,
                                  java.lang.IllegalStateException
Description copied from interface: UnmarshallerHandler

Returns the unmarshalled object. This method may be invoked after an endDocument() event only. An IllegalStateException is thrown otherwise.

Specified by:
getResult in interface UnmarshallerHandler
Returns:
The unmarshalled object, never null. (An IllegalStateException is thrown, if no data is available.
Throws:
JAXBException - An error occurred. Note, that the UnmarshallerHandler throws a SAXException if an error occurs while unmarshalling the object. In such cases the JAXBException is typically nested within the SAXException.
java.lang.IllegalStateException - An endDocument() event has not yet been seen and no data is available.

getNamespaceSupport

public NamespaceSupport getNamespaceSupport()
Description copied from interface: JMUnmarshallerHandler
Returns an instance of NamespaceSupport.

Specified by:
getNamespaceSupport in interface JMUnmarshallerHandler

getDocumentLocator

public org.xml.sax.Locator getDocumentLocator()
Description copied from interface: JMUnmarshallerHandler
Returns an instance of Locator, if it has been set, or null.

Specified by:
getDocumentLocator in interface JMUnmarshallerHandler
See Also:
ContentHandler.setDocumentLocator(org.xml.sax.Locator)

getDatatypeConverter

public DatatypeConverterInterface getDatatypeConverter()
Description copied from interface: JMUnmarshallerHandler
Returns an instance of DatatypeConverterInterface.

Specified by:
getDatatypeConverter in interface JMUnmarshallerHandler

addSimpleAtomicState

public void addSimpleAtomicState()
Indicates, that the handler is parsing a simple, atomic element.