org.apache.axiom.om.impl.llom
Class OMTextImpl

java.lang.Object
  extended by org.apache.axiom.om.impl.llom.OMNodeImpl
      extended by org.apache.axiom.om.impl.llom.OMTextImpl
All Implemented Interfaces:
org.apache.axiom.om.impl.OMNodeEx, org.apache.axiom.om.OMConstants, org.apache.axiom.om.OMNode, org.apache.axiom.om.OMText

public class OMTextImpl
extends OMNodeImpl
implements org.apache.axiom.om.OMText, org.apache.axiom.om.OMConstants


Field Summary
protected  org.apache.axiom.om.OMAttribute attribute
          Field attributes used when serializing Binary stuff as MTOM optimized.
private  boolean calcNS
           
protected  char[] charArray
           
private  java.lang.String contentID
          Field contentID for the mime part used when serializing Binary stuff as MTOM optimized.
private  java.lang.Object dataHandlerObject
          Field dataHandler contains the DataHandler Declaring as Object to remove the dependency on Javax.activation.DataHandler
private static java.lang.String EMTPY_STRING
           
protected  boolean isBinary
           
protected  java.lang.String localName
          Field localName used when serializing Binary stuff as MTOM optimized.
protected  java.lang.String mimeType
           
protected  boolean optimize
           
protected  org.apache.axiom.om.OMNamespace textNS
           
protected  java.lang.String value
           
static org.apache.axiom.om.OMNamespace XOP_NS
          Field nameSpace used when serializing Binary stuff as MTOM optimized.
 
Fields inherited from class org.apache.axiom.om.impl.llom.OMNodeImpl
builder, done, factory, nextSibling, nodeType, parent, previousSibling
 
Fields inherited from interface org.apache.axiom.om.OMNode
CDATA_SECTION_NODE, COMMENT_NODE, DTD_NODE, ELEMENT_NODE, ENTITY_REFERENCE_NODE, PI_NODE, SPACE_NODE, TEXT_NODE
 
Fields inherited from interface org.apache.axiom.om.OMConstants
ARRAY_ITEM_LOCALNAME, ARRAY_ITEM_NS_PREFIX, ARRAY_ITEM_NSURI, ARRAY_ITEM_QNAME, DATA_HANDLER, DEFAULT_CHAR_SET_ENCODING, DEFAULT_DEFAULT_NAMESPACE, DEFAULT_XML_VERSION, IS_BINARY, IS_DATA_HANDLERS_AWARE, PULL_TYPE_BUILDER, PUSH_TYPE_BUILDER, XMLNS_NS_PREFIX, XMLNS_NS_URI, XMLNS_PREFIX, XMLNS_URI
 
Constructor Summary
OMTextImpl(java.lang.Object dataHandler, boolean optimize, org.apache.axiom.om.OMFactory factory)
           
OMTextImpl(java.lang.Object dataHandler, org.apache.axiom.om.OMFactory factory)
           
OMTextImpl(org.apache.axiom.om.OMContainer parent, char[] charArray, int nodeType, org.apache.axiom.om.OMFactory factory)
           
OMTextImpl(org.apache.axiom.om.OMContainer parent, OMTextImpl source, org.apache.axiom.om.OMFactory factory)
          Construct OMTextImpl that is a copy of the source OMTextImpl
OMTextImpl(org.apache.axiom.om.OMContainer parent, javax.xml.namespace.QName text, int nodeType, org.apache.axiom.om.OMFactory factory)
           
OMTextImpl(org.apache.axiom.om.OMContainer parent, javax.xml.namespace.QName text, org.apache.axiom.om.OMFactory factory)
           
OMTextImpl(org.apache.axiom.om.OMContainer parent, java.lang.String text, int nodeType, org.apache.axiom.om.OMFactory factory)
           
OMTextImpl(org.apache.axiom.om.OMContainer parent, java.lang.String text, org.apache.axiom.om.OMFactory factory)
          Constructor OMTextImpl.
OMTextImpl(org.apache.axiom.om.OMContainer parent, java.lang.String s, java.lang.String mimeType, boolean optimize, org.apache.axiom.om.OMFactory factory)
           
