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

java.lang.Object
  extended by org.apache.axiom.om.impl.llom.OMNodeImpl
All Implemented Interfaces:
OMNodeEx, OMNode
Direct Known Subclasses:
OMCommentImpl, OMDocTypeImpl, OMElementImpl, OMProcessingInstructionImpl, OMTextImpl

public abstract class OMNodeImpl
extends Object
implements OMNode, OMNodeEx

Class OMNodeImpl


Field Summary
 OMXMLParserWrapper builder
          Field builder
protected  boolean done
          Field done
protected  OMFactory factory
           
protected  OMNodeImpl nextSibling
          Field nextSibling
protected  int nodeType
          Field nodeType
protected  OMContainerEx parent
          Field parent
protected  OMNodeImpl previousSibling
          Field 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
 
Constructor Summary
OMNodeImpl(OMContainer parent, OMFactory factory, boolean done)
          For a node to exist there must be a parent.
OMNodeImpl(OMFactory factory)
          Constructor OMNodeImpl
 
Method Summary
 void build()
          Parses this node and builds the object structure in memory.
 void buildWithAttachments()
          Parses this node and builds the object structure in memory.
 void close(boolean build)
          If a builder and parser is associated with the node, it is closed.
 OMNode detach()
          Removes this information item and its children, from the model completely.
 OMNode getNextOMSibling()
          Returns the next sibling.
 OMFactory getOMFactory()
          Returns the OMFactory that created this object
 OMContainer getParent()
          Returns the immediate parent of the node.
 OMNode getPreviousOMSibling()
          Gets the previous sibling.
 int getType()
          Gets the type of node, as this is the super class of all the nodes.
protected  OMNode importNode(OMNode child)
          This method is intended only to be used by Axiom intenals when merging Objects from different Axiom implementations to the LLOM implementation.
 void insertSiblingAfter(OMNode sibling)
          Inserts a sibling just after the current information item.
 void insertSiblingBefore(OMNode sibling)
          Inserts a sibling just before the current information item.
 void internalSerialize(javax.xml.stream.XMLStreamWriter writer)
          Serializes the node with caching.
 void internalSerializeAndConsume(javax.xml.stream.XMLStreamWriter writer)
          Serializes the node without caching.
 boolean isComplete()
          Indicates whether parser has parsed this information item completely or not.
 void serialize(OutputStream output)
          Serializes the node with caching.
 void serialize(OutputStream output, OMOutputFormat format)
          Serializes the node with caching.
 void serialize(Writer writer)
          Serializes the node with caching.
 void serialize(Writer writer2, OMOutputFormat format)
          Serializes the node with caching.
 void serialize(javax.xml.stream.XMLStreamWriter xmlWriter)
          Serializes the node with caching.
 void serializeAndConsume(OutputStream output)
          Serializes the node without caching.
 void serializeAndConsume(OutputStream output, OMOutputFormat format)
          Serializes the node without caching.
 void serializeAndConsume(Writer writer)
          Serializes the node without caching.
 void serializeAndConsume(Writer writer2, OMOutputFormat format)
          Serializes the node without caching.
 void serializeAndConsume(javax.xml.stream.XMLStreamWriter xmlWriter)
          Serializes the node without caching.
 void setComplete(boolean state)
          Method setComplete.
 void setNextOMSibling(OMNode node)
          Method setNextOMSibling.
 void setParent(OMContainer element)
          Method setParent.
 void setPreviousOMSibling(OMNode previousSibling)
          Method setPreviousOMSibling.
 void setType(int nodeType)
          Method 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
discard
 

Field Detail

parent

protected OMContainerEx parent
Field parent


nextSibling

protected OMNodeImpl nextSibling
Field nextSibling


previousSibling

protected OMNodeImpl previousSibling
Field previousSibling


builder

public OMXMLParserWrapper builder
Field builder


done

protected boolean done
Field done


nodeType

protected int nodeType
Field nodeType


factory

protected OMFactory factory
Constructor Detail

OMNodeImpl

public OMNodeImpl(OMFactory factory)
Constructor OMNodeImpl

Parameters:
factory - The OMFactory that created this

OMNodeImpl

public OMNodeImpl(OMContainer parent,
                  OMFactory factory,
                  boolean done)
For a node to exist there must be a parent.

Parameters:
parent - Parent OMContainer of this node
factory - The OMFactory that created this
Method Detail

getParent

public OMContainer getParent()
Returns the immediate parent of the node. Parent is always an Element.

Specified by:
getParent in interface OMNode
Returns:
Returns OMContainer.
Throws:
OMException

setParent

public void setParent(OMContainer element)
Method setParent.

Specified by:
setParent in interface OMNodeEx
Parameters:
element -

getNextOMSibling

public OMNode getNextOMSibling()
                        throws OMException
Returns the next sibling. This can be an OMAttribute or OMText or OMElement for others.

Specified by:
getNextOMSibling in interface OMNode
Returns:
Returns OMNode.
Throws:
OMException

setNextOMSibling

public void setNextOMSibling(OMNode node)
Method setNextOMSibling.

Specified by:
setNextOMSibling in interface OMNodeEx
Parameters:
node -

isComplete

public boolean isComplete()
Indicates whether parser has parsed this information item completely or not. If some information is not available in the item, one has to check this attribute to make sure that, this item has been parsed completely or not.

Specified by:
isComplete in interface OMNode
Returns:
Returns boolean.

setComplete

public void setComplete(boolean state)
Method setComplete.

Specified by:
setComplete in interface OMNodeEx
Parameters:
state -

detach

public OMNode detach()
              throws OMException
Removes this information item and its children, from the model completely.

Specified by:
detach in interface OMNode
Throws:
OMException

insertSiblingAfter

public void insertSiblingAfter(OMNode sibling)
                        throws OMException
