org.rhq.enterprise.server.sync
Class ExportReader

java.lang.Object
  extended by org.rhq.enterprise.server.sync.ExportReader
All Implemented Interfaces:
XMLStreamConstants, XMLStreamReader

public class ExportReader
extends Object
implements XMLStreamReader

A decorator implementation of the XMLStreamReader interface to support safe reading from the export stream by multiple "parties".

This implementation works with the assumption that each of its users will read the XML data fully contained within another tag.

The instantiator of this class will create a new instance of this class when it encounters a tag that it wants the "user" to read from. The instantiator creates a new ExportReader and passes it over to the user. It is guaranteed that the user cannot read past the end tag (to the user, it appears she reached the end of the document). When the ExportReader reaches the "end" of document, the wrapped XML stream will have read the end tag of the start tag that the instantiator first encountered. The current state of the wrapped XML reader will therefore be END_ELEMENT.

Author:
Lukas Krejci

Field Summary
 
Fields inherited from interface javax.xml.stream.XMLStreamConstants
ATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENT
 
Constructor Summary
ExportReader(XMLStreamReader reader)
           
 
Method Summary
 void close()
           
 int getAttributeCount()
           
 String getAttributeLocalName(int index)
           
 QName getAttributeName(int index)
           
 String getAttributeNamespace(int index)
           
 String getAttributePrefix(int index)
           
 String getAttributeType(int index)
           
 String getAttributeValue(int index)
           
 String getAttributeValue(String namespaceURI, String localName)
           
 String getCharacterEncodingScheme()
           
 String getElementText()
           
 String getEncoding()
           
 int getEventType()
           
 String getLocalName()
           
 Location getLocation()
           
 QName getName()
           
 NamespaceContext getNamespaceContext()
           
 int getNamespaceCount()
           
 String getNamespacePrefix(int index)
           
 String getNamespaceURI()
           
 String getNamespaceURI(int index)
           
 String getNamespaceURI(String prefix)
           
 String getPIData()
           
 String getPITarget()
           
 String getPrefix()
           
 Object getProperty(String name)
           
 String getText()
           
 char[] getTextCharacters()
           
 int getTextCharacters(int sourceStart, char[] target, int targetStart, int length)
           
 int getTextLength()
           
 int getTextStart()
           
 String getVersion()
           
 boolean hasName()
           
 boolean hasNext()
           
 boolean hasText()
           
 boolean isAttributeSpecified(int index)
           
 boolean isCharacters()
           
 boolean isEndElement()
           
 boolean isStandalone()
           
 boolean isStartElement()
           
 boolean isWhiteSpace()
           
 int next()
           
 int nextTag()
           
 void require(int type, String namespaceURI, String localName)
           
 boolean standaloneSet()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExportReader

public ExportReader(XMLStreamReader reader)
Method Detail

getProperty

public Object getProperty(String name)
                   throws IllegalArgumentException
Specified by:
getProperty in interface XMLStreamReader
Parameters:
name -
Returns:
Throws:
IllegalArgumentException
See Also:
XMLStreamReader.getProperty(java.lang.String)

next

public int next()
         throws XMLStreamException
Specified by:
next in interface XMLStreamReader
Returns:
Throws:
XMLStreamException
See Also:
XMLStreamReader.next()

require

public void require(int type,
                    String namespaceURI,
                    String localName)
             throws XMLStreamException
Specified by:
require in interface XMLStreamReader
Parameters:
type -
namespaceURI -
localName -
Throws:
XMLStreamException
See Also:
XMLStreamReader.require(int, java.lang.String, java.lang.String)

getElementText

public String getElementText()
                      throws XMLStreamException
Specified by:
getElementText in interface XMLStreamReader
Returns:
Throws:
XMLStreamException
See Also:
XMLStreamReader.getElementText()

nextTag

public int nextTag()
            throws XMLStreamException
Specified by:
nextTag in interface XMLStreamReader
Returns:
Throws:
XMLStreamException
See Also:
XMLStreamReader.nextTag()

hasNext

public boolean hasNext()
                throws XMLStreamException
Specified by:
hasNext in interface XMLStreamReader
Returns:
Throws:
XMLStreamException
See Also:
XMLStreamReader.hasNext()

close

public void close()
           throws XMLStreamException
Specified by:
close in interface XMLStreamReader
Throws:
XMLStreamException
See Also:
XMLStreamReader.close()

getNamespaceURI

public String getNamespaceURI(String prefix)
Specified by:
getNamespaceURI in interface XMLStreamReader
Parameters:
prefix -
Returns:
See Also:
XMLStreamReader.getNamespaceURI(java.lang.String)

isStartElement

public boolean isStartElement()
Specified by:
isStartElement in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.isStartElement()

isEndElement

public boolean isEndElement()
Specified by:
isEndElement in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.isEndElement()

isCharacters

public boolean isCharacters()
Specified by:
isCharacters in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.isCharacters()

isWhiteSpace