OMTextImpl(java.lang.String s, int nodeType, org.apache.axiom.om.OMFactory factory)
           
OMTextImpl(java.lang.String contentID, org.apache.axiom.om.OMContainer parent, org.apache.axiom.om.OMXMLParserWrapper builder, org.apache.axiom.om.OMFactory factory)
           
OMTextImpl(java.lang.String s, org.apache.axiom.om.OMFactory factory)
          Constructor OMTextImpl.
OMTextImpl(java.lang.String s, java.lang.String mimeType, boolean optimize, org.apache.axiom.om.OMFactory factory)
           
 
Method Summary
 void buildWithAttachments()
          Parses this node and builds the object structure in memory.
 void discard()
          A slightly different implementation of the discard method.
 java.lang.String getContentID()
           
 java.lang.Object getDataHandler()
          Gets the datahandler.
 java.io.InputStream getInputStream()
           
 java.lang.String getLocalName()
           
 org.apache.axiom.om.OMNamespace getNamespace()
           
 java.lang.String getText()
          Returns the value.
 javax.xml.namespace.QName getTextAsQName()
          Returns the value.
 char[] getTextCharacters()
           
private  java.lang.String getTextFromProperPlace()
          This OMText contains two data source:value and charArray.
 void internalSerialize(javax.xml.stream.XMLStreamWriter writer)
          Serializes the node with caching.
 void internalSerializeAndConsume(javax.xml.stream.XMLStreamWriter writer)
          Serializes the node without caching.
private  void internalSerializeLocal(javax.xml.stream.XMLStreamWriter writer2)
           
 boolean isBinary()
           
 boolean isCharacters()
           
 boolean isOptimized()
           
(package private) static void serializeAttribute(org.apache.axiom.om.OMAttribute attr, javax.xml.stream.XMLStreamWriter writer)
          Method serializeAttribute.
(package private) static void serializeNamespace(org.apache.axiom.om.OMNamespace namespace, javax.xml.stream.XMLStreamWriter writer)
          Method serializeNamespace.
private  void serializeStartpart(javax.xml.stream.XMLStreamWriter writer)
           
 void setBinary(boolean value)
          Receiving binary can happen as either MTOM attachments or as Base64 Text In the case of Base64 user has to explicitly specify that the content is binary, before calling getDataHandler(), getInputStream()....
 void setOptimize(boolean value)
           
private  void writeOutput(javax.xml.stream.XMLStreamWriter writer)
          Writes the relevant output.
 
Methods inherited from class org.apache.axiom.om.impl.llom.OMNodeImpl
build, close, detach, getNextOMSibling, getOMFactory, getParent, getPreviousOMSibling, getType, importNode, insertSiblingAfter, insertSiblingBefore, isComplete, serialize, serialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume, setComplete, setNextOMSibling, setParent, setPreviousOMSibling, setType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.axiom.om.OMNode
build, close, detach, getNextOMSibling, getOMFactory, getParent, getPreviousOMSibling, getType, insertSiblingAfter, insertSiblingBefore, isComplete, serialize, serialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume
 

Field Detail

XOP_NS

public static final org.apache.axiom.om.OMNamespace XOP_NS
Field nameSpace used when serializing Binary stuff as MTOM optimized.


value

protected java.lang.String value

charArray

protected char[] charArray

calcNS

private boolean calcNS

textNS

protected org.apache.axiom.om.OMNamespace textNS

mimeType

protected java.lang.String mimeType

optimize

protected boolean optimize

isBinary

protected boolean isBinary

contentID

private java.lang.String contentID
Field contentID for the mime part used when serializing Binary stuff as MTOM optimized.


dataHandlerObject

private java.lang.Object dataHandlerObject
Field dataHandler contains the DataHandler Declaring as Object to remove the dependency on Javax.activation.DataHandler


localName

protected java.lang.String localName
Field localName used when serializing Binary stuff as MTOM optimized.


attribute

protected org.apache.axiom.om.OMAttribute attribute
Field attributes used when serializing Binary stuff as MTOM optimized.


EMTPY_STRING