Inserts a sibling just after the current information item.

Specified by:
insertSiblingAfter in interface OMNode
Parameters:
sibling -
Throws:
OMException

insertSiblingBefore

public void insertSiblingBefore(OMNode sibling)
                         throws OMException
Inserts a sibling just before the current information item.

Specified by:
insertSiblingBefore in interface OMNode
Parameters:
sibling -
Throws:
OMException

getType

public int getType()
Gets the type of node, as this is the super class of all the nodes.

Specified by:
getType in interface OMNode
Returns:
Returns the type of node as indicated by setType(int)
See Also:
setType(int)

setType

public void setType(int nodeType)
             throws OMException
Method setType.

Specified by:
setType in interface OMNodeEx
Parameters:
nodeType -
Throws:
OMException

getPreviousOMSibling

public OMNode getPreviousOMSibling()
Gets the previous sibling.

Specified by:
getPreviousOMSibling in interface OMNode
Returns:
boolean

setPreviousOMSibling

public void setPreviousOMSibling(OMNode previousSibling)
Method setPreviousOMSibling.

Specified by:
setPreviousOMSibling in interface OMNodeEx
Parameters:
previousSibling -

build

public void build()
           throws OMException
Parses this node and builds the object structure in memory. However a node, created programmatically, will have done set to true by default and this will cause populateyourself not to work properly!

Specified by:
build in interface OMNode
Throws:
OMException

buildWithAttachments

public void buildWithAttachments()
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 OMNode

close

public void close(boolean build)
Description copied from interface: OMNode
If a builder and parser is associated with the node, it is closed.

Specified by:
close in interface OMNode
Parameters:
build - if true, the object is built first before closing the builder/parser

serialize

public void serialize(javax.xml.stream.XMLStreamWriter xmlWriter)
               throws javax.xml.stream.XMLStreamException
Serializes the node with caching.

Specified by:
serialize in interface OMNode
Parameters:
xmlWriter -
Throws:
javax.xml.stream.XMLStreamException

serializeAndConsume

public void serializeAndConsume(javax.xml.stream.XMLStreamWriter xmlWriter)
                         throws javax.xml.stream.XMLStreamException
Serializes the node without caching.

Specified by:
serializeAndConsume in interface OMNode
Parameters:
xmlWriter -
Throws:
javax.xml.stream.XMLStreamException

internalSerialize

public void internalSerialize(javax.xml.stream.XMLStreamWriter writer)
                       throws javax.xml.stream.XMLStreamException
Serializes the node with caching.

Specified by:
internalSerialize in interface OMNodeEx
Parameters:
writer -
Throws:
javax.xml.stream.XMLStreamException

internalSerializeAndConsume

public void internalSerializeAndConsume(javax.xml.stream.XMLStreamWriter writer)
                                 throws javax.xml.stream.XMLStreamException
Serializes the node without caching.

Specified by:
internalSerializeAndConsume in interface OMNodeEx
Parameters:
writer -
Throws:
javax.xml.stream.XMLStreamException

serialize

public void serialize(OutputStream output)
               throws javax.xml.stream.XMLStreamException
Description copied from interface: OMNode
Serializes the node with caching.

Specified by:
serialize in interface OMNode
Throws:
javax.xml.stream.XMLStreamException

serialize

public void serialize(Writer writer)
               throws javax.xml.stream.XMLStreamException
Description copied from interface: OMNode
Serializes the node with caching.

Specified by:
serialize in interface OMNode
Throws:
javax.xml.stream.XMLStreamException

serializeAndConsume

public void serializeAndConsume(OutputStream output)
                         throws javax.xml.stream.XMLStreamException
Description copied from interface: OMNode
Serializes the node without caching.

Specified by:
serializeAndConsume in interface OMNode
Throws:
javax.xml.stream.XMLStreamException

serializeAndConsume

public void serializeAndConsume(Writer writer)
                         throws javax.xml.stream.XMLStreamException
Description copied from interface: OMNode
Serializes the node without caching.

Specified by:
serializeAndConsume in interface OMNode
Throws:
javax.xml.stream.XMLStreamException

serialize

public void serialize(OutputStream output,
                      OMOutputFormat format)
               throws javax.xml.stream.XMLStreamException
Description copied from interface: OMNode
Serializes the node with caching.

Specified by:
serialize in interface OMNode
Throws:
javax.xml.stream.XMLStreamException

serialize

public void serialize(Writer writer2,
                      OMOutputFormat format)
               throws javax.xml.stream.XMLStreamException
Description copied from interface: OMNode
Serializes the node with caching.

Specified by:
serialize in interface OMNode
Throws:
javax.xml.stream.XMLStreamException

serializeAndConsume

public void serializeAndConsume(OutputStream output,
                                OMOutputFormat format)
                         throws javax.xml.stream.XMLStreamException
Description copied from interface: OMNode
Serializes the node without caching.

Specified by:
serializeAndConsume in interface OMNode
Throws:
javax.xml.stream.XMLStreamException

serializeAndConsume

public void serializeAndConsume(Writer writer2,
                                OMOutputFormat format)
                         throws javax.xml.stream.XMLStreamException
Description copied from interface: OMNode
Serializes the node without caching.

Specified by:
serializeAndConsume in interface OMNode
Throws:
javax.xml.stream.XMLStreamException

getOMFactory

public OMFactory getOMFactory()
Description copied from interface: OMNode
Returns the OMFactory that created this object

Specified by:
getOMFactory in interface OMNode

importNode

protected OMNode importNode(OMNode child)
This method is intended only to be used by Axiom intenals when merging Objects from different Axiom implementations to the LLOM implementation.

Parameters:
child -


Copyright © 2004-2011 The Apache Software Foundation. All Rights Reserved.