org.n52.security.common.xml
Class XMLChunkHandlerAdapter

java.lang.Object
  extended by org.n52.security.common.xml.XMLChunkHandlerAdapter
All Implemented Interfaces:
XMLChunkHandler

public abstract class XMLChunkHandlerAdapter
extends Object
implements XMLChunkHandler

Implements the XMLPartialStreamHandler interface with empty method stubs, so that subclasses only need to implement methods in which they are interested.

It declares a helper method, which closes the open xml chunk within the *Befor/AfterChild* methods.

Version:
$Revision: $
Author:
Marko Reiprecht Created on 18.04.2008

Constructor Summary
XMLChunkHandlerAdapter()
           
 
Method Summary
protected  String closePartialXml(String xmlChunk, QName endElement)
          Method appends the endtag to a open xml chunk.
protected  String getXPathSimple(List<QName> currentXPath)
          Gets the current xpath location as simpel element string, without namespaces.
protected  String getXPathWithNamespaces(List<QName> currentXPath)
          Gets the current xpath as string with namespaces.
protected  String getXPathWithNamespacesAndPrefixes(List<QName> currentXPath)
          Gets the current xpath as string with namespaces and prefixes.
protected  String getXPathWithPrefixes(List<QName> currentXPath)
          Gets the current xpath as simple string with prefixes.
 void handleChunkAfterChildHandler(List<QName> currentXPath, QName handlerQName, String xmlChunk, QName childQName, XMLChunkHandler childHandler)
          Invoked if the end tag of an element, for which a child handler is registered is reached.
 void handleChunkBeforChildHandler(List<QName> currentXPath, QName handlerQName, String xmlChunk, QName childQName, XMLChunkHandler childHandler)
          Invoked if the start tag of an element, for which a child handler is registered is reached.
 void handleChunkEnd(List<QName> currentXPath, QName handlerQName, String xmlChunk)
          Invoked if the end tag of the xml block/chunk is reached.
 void handleChunkStart(List<QName> currentXPath, QName handlerQName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLChunkHandlerAdapter

public XMLChunkHandlerAdapter()
Method Detail

closePartialXml

protected String closePartialXml(String xmlChunk,
                                 QName endElement)
Method appends the endtag to a open xml chunk.

Parameters:
xmlChunk - the partialXml.
endElement - the endElement.
Returns:
String.

getXPathSimple

protected String getXPathSimple(List<QName> currentXPath)
Gets the current xpath location as simpel element string, without namespaces.

Parameters:
currentXPath -
Returns:
a string like /elementA/elementB/..

getXPathWithPrefixes

protected String getXPathWithPrefixes(List<QName> currentXPath)
Gets the current xpath as simple string with prefixes.

Parameters:
currentXPath -
Returns:
a string like: /x:elementA/y:elementB/..

getXPathWithNamespacesAndPrefixes

protected String getXPathWithNamespacesAndPrefixes(List<QName> currentXPath)
Gets the current xpath as string with namespaces and prefixes.

Parameters:
currentXPath -
Returns:
a string like: /{namespaceX}x:elementA/{namespaceY}y:elementB/..

getXPathWithNamespaces

protected String getXPathWithNamespaces(List<QName> currentXPath)
Gets the current xpath as string with namespaces.

Parameters:
currentXPath -
Returns:
a string like: /{namespaceX}elementA/{namespaceY}elementB/..

handleChunkAfterChildHandler

public void handleChunkAfterChildHandler(List<QName> currentXPath,
                                         QName handlerQName,
                                         String xmlChunk,
                                         QName childQName,
                                         XMLChunkHandler childHandler)
Description copied from interface: XMLChunkHandler
Invoked if the end tag of an element, for which a child handler is registered is reached.

The xmlChunk is not well formed, because the end tag is not closed.

Specified by:
handleChunkAfterChildHandler in interface XMLChunkHandler
Parameters:
currentXPath - Xpath (QName Path) to the current element.
handlerQName - the handlerQName.
xmlChunk - the xmlChunk.
childQName - the childQName.
childHandler - the childHandler.
See Also:
de.conterra.wpos.core.xml.XMLStreamChunkHandler#handleChunkAfterChildHandler(java.util.List, javax.xml.namespace.QName, java.lang.String, javax.xml.namespace.QName, de.conterra.wpos.core.xml.XMLStreamChunkHandler)

handleChunkBeforChildHandler

public void handleChunkBeforChildHandler(List<QName> currentXPath,
                                         QName handlerQName,
                                         String xmlChunk,
                                         QName childQName,
                                         XMLChunkHandler childHandler)
Description copied from interface: XMLChunkHandler
Invoked if the start tag of an element, for which a child handler is registered is reached. The xmlChunk is not well formed, because the end tag is not closed.

Specified by:
handleChunkBeforChildHandler in interface XMLChunkHandler
Parameters:
currentXPath - Xpath (QName Path) to the current element.
handlerQName - the handlerQName.
xmlChunk - the xmlChunk.
childQName - the childQName.
childHandler - the childHandler.
See Also:
de.conterra.wpos.core.xml.XMLStreamChunkHandler#handleChunkBeforChildHandler(java.util.List, javax.xml.namespace.QName, java.lang.String, javax.xml.namespace.QName, de.conterra.wpos.core.xml.XMLStreamChunkHandler)

handleChunkEnd

public void handleChunkEnd(List<QName> currentXPath,
                           QName handlerQName,
                           String xmlChunk)
Description copied from interface: XMLChunkHandler
Invoked if the end tag of the xml block/chunk is reached.

Specified by:
handleChunkEnd in interface XMLChunkHandler
Parameters:
currentXPath - Xpath (QName Path) to the current element.
handlerQName - the handlerQName.
xmlChunk - the partialXml.
See Also:
de.conterra.wpos.core.xml.XMLStreamChunkHandler#handleChunkEnd(java.util.List, javax.xml.namespace.QName, java.lang.String)

handleChunkStart

public void handleChunkStart(List<QName> currentXPath,
                             QName handlerQName)
Specified by:
handleChunkStart in interface XMLChunkHandler
See Also:
de.conterra.wpos.core.xml.XMLStreamChunkHandler#handleChunkStart(java.util.List, javax.xml.namespace.QName)


Copyright © 2004–2013 52north.org. All rights reserved.