public boolean isWhiteSpace()
Specified by:
isWhiteSpace in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.isWhiteSpace()

getAttributeValue

public String getAttributeValue(String namespaceURI,
                                String localName)
Specified by:
getAttributeValue in interface XMLStreamReader
Parameters:
namespaceURI -
localName -
Returns:
See Also:
XMLStreamReader.getAttributeValue(java.lang.String, java.lang.String)

getAttributeCount

public int getAttributeCount()
Specified by:
getAttributeCount in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.getAttributeCount()

getAttributeName

public QName getAttributeName(int index)
Specified by:
getAttributeName in interface XMLStreamReader
Parameters:
index -
Returns:
See Also:
XMLStreamReader.getAttributeName(int)

getAttributeNamespace

public String getAttributeNamespace(int index)
Specified by:
getAttributeNamespace in interface XMLStreamReader
Parameters:
index -
Returns:
See Also:
XMLStreamReader.getAttributeNamespace(int)

getAttributeLocalName

public String getAttributeLocalName(int index)
Specified by:
getAttributeLocalName in interface XMLStreamReader
Parameters:
index -
Returns:
See Also:
XMLStreamReader.getAttributeLocalName(int)

getAttributePrefix

public String getAttributePrefix(int index)
Specified by:
getAttributePrefix in interface XMLStreamReader
Parameters:
index -
Returns:
See Also:
XMLStreamReader.getAttributePrefix(int)

getAttributeType

public String getAttributeType(int index)
Specified by:
getAttributeType in interface XMLStreamReader
Parameters:
index -
Returns:
See Also:
XMLStreamReader.getAttributeType(int)

getAttributeValue

public String getAttributeValue(int index)
Specified by:
getAttributeValue in interface XMLStreamReader
Parameters:
index -
Returns:
See Also:
XMLStreamReader.getAttributeValue(int)

isAttributeSpecified

public boolean isAttributeSpecified(int index)
Specified by:
isAttributeSpecified in interface XMLStreamReader
Parameters:
index -
Returns:
See Also:
XMLStreamReader.isAttributeSpecified(int)

getNamespaceCount

public int getNamespaceCount()
Specified by:
getNamespaceCount in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.getNamespaceCount()

getNamespacePrefix

public String getNamespacePrefix(int index)
Specified by:
getNamespacePrefix in interface XMLStreamReader
Parameters:
index -
Returns:
See Also:
XMLStreamReader.getNamespacePrefix(int)

getNamespaceURI

public String getNamespaceURI(int index)
Specified by:
getNamespaceURI in interface XMLStreamReader
Parameters:
index -
Returns:
See Also:
XMLStreamReader.getNamespaceURI(int)

getNamespaceContext

public NamespaceContext getNamespaceContext()
Specified by:
getNamespaceContext in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.getNamespaceContext()

getEventType

public int getEventType()
Specified by:
getEventType in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.getEventType()

getText

public String getText()
Specified by:
getText in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.getText()

getTextCharacters

public char[] getTextCharacters()
Specified by:
getTextCharacters in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.getTextCharacters()

getTextCharacters

public int getTextCharacters(int sourceStart,
                             char[] target,
                             int targetStart,
                             int length)
                      throws XMLStreamException
Specified by:
getTextCharacters in interface XMLStreamReader
Parameters:
sourceStart -
target -
targetStart -
length -
Returns:
Throws:
XMLStreamException
See Also:
XMLStreamReader.getTextCharacters(int, char[], int, int)

getTextStart

public int getTextStart()
Specified by:
getTextStart in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.getTextStart()

getTextLength

public int getTextLength()
Specified by:
getTextLength in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.getTextLength()

getEncoding

public String getEncoding()
Specified by:
getEncoding in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.getEncoding()

hasText

public boolean hasText()
Specified by:
hasText in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.hasText()

getLocation

public Location getLocation()
Specified by:
getLocation in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.getLocation()

getName

public QName getName()
Specified by:
getName in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.getName()

getLocalName

public String getLocalName()
Specified by:
getLocalName in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.getLocalName()

hasName

public boolean hasName()
Specified by:
hasName in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.hasName()

getNamespaceURI

public String getNamespaceURI()
Specified by:
getNamespaceURI in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.getNamespaceURI()

getPrefix

public String getPrefix()
Specified by:
getPrefix in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.getPrefix()

getVersion

public String getVersion()
Specified by:
getVersion in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.getVersion()

isStandalone

public boolean isStandalone()
Specified by:
isStandalone in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.isStandalone()

standaloneSet

public boolean standaloneSet()
Specified by:
standaloneSet in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.standaloneSet()

getCharacterEncodingScheme

public String getCharacterEncodingScheme()
Specified by:
getCharacterEncodingScheme in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.getCharacterEncodingScheme()

getPITarget

public String getPITarget()
Specified by:
getPITarget in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.getPITarget()

getPIData

public String getPIData()
Specified by:
getPIData in interface XMLStreamReader
Returns:
See Also:
XMLStreamReader.getPIData()


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.