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

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

public abstract class OMNodeImpl
extends java.lang.Object
implements org.apache.axiom.om.OMNode, org.apache.axiom.om.impl.OMNodeEx

Class OMNodeImpl


Field Summary
 org.apache.axiom.om.OMXMLParserWrapper builder
          Field builder
private static boolean DEBUG_ENABLED
           
protected  boolean done
          Field done
protected  org.apache.axiom.om.OMFactory factory
           
private static org.apache.commons.logging.Log log
           
protected  OMNodeImpl nextSibling
          Field nextSibling
protected  int nodeType
          Field nodeType
protected  org.apache.axiom.om.impl.OMContainerEx parent
          Field parent
protected  OMNodeImpl previousSibling
          Field previousSibling
 
Constructor Summary
OMNodeImpl(org.apache.axiom.om.OMContainer parent, org.apache.axiom.om.OMFactory factory, boolean done)
          For a node to exist there must be a parent.
OMNodeImpl(org.apache.axiom.om.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)
           
 org.apache.axiom.om.OMNode detach()
          Removes this information item and its children, from the model completely.
 org.apache.axiom.om.OMNode getNextOMSibling()
          Returns the next sibling.
 org.apache.axiom.om.OMFactory getOMFactory()
           
 org.apache.axiom.om.OMContainer getParent()
          Returns the immediate parent of the node.
 org.apache.axiom.om.OMNode getPreviousOMSibling()
          Gets the previous sibling.
 int getType()
          Gets the type of node, as this is the super class of all the nodes.
protected  org.apache.axiom.om.OMNode importNode(org.apache.axiom.om.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(org.apache.axiom.om.OMNode sibling)
          Inserts a sibling just after the current information item.
 void insertSiblingBefore(org.apache.axiom.om.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(java.io.OutputStream output)
           
 void serialize(java.io.OutputStream output, org.apache.axiom.om.OMOutputFormat format)
           
 void serialize(java.io.Writer writer)
           
 void serialize(java.io.Writer writer2, org.apache.axiom.om.OMOutputFormat format)
           
 void serialize(javax.xml.stream.XMLStreamWriter xmlWriter)
          Serializes the node with caching.
 void serializeAndConsume(java.io.OutputStream output)
           
 void serializeAndConsume(java.io.OutputStream output, org.apache.axiom.om.OMOutputFormat format)
           
 void serializeAndConsume(java.io.Writer writer)
           
 void serializeAndConsume(java.io.Writer writer2, org.apache.axiom.om.OMOutputFormat format)
           
 void serializeAndConsume(javax.xml.stream.XMLStreamWriter xmlWriter)
          Serializes the node without caching.
 void setComplete(boolean state)
          Method setComplete.
 void setNextOMSibling(org.apache.axiom.om.OMNode node)
          Method setNextOMSibling.
 void setParent(org.apache.axiom.om.OMContainer element)
          Method setParent.
 void setPreviousOMSibling(org.apache.axiom.om.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
 

Field Detail

log

private static final org.apache.commons.logging.Log log

DEBUG_ENABLED

private static boolean DEBUG_ENABLED

parent

protected org.apache.axiom.om.impl.OMContainerEx parent
Field parent


nextSibling

protected OMNodeImpl nextSibling
Field nextSibling


previousSibling

protected OMNodeImpl previousSibling
Field previousSibling


builder

public org.apache.axiom.om.OMXMLParserWrapper builder
Field builder


done

protected boolean done
Field done


nodeType

protected int nodeType
Field nodeType


factory

protected org.apache.axiom.om.OMFactory factory
Constructor Detail

OMNodeImpl

public OMNodeImpl(org.apache.axiom.om.OMFactory factory)
Constructor OMNodeImpl

Parameters:
factory - The OMFactory that created this

OMNodeImpl

public OMNodeImpl(org.apache.axiom.om.OMContainer parent,
                  org.apache.axiom.om.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 org.apache.axiom.om.OMContainer getParent()
Returns the immediate parent of the node. Parent is always an Element.

Specified by:
getParent in interface org.apache.axiom.om.OMNode
Returns:
Returns OMContainer.
Throws:
org.apache.axiom.om.OMException

setParent

public void setParent(org.apache.axiom.om.OMContainer element)
Method setParent.

Specified by:
setParent in interface org.apache.axiom.om.impl.OMNodeEx
Parameters:
element -

getNextOMSibling

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

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

setNextOMSibling

public void setNextOMSibling(org.apache.axiom.om.OMNode node)
Method setNextOMSibling.

Specified by:
setNextOMSibling in interface org.apache.axiom.om.impl.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 org.apache.axiom.om.OMNode
Returns:
Returns boolean.

setComplete

public void setComplete(boolean state)
Method setComplete.

Specified by:
setComplete in interface org.apache.axiom.om.impl.OMNodeEx
Parameters:
state -

detach

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

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

insertSiblingAfter

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

Specified by:
insertSiblingAfter in interface org.apache.axiom.om.OMNode
Parameters:
sibling -
Throws:
org.apache.axiom.om.OMException

insertSiblingBefore

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

Specified by:
insertSiblingBefore in interface org.apache.axiom.om.OMNode
Parameters:
sibling -
Throws:
org.apache.axiom.om.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 org.apache.axiom.om.OMNode
Returns:
Returns the type of node as indicated by setType(int)
See Also:
setType(int)

setType

public void setType(int nodeType)
             throws org.apache.axiom.om.OMException
Method setType.

Specified by:
setType in interface org.apache.axiom.om.impl.OMNodeEx
Parameters:
nodeType -
Throws:
org.apache.axiom.om.OMException

getPreviousOMSibling

public org.apache.axiom.om.OMNode getPreviousOMSibling()
Gets the previous sibling.

Specified by:
getPreviousOMSibling in interface org.apache.axiom.om.OMNode
Returns:
boolean

setPreviousOMSibling

public void setPreviousOMSibling(org.apache.axiom.om.OMNode previousSibling)
Method setPreviousOMSibling.

Specified by:
setPreviousOMSibling in interface org.apache.axiom.om.impl.OMNodeEx
Parameters:
previousSibling -

build

public void build()
           throws org.apache.axiom.om.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 org.apache.axiom.om.OMNode
Throws:
org.apache.axiom.om.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 org.apache.axiom.om.OMNode

close

public void close(boolean build)
Specified by:
close in interface org.apache.axiom.om.OMNode

serialize

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

Specified by:
serialize in interface org.apache.axiom.om.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 org.apache.axiom.om.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 org.apache.axiom.om.impl.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 org.apache.axiom.om.impl.OMNodeEx
Parameters:
writer -
Throws:
javax.xml.stream.XMLStreamException

serialize

public void serialize(java.io.OutputStream output)
               throws javax.xml.stream.XMLStreamException
Specified by:
serialize in interface org.apache.axiom.om.OMNode
Throws:
javax.xml.stream.XMLStreamException

serialize

public void serialize(java.io.Writer writer)
               throws javax.xml.stream.XMLStreamException
Specified by:
serialize in interface org.apache.axiom.om.OMNode
Throws:
javax.xml.stream.XMLStreamException

serializeAndConsume

public void serializeAndConsume(java.io.OutputStream output)
                         throws javax.xml.stream.XMLStreamException
Specified by:
serializeAndConsume in interface org.apache.axiom.om.OMNode
Throws:
javax.xml.stream.XMLStreamException

serializeAndConsume

public void serializeAndConsume(java.io.Writer writer)
                         throws javax.xml.stream.XMLStreamException
Specified by:
serializeAndConsume in interface org.apache.axiom.om.OMNode
Throws:
javax.xml.stream.XMLStreamException

serialize

public void serialize(java.io.OutputStream output,
                      org.apache.axiom.om.OMOutputFormat format)
               throws javax.xml.stream.XMLStreamException
Specified by:
serialize in interface org.apache.axiom.om.OMNode
Throws:
javax.xml.stream.XMLStreamException

serialize

public void serialize(java.io.Writer writer2,
                      org.apache.axiom.om.OMOutputFormat format)
               throws javax.xml.stream.XMLStreamException
Specified by:
serialize in interface org.apache.axiom.om.OMNode
Throws:
javax.xml.stream.XMLStreamException

serializeAndConsume

public void serializeAndConsume(java.io.OutputStream output,
                                org.apache.axiom.om.OMOutputFormat format)
                         throws javax.xml.stream.XMLStreamException
Specified by:
serializeAndConsume in interface org.apache.axiom.om.OMNode
Throws:
javax.xml.stream.XMLStreamException

serializeAndConsume

public void serializeAndConsume(java.io.Writer writer2,
                                org.apache.axiom.om.OMOutputFormat format)
                         throws javax.xml.stream.XMLStreamException
Specified by:
serializeAndConsume in interface org.apache.axiom.om.OMNode
Throws:
javax.xml.stream.XMLStreamException

getOMFactory

public org.apache.axiom.om.OMFactory getOMFactory()
Specified by:
getOMFactory in interface org.apache.axiom.om.OMNode

importNode

protected org.apache.axiom.om.OMNode importNode(org.apache.axiom.om.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 -