private static final java.lang.String EMTPY_STRING
See Also:
Constant Field Values
Constructor Detail

OMTextImpl

public OMTextImpl(java.lang.String s,
                  org.apache.axiom.om.OMFactory factory)
Constructor OMTextImpl.

Parameters:
s -

OMTextImpl

public OMTextImpl(java.lang.String s,
                  int nodeType,
                  org.apache.axiom.om.OMFactory factory)
Parameters:
s -
nodeType - - OMText can handle CHARACTERS, SPACES, CDATA and ENTITY REFERENCES. Constants for this can be found in OMNode.

OMTextImpl

public OMTextImpl(org.apache.axiom.om.OMContainer parent,
                  java.lang.String text,
                  org.apache.axiom.om.OMFactory factory)
Constructor OMTextImpl.

Parameters:
parent -
text -

OMTextImpl

public OMTextImpl(org.apache.axiom.om.OMContainer parent,
                  OMTextImpl source,
                  org.apache.axiom.om.OMFactory factory)
Construct OMTextImpl that is a copy of the source OMTextImpl

Parameters:
parent -
source - OMTextImpl
factory -

OMTextImpl

public OMTextImpl(org.apache.axiom.om.OMContainer parent,
                  java.lang.String text,
                  int nodeType,
                  org.apache.axiom.om.OMFactory factory)

OMTextImpl

public OMTextImpl(org.apache.axiom.om.OMContainer parent,
                  char[] charArray,
                  int nodeType,
                  org.apache.axiom.om.OMFactory factory)

OMTextImpl

public OMTextImpl(org.apache.axiom.om.OMContainer parent,
                  javax.xml.namespace.QName text,
                  org.apache.axiom.om.OMFactory factory)

OMTextImpl

public OMTextImpl(org.apache.axiom.om.OMContainer parent,
                  javax.xml.namespace.QName text,
                  int nodeType,
                  org.apache.axiom.om.OMFactory factory)

OMTextImpl

public OMTextImpl(java.lang.String s,
                  java.lang.String mimeType,
                  boolean optimize,
                  org.apache.axiom.om.OMFactory factory)
Parameters:
s - - base64 encoded String representation of Binary
mimeType - of the Binary

OMTextImpl

public OMTextImpl(org.apache.axiom.om.OMContainer parent,
                  java.lang.String s,
                  java.lang.String mimeType,
                  boolean optimize,
                  org.apache.axiom.om.OMFactory factory)
Parameters:
parent -
s - - base64 encoded String representation of Binary
mimeType - of the Binary

OMTextImpl

public OMTextImpl(java.lang.Object dataHandler,
                  org.apache.axiom.om.OMFactory factory)
Parameters:
dataHandler - To send binary optimised content Created programatically.

OMTextImpl

public OMTextImpl(java.lang.Object dataHandler,
                  boolean optimize,
                  org.apache.axiom.om.OMFactory factory)
Parameters:
dataHandler -
optimize - To send binary content. Created progrmatically.

OMTextImpl

public OMTextImpl(java.lang.String contentID,
                  org.apache.axiom.om.OMContainer parent,
                  org.apache.axiom.om.OMXMLParserWrapper builder,
                  org.apache.axiom.om.OMFactory factory)
Parameters:
contentID -
parent -
builder - Used when the builder is encountered with a XOP:Include tag Stores a reference to the builder and the content-id. Supports deferred parsing of MIME messages.
Method Detail

internalSerialize

public void internalSerialize(javax.xml.stream.XMLStreamWriter writer)
                       throws javax.xml.stream.XMLStreamException
Description copied from class: OMNodeImpl
Serializes the node with caching.

Specified by:
internalSerialize in interface org.apache.axiom.om.impl.OMNodeEx
Overrides:
internalSerialize in class OMNodeImpl
Parameters:
writer -
Throws:
javax.xml.stream.XMLStreamException

writeOutput

private void writeOutput(javax.xml.stream.XMLStreamWriter writer)
                  throws javax.xml.stream.XMLStreamException
Writes the relevant output.

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

getText

public java.lang.String getText()
                         throws org.apache.axiom.om.OMException
Returns the value.

Specified by:
getText in interface org.apache.axiom.om.OMText
Throws:
org.apache.axiom.om.OMException

getTextCharacters

public char[] getTextCharacters()
Specified by:
getTextCharacters in interface org.apache.axiom.om.OMText

isCharacters

public boolean isCharacters()
Specified by:
isCharacters in interface org.apache.axiom.om.OMText

getTextFromProperPlace

private java.lang.String getTextFromProperPlace()
This OMText contains two data source:value and charArray. This method will return text from correct place.


getTextAsQName

public javax.xml.namespace.QName getTextAsQName()
                                         throws org.apache.axiom.om.OMException
Returns the value.

Specified by:
getTextAsQName in interface org.apache.axiom.om.OMText
Throws:
org.apache.axiom.om.OMException

getNamespace

public org.apache.axiom.om.OMNamespace getNamespace()
Specified by:
getNamespace in interface org.apache.axiom.om.OMText

isOptimized

public boolean isOptimized()
Specified by:
isOptimized in interface org.apache.axiom.om.OMText

setOptimize

public void setOptimize(boolean value)
Specified by:
setOptimize in interface org.apache.axiom.om.OMText

setBinary

public void setBinary(boolean value)
Receiving binary can happen as either MTOM attachments or as Base64 Text In the case of Base64 user has to explicitly specify that the content is binary, before calling getDataHandler(), getInputStream()....

Specified by:
setBinary in interface org.apache.axiom.om.OMText

isBinary

public boolean isBinary()
Specified by:
isBinary in interface org.apache.axiom.om.OMText

getDataHandler

public java.lang.Object getDataHandler()
Gets the datahandler.

Specified by:
getDataHandler in interface org.apache.axiom.om.OMText
Returns:
Returns javax.activation.DataHandler

getLocalName

public java.lang.String getLocalName()

getInputStream

public java.io.InputStream getInputStream()
                                   throws org.apache.axiom.om.OMException
Throws:
org.apache.axiom.om.OMException

getContentID

public java.lang.String getContentID()
Specified by:
getContentID in interface org.apache.axiom.om.OMText

internalSerializeAndConsume

public void internalSerializeAndConsume(javax.xml.stream.XMLStreamWriter writer)
                                 throws javax.xml.stream.XMLStreamException
Description copied from class: OMNodeImpl
Serializes the node without caching.

Specified by:
internalSerializeAndConsume in interface org.apache.axiom.om.impl.OMNodeEx
Overrides:
internalSerializeAndConsume in class OMNodeImpl
Throws:
javax.xml.stream.XMLStreamException

internalSerializeLocal

private void internalSerializeLocal(javax.xml.stream.XMLStreamWriter writer2)
                             throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

serializeStartpart

private void serializeStartpart(javax.xml.stream.XMLStreamWriter writer)
                         throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

serializeAttribute

static void serializeAttribute(org.apache.axiom.om.OMAttribute attr,
                               javax.xml.stream.XMLStreamWriter writer)
                        throws javax.xml.stream.XMLStreamException
Method serializeAttribute.

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

serializeNamespace

static void serializeNamespace(org.apache.axiom.om.OMNamespace namespace,
                               javax.xml.stream.XMLStreamWriter writer)
                        throws javax.xml.stream.XMLStreamException
Method serializeNamespace.

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

discard

public void discard()
             throws org.apache.axiom.om.OMException
A slightly different implementation of the discard method.

Specified by:
discard in interface org.apache.axiom.om.OMNode
Throws:
org.apache.axiom.om.OMException

buildWithAttachments

public void buildWithAttachments()
Description copied from class: OMNodeImpl
Parses this node and builds the object structure in memory. AXIOM supports two levels of deffered building. First is deffered building of AXIOM using StAX. Second level is the deffered building of attachments. AXIOM reads in the attachements from the stream only when user asks by calling getDataHandler(). build() method builds the OM without the attachments. buildAll() builds the OM together with attachement data. This becomes handy when user wants to free the input stream.

Specified by:
buildWithAttachments in interface org.apache.axiom.om.OMNode
Overrides:
buildWithAttachments in class OMNodeImpl