org.apache.tuscany.sca.contribution.processor
Class BaseStAXArtifactProcessor

java.lang.Object
  extended by org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor
Direct Known Subclasses:
AnyAttributeProcessor, Axis2HeaderPolicyProcessor, Axis2TokenAuthenticationPolicyProcessor, BindingTypeProcessor, BPELDocumentProcessor, BPELImplementationProcessor, ComponentTypeDocumentProcessor, ComponentTypeProcessor, CompositeDocumentProcessor, CompositeProcessor, ConfiguredNodeImplementationProcessor, ConstrainingTypeDocumentProcessor, ConstrainingTypeProcessor, ContributionMetadataProcessor, DefaultBeanModelProcessor, EJBImplementationProcessor, ImplementationTypeProcessor, JEEImplementationProcessor, JMSHeaderPolicyProcessor, JMSTokenAuthenticationPolicyProcessor, NodeImplementationProcessor, OperationSelectorJMSDefaultProcessor, PolicyAttachPointProcessor, PolicySetProcessor, ProfileIntentProcessor, QualifiedIntentProcessor, SCADefinitionsProcessor, SimpleIntentProcessor, WireFormatJMSBytesProcessor, WireFormatJMSObjectProcessor, WireFormatJMSTextProcessor, WireFormatJMSTextXMLProcessor, WorkspaceProcessor, WSPolicyProcessor

public abstract class BaseStAXArtifactProcessor
extends java.lang.Object

A base class with utility methods for the other artifact processors in this module.


Nested Class Summary
static class BaseStAXArtifactProcessor.XAttr
          Represents an XML attribute that needs to be written to a document.
 
Constructor Summary
BaseStAXArtifactProcessor()
           
 
Method Summary
protected  boolean getBoolean(javax.xml.stream.XMLStreamReader reader, java.lang.String name)
          Returns the boolean value of an attribute.
protected  javax.xml.namespace.QName getQName(javax.xml.stream.XMLStreamReader reader, java.lang.String name)
          Returns the QName value of an attribute.
protected  java.util.List<javax.xml.namespace.QName> getQNames(javax.xml.stream.XMLStreamReader reader, java.lang.String name)
          Returns the value of an attribute as a list of QNames.
protected  javax.xml.namespace.QName getQNameValue(javax.xml.stream.XMLStreamReader reader, java.lang.String value)
          Returns a QName from a string.
protected  java.lang.String getString(javax.xml.stream.XMLStreamReader reader, java.lang.String name)
          Returns the string value of an attribute.
protected  javax.xml.namespace.QName getXSIType(javax.xml.stream.XMLStreamReader reader)
          Returns the value of xsi:type attribute
protected  boolean isSet(javax.xml.stream.XMLStreamReader reader, java.lang.String name)
          Test if an attribute is explicitly set
protected  boolean nextChildElement(javax.xml.stream.XMLStreamReader reader)
          Parse the next child element.
protected  void skipToEndElement(javax.xml.stream.XMLStreamReader reader)
          Advance the stream to the next END_ELEMENT event skipping any nested content.
protected  void writeAttributePrefixes(javax.xml.stream.XMLStreamWriter writer, BaseStAXArtifactProcessor.XAttr... attrs)
          Write attribute prefixes to the current element.
protected  void writeAttributes(javax.xml.stream.XMLStreamWriter writer, BaseStAXArtifactProcessor.XAttr... attrs)
          Write attributes to the current element.
protected  void writeEnd(javax.xml.stream.XMLStreamWriter writer)
          End an element.
protected  void writeEndDocument(javax.xml.stream.XMLStreamWriter writer)
          End a document.
protected  void writeStart(javax.xml.stream.XMLStreamWriter writer, javax.xml.namespace.QName qname, BaseStAXArtifactProcessor.XAttr... attrs)
          Start an element.
protected  void writeStart(javax.xml.stream.XMLStreamWriter writer, java.lang.String uri, java.lang.String name, BaseStAXArtifactProcessor.XAttr... attrs)
          Start an element.
protected  void writeStartDocument(javax.xml.stream.XMLStreamWriter writer, javax.xml.namespace.QName qname, BaseStAXArtifactProcessor.XAttr... attrs)
          Start a document.
protected  void writeStartDocument(javax.xml.stream.XMLStreamWriter writer, java.lang.String uri, java.lang.String name, BaseStAXArtifactProcessor.XAttr... attrs)
          Start a document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseStAXArtifactProcessor

public BaseStAXArtifactProcessor()
Method Detail

getQNameValue

protected javax.xml.namespace.QName getQNameValue(javax.xml.stream.XMLStreamReader reader,
                                                  java.lang.String value)
Returns a QName from a string.

Parameters:
reader -
value -
Returns:

getBoolean

protected boolean getBoolean(javax.xml.stream.XMLStreamReader reader,
                             java.lang.String name)
Returns the boolean value of an attribute.

Parameters:
reader -
name -
Returns:

getQName

protected javax.xml.namespace.QName getQName(javax.xml.stream.XMLStreamReader reader,
                                             java.lang.String name)
Returns the QName value of an attribute.

Parameters:
reader -
name -
Returns:

getQNames

protected java.util.List<javax.xml.namespace.QName> getQNames(javax.xml.stream.XMLStreamReader reader,
                                                              java.lang.String name)
Returns the value of an attribute as a list of QNames.

Parameters:
reader -
name -
Returns:

getString

protected java.lang.String getString(javax.xml.stream.XMLStreamReader reader,
                                     java.lang.String name)
Returns the string value of an attribute.

Parameters:
reader -
name -
Returns:

isSet

protected boolean isSet(javax.xml.stream.XMLStreamReader reader,
                        java.lang.String name)
Test if an attribute is explicitly set

Parameters:
reader -
name -
Returns:

getXSIType

protected javax.xml.namespace.QName getXSIType(javax.xml.stream.XMLStreamReader reader)
Returns the value of xsi:type attribute

Parameters:
reader - The XML stream reader
Returns:
The QName of the type, if the attribute is not present, null is returned.

nextChildElement

protected boolean nextChildElement(javax.xml.stream.XMLStreamReader reader)
                            throws javax.xml.stream.XMLStreamException
Parse the next child element.

Parameters:
reader -
Returns:
Throws:
javax.xml.stream.XMLStreamException

skipToEndElement

protected void skipToEndElement(javax.xml.stream.XMLStreamReader reader)
                         throws javax.xml.stream.XMLStreamException
Advance the stream to the next END_ELEMENT event skipping any nested content.

Parameters:
reader - the reader to advance
Throws:
javax.xml.stream.XMLStreamException - if there was a problem reading the stream

writeStart

protected void writeStart(javax.xml.stream.XMLStreamWriter writer,
                          java.lang.String uri,
                          java.lang.String name,
                          BaseStAXArtifactProcessor.XAttr... attrs)
                   throws javax.xml.stream.XMLStreamException
Start an element.

Parameters:
uri -
name -
attrs -
Throws:
javax.xml.stream.XMLStreamException

writeStart

protected void writeStart(javax.xml.stream.XMLStreamWriter writer,
                          javax.xml.namespace.QName qname,
                          BaseStAXArtifactProcessor.XAttr... attrs)
                   throws javax.xml.stream.XMLStreamException
Start an element.

Parameters:
qname -
attrs -
Throws:
javax.xml.stream.XMLStreamException

writeEnd

protected void writeEnd(javax.xml.stream.XMLStreamWriter writer)
                 throws javax.xml.stream.XMLStreamException
End an element.

Parameters:
writer -
Throws:
javax.xml.stream.XMLStreamException

writeStartDocument

protected void writeStartDocument(javax.xml.stream.XMLStreamWriter writer,
                                  java.lang.String uri,
                                  java.lang.String name,
                                  BaseStAXArtifactProcessor.XAttr... attrs)
                           throws javax.xml.stream.XMLStreamException
Start a document.

Parameters:
writer -
Throws:
javax.xml.stream.XMLStreamException

writeStartDocument

protected void writeStartDocument(javax.xml.stream.XMLStreamWriter writer,
                                  javax.xml.namespace.QName qname,
                                  BaseStAXArtifactProcessor.XAttr... attrs)
                           throws javax.xml.stream.XMLStreamException
Start a document.

Parameters:
writer -
qname -
attrs -
Throws:
javax.xml.stream.XMLStreamException

writeEndDocument

protected void writeEndDocument(javax.xml.stream.XMLStreamWriter writer)
                         throws javax.xml.stream.XMLStreamException
End a document.

Parameters:
writer -
Throws:
javax.xml.stream.XMLStreamException

writeAttributes

protected void writeAttributes(javax.xml.stream.XMLStreamWriter writer,
                               BaseStAXArtifactProcessor.XAttr... attrs)
                        throws javax.xml.stream.XMLStreamException
Write attributes to the current element.

Parameters:
writer -
attrs -
Throws:
javax.xml.stream.XMLStreamException

writeAttributePrefixes

protected void writeAttributePrefixes(javax.xml.stream.XMLStreamWriter writer,
                                      BaseStAXArtifactProcessor.XAttr... attrs)
                               throws javax.xml.stream.XMLStreamException
Write attribute prefixes to the current element.

Parameters:
writer -
attrs -
Throws:
javax.xml.stream.XMLStreamException