org.exist.dom
Class DocumentImpl

java.lang.Object
  extended byorg.exist.dom.NodeImpl
      extended byorg.exist.dom.DocumentImpl
All Implemented Interfaces:
java.lang.Comparable, org.w3c.dom.Document, org.w3c.dom.Node

public class DocumentImpl
extends NodeImpl
implements org.w3c.dom.Document, java.lang.Comparable

Description of the Class

Author:
Wolfgang Meier

Field Summary
protected  long address
           
protected  DBBroker broker
           
protected  java.util.LinkedList childList
           
protected  int children
           
protected  int docId
           
protected  org.w3c.dom.DocumentType docType
           
protected  int maxDepth
           
protected  Permission permissions
           
protected  int reindex
           
protected  int[] treeLevelOrder
           
protected  long[] treeLevelStartPoints
           
 
Fields inherited from class org.exist.dom.NodeImpl
attributes, gid, internalAddress, nodeName, nodeNameRef, nodeType, ownerDocument
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
DocumentImpl(DBBroker broker)
          Constructor for the DocumentImpl object
DocumentImpl(DBBroker broker, Collection collection)
          Constructor for the DocumentImpl object
DocumentImpl(DBBroker broker, java.lang.String fileName)
          Constructor for the DocumentImpl object
DocumentImpl(DBBroker broker, java.lang.String fileName, Collection collection)
          Constructor for the DocumentImpl object
DocumentImpl(DocumentImpl old)
           
 
Method Summary
 org.w3c.dom.Node adoptNode(org.w3c.dom.Node node)
           
 void appendChild(NodeImpl child)
           
 void calculateTreeLevelStartPoints()
           
 void clearIndexListener()
           
 int compareTo(java.lang.Object other)
           
 org.w3c.dom.Attr createAttribute(java.lang.String name)
           
 org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName)
           
 org.w3c.dom.CDATASection createCDATASection(java.lang.String data)
           
 org.w3c.dom.Comment createComment(java.lang.String data)
           
 org.w3c.dom.DocumentFragment createDocumentFragment()
           
 org.w3c.dom.Element createElement(java.lang.String tagName)
           
 org.w3c.dom.Element createElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName)
           
 org.w3c.dom.EntityReference createEntityReference(java.lang.String name)
           
protected static NodeImpl createNode(long gid, short type)
          Description of the Method
protected static NodeImpl createNode(long gid, short type, java.lang.String name, java.lang.String data, int children)
           
 org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String target, java.lang.String data)
           
 org.w3c.dom.Text createTextNode(java.lang.String data)
           
 void deserialize(byte[] data)
           
protected  org.w3c.dom.NodeList findElementsByTagName(NodeImpl root, java.lang.String tagName)
           
 long getAddress()
           
 int getChildCount()
          Method getChildCount.
 org.w3c.dom.NodeList getChildNodes()
          Gets the childNodes attribute of the NodeImpl object
 Collection getCollection()
           
 long getCreated()
           
 int getDocId()
           
 org.w3c.dom.DocumentType getDoctype()
           
 org.w3c.dom.Element getDocumentElement()
           
 org.w3c.dom.Element getElementById(java.lang.String elementId)
           
 org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagname)
           
 org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)
           
 java.lang.String getEncoding()
           
 java.lang.String getFileName()
           
protected  org.w3c.dom.Node getFollowingSibling(NodeImpl node)
           
 org.w3c.dom.DOMImplementation getImplementation()
           
 NodeIndexListener getIndexListener()
           
 long getInternalAddress()
          Get the internal storage address of this node
 long getLastModified()
           
 long getLevelStartPoint(int level)
           
 int getMaxDepth()
           
 org.w3c.dom.Node getNode(long gid)
           
 org.w3c.dom.Node getNode(NodeProxy p)
           
 Permission getPermissions()
           
protected  org.w3c.dom.Node getPreviousSibling(NodeImpl node)
           
 org.w3c.dom.NodeList getRange(long first, long last)
           
 boolean getStandalone()
           
 boolean getStrictErrorChecking()
           
 SymbolTable getSymbols()
           
 int getTreeLevel(long gid)
           
 int getTreeLevelOrder(int level)
           
 int getTreeLevelOrder(long gid)
           
 java.lang.String getVersion()
           
 org.w3c.dom.Node importNode(org.w3c.dom.Node importedNode, boolean deep)
           
 void incMaxDepth()
           
 org.w3c.dom.Node insertAfter(org.w3c.dom.NodeList nodes, org.w3c.dom.Node refChild)
           
 org.w3c.dom.Node insertBefore(org.w3c.dom.NodeList nodes, org.w3c.dom.Node refChild)
           
 boolean isSupported(java.lang.String type, java.lang.String value)
           
 void read(java.io.DataInput istream)
           
 void read(VariableByteInputStream istream)
           
 int reindexRequired()
           
 byte[] serialize()
           
 void setAddress(long address)
           
 void setBroker(DBBroker broker)
           
 void setChildCount(int count)
          Set the number of children.
 void setCreated(long l)
           
 void setDocId(int docId)
           
 void setDocumentType(org.w3c.dom.DocumentType docType)
           
 void setEncoding(java.lang.String enc)
           
 void setFileName(java.lang.String fileName)
           
 void setIndexListener(NodeIndexListener listener)
           
 void setLastModified(long l)
           
 void setMaxDepth(int depth)
           
 void setPermissions(int mode)
           
 void setPermissions(Permission perm)
           
 void setPermissions(java.lang.String mode)
           
 void setReindexRequired(int level)
           
 void setStandalone(boolean alone)
           
 void setStrictErrorChecking(boolean strict)
           
 void setTreeLevelOrder(int level, int order)
           
 void setVersion(java.lang.String version)
           
 void updateChild(org.w3c.dom.Node oldChild, org.w3c.dom.Node newChild)
          Update a child node.
 void write(java.io.DataOutput ostream)
           
 void write(VariableByteOutputStream ostream)
           
 
Methods inherited from class org.exist.dom.NodeImpl
appendChild, appendChildren, clear, cloneNode, deserialize, equals, firstChildID, getAttributes, getAttributesCount, getBroker, getFirstChild, getGID, getLastChild, getLastNode, getLastNode, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeNameRef, getNodeType, getNodeValue, getOwnerDocument, getParentGID, getParentNode, getPath, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertAfter, insertBefore, lastChildID, normalize, removeChild, replaceChild, setAttributes, setGID, setInternalAddress, setNodeName, setNodeNameRef, setNodeValue, setOwnerDocument, setPrefix, supports, toSAX, toSAX, toString, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, getAttributes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, normalize, removeChild, replaceChild, setNodeValue, setPrefix
 

Field Detail

broker

protected DBBroker broker

children

protected int children

childList

protected java.util.LinkedList childList

docId

protected int docId

docType

protected org.w3c.dom.DocumentType docType

maxDepth

protected int maxDepth

reindex

protected int reindex

permissions

protected Permission permissions

address

protected long address

treeLevelOrder

protected int[] treeLevelOrder

treeLevelStartPoints

protected long[] treeLevelStartPoints
Constructor Detail

DocumentImpl

public DocumentImpl(DBBroker broker,
                    Collection collection)
Constructor for the DocumentImpl object

Parameters:
broker - Description of the Parameter
collection - Description of the Parameter

DocumentImpl

public DocumentImpl(DBBroker broker)
Constructor for the DocumentImpl object

Parameters:
broker - Description of the Parameter

DocumentImpl

public DocumentImpl(DBBroker broker,
                    java.lang.String fileName)
Constructor for the DocumentImpl object

Parameters:
broker - Description of the Parameter
fileName - Description of the Parameter

DocumentImpl

public DocumentImpl(DBBroker broker,
                    java.lang.String fileName,
                    Collection collection)
Constructor for the DocumentImpl object

Parameters:
broker - Description of the Parameter
fileName - Description of the Parameter
collection - Description of the Parameter

DocumentImpl

public DocumentImpl(DocumentImpl old)
Method Detail

createNode

protected static NodeImpl createNode(long gid,
                                     short type)
Description of the Method

Parameters:
gid - Description of the Parameter
type - Description of the Parameter
Returns:
Description of the Return Value

createNode

protected static NodeImpl createNode(long gid,
                                     short type,
                                     java.lang.String name,
                                     java.lang.String data,
                                     int children)

adoptNode

public org.w3c.dom.Node adoptNode(org.w3c.dom.Node node)
                           throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

appendChild

public void appendChild(NodeImpl child)
                 throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

calculateTreeLevelStartPoints

public void calculateTreeLevelStartPoints()
                                   throws EXistException
Throws:
EXistException

compareTo

public int compareTo(java.lang.Object other)
Specified by:
compareTo in interface java.lang.Comparable

createAttribute

public org.w3c.dom.Attr createAttribute(java.lang.String name)
                                 throws org.w3c.dom.DOMException
Specified by:
createAttribute in interface org.w3c.dom.Document
Throws:
org.w3c.dom.DOMException

createAttributeNS

public org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI,
                                          java.lang.String qualifiedName)
                                   throws org.w3c.dom.DOMException
Specified by:
createAttributeNS in interface org.w3c.dom.Document
Throws:
org.w3c.dom.DOMException

createCDATASection

public org.w3c.dom.CDATASection createCDATASection(java.lang.String data)
                                            throws org.w3c.dom.DOMException
Specified by:
createCDATASection in interface org.w3c.dom.Document
Throws:
org.w3c.dom.DOMException

createComment

public org.w3c.dom.Comment createComment(java.lang.String data)
Specified by:
createComment in interface org.w3c.dom.Document

createDocumentFragment

public org.w3c.dom.DocumentFragment createDocumentFragment()
                                                    throws org.w3c.dom.DOMException
Specified by:
createDocumentFragment in interface org.w3c.dom.Document
Throws:
org.w3c.dom.DOMException

createElement

public org.w3c.dom.Element createElement(java.lang.String tagName)
                                  throws org.w3c.dom.DOMException
Specified by:
createElement in interface org.w3c.dom.Document
Throws:
org.w3c.dom.DOMException

createElementNS

public org.w3c.dom.Element createElementNS(java.lang.String namespaceURI,
                                           java.lang.String qualifiedName)
                                    throws org.w3c.dom.DOMException
Specified by:
createElementNS in interface org.w3c.dom.Document
Throws:
org.w3c.dom.DOMException

createEntityReference

public org.w3c.dom.EntityReference createEntityReference(java.lang.String name)
                                                  throws org.w3c.dom.DOMException
Specified by:
createEntityReference in interface org.w3c.dom.Document
Throws:
org.w3c.dom.DOMException

createProcessingInstruction

public org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String target,
                                                                     java.lang.String data)
                                                              throws org.w3c.dom.DOMException
Specified by:
createProcessingInstruction in interface org.w3c.dom.Document
Throws:
org.w3c.dom.DOMException

createTextNode

public org.w3c.dom.Text createTextNode(java.lang.String data)
Specified by:
createTextNode in interface org.w3c.dom.Document

findElementsByTagName

protected org.w3c.dom.NodeList findElementsByTagName(NodeImpl root,
                                                     java.lang.String tagName)

getChildCount

public int getChildCount()
Description copied from class: NodeImpl
Method getChildCount.

Overrides:
getChildCount in class NodeImpl
Returns:
int

getChildNodes

public org.w3c.dom.NodeList getChildNodes()
Description copied from class: NodeImpl
Gets the childNodes attribute of the NodeImpl object

Specified by:
getChildNodes in interface org.w3c.dom.Node
Overrides:
getChildNodes in class NodeImpl
Returns:
The childNodes value

getPreviousSibling

protected org.w3c.dom.Node getPreviousSibling(NodeImpl node)

getFollowingSibling

protected org.w3c.dom.Node getFollowingSibling(NodeImpl node)

getCollection

public Collection getCollection()

getDocId

public int getDocId()

getDoctype

public org.w3c.dom.DocumentType getDoctype()
Specified by:
getDoctype in interface org.w3c.dom.Document

getDocumentElement

public org.w3c.dom.Element getDocumentElement()
Specified by:
getDocumentElement in interface org.w3c.dom.Document

getElementById

public org.w3c.dom.Element getElementById(java.lang.String elementId)
Specified by:
getElementById in interface org.w3c.dom.Document

getElementsByTagName

public org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagname)
Specified by:
getElementsByTagName in interface org.w3c.dom.Document

getElementsByTagNameNS

public org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI,
                                                   java.lang.String localName)
Specified by:
getElementsByTagNameNS in interface org.w3c.dom.Document

getEncoding

public java.lang.String getEncoding()

getFileName

public java.lang.String getFileName()

getImplementation

public org.w3c.dom.DOMImplementation getImplementation()
Specified by:
getImplementation in interface org.w3c.dom.Document

getLevelStartPoint

public long getLevelStartPoint(int level)

getMaxDepth

public int getMaxDepth()

getNode

public org.w3c.dom.Node getNode(long gid)

getNode

public org.w3c.dom.Node getNode(NodeProxy p)

getPermissions

public Permission getPermissions()

getRange

public org.w3c.dom.NodeList getRange(long first,
                                     long last)

getStandalone

public boolean getStandalone()

getStrictErrorChecking

public boolean getStrictErrorChecking()

getSymbols

public SymbolTable getSymbols()

getTreeLevel

public int getTreeLevel(long gid)

getTreeLevelOrder

public int getTreeLevelOrder(int level)

getTreeLevelOrder

public int getTreeLevelOrder(long gid)

getVersion

public java.lang.String getVersion()

importNode

public org.w3c.dom.Node importNode(org.w3c.dom.Node importedNode,
                                   boolean deep)
                            throws org.w3c.dom.DOMException
Specified by:
importNode in interface org.w3c.dom.Document
Throws:
org.w3c.dom.DOMException

isSupported

public boolean isSupported(java.lang.String type,
                           java.lang.String value)
Specified by:
isSupported in interface org.w3c.dom.Node
Overrides:
isSupported in class NodeImpl
See Also:
Node.isSupported(java.lang.String, java.lang.String)

read

public void read(java.io.DataInput istream)
          throws java.io.IOException,
                 java.io.EOFException
Throws:
java.io.IOException
java.io.EOFException

read

public void read(VariableByteInputStream istream)
          throws java.io.IOException,
                 java.io.EOFException
Throws:
java.io.IOException
java.io.EOFException

setBroker

public void setBroker(DBBroker broker)

setChildCount

public void setChildCount(int count)
Description copied from class: NodeImpl
Set the number of children.

Overrides:
setChildCount in class NodeImpl
Parameters:
count - The new childCount value

setDocId

public void setDocId(int docId)

setDocumentType

public void setDocumentType(org.w3c.dom.DocumentType docType)

setEncoding

public void setEncoding(java.lang.String enc)

setFileName

public void setFileName(java.lang.String fileName)

setMaxDepth

public void setMaxDepth(int depth)

incMaxDepth

public void incMaxDepth()

setPermissions

public void setPermissions(int mode)

setPermissions

public void setPermissions(java.lang.String mode)
                    throws SyntaxException
Throws:
SyntaxException

setPermissions

public void setPermissions(Permission perm)

setStandalone

public void setStandalone(boolean alone)

setStrictErrorChecking

public void setStrictErrorChecking(boolean strict)

setTreeLevelOrder

public void setTreeLevelOrder(int level,
                              int order)

setVersion

public void setVersion(java.lang.String version)

write

public void write(java.io.DataOutput ostream)
           throws java.io.IOException
Throws:
java.io.IOException

write

public void write(VariableByteOutputStream ostream)
           throws java.io.IOException
Throws:
java.io.IOException

reindexRequired

public int reindexRequired()

serialize

public byte[] serialize()
Overrides:
serialize in class NodeImpl

deserialize

public void deserialize(byte[] data)

setReindexRequired

public void setReindexRequired(int level)

setIndexListener

public void setIndexListener(NodeIndexListener listener)

getIndexListener

public NodeIndexListener getIndexListener()

clearIndexListener

public void clearIndexListener()

setAddress

public void setAddress(long address)

getAddress

public long getAddress()

getInternalAddress

public long getInternalAddress()
Description copied from class: NodeImpl
Get the internal storage address of this node

Overrides:
getInternalAddress in class NodeImpl
Returns:
The internalAddress value

updateChild

public void updateChild(org.w3c.dom.Node oldChild,
                        org.w3c.dom.Node newChild)
                 throws org.w3c.dom.DOMException
Description copied from class: NodeImpl
Update a child node. This method will only update the child node but not its potential descendant nodes.

Overrides:
updateChild in class NodeImpl
Parameters:
oldChild -
newChild -
Throws:
org.w3c.dom.DOMException

insertBefore

public org.w3c.dom.Node insertBefore(org.w3c.dom.NodeList nodes,
                                     org.w3c.dom.Node refChild)
                              throws org.w3c.dom.DOMException
Overrides:
insertBefore in class NodeImpl
Throws:
org.w3c.dom.DOMException

insertAfter

public org.w3c.dom.Node insertAfter(org.w3c.dom.NodeList nodes,
                                    org.w3c.dom.Node refChild)
                             throws org.w3c.dom.DOMException
Overrides:
insertAfter in class NodeImpl
Throws:
org.w3c.dom.DOMException

getCreated

public long getCreated()
Returns:

getLastModified

public long getLastModified()
Returns:

setCreated

public void setCreated(long l)
Parameters:
l -

setLastModified

public void setLastModified(long l)
Parameters:
l -


Copyright (C) Wolfgang Meier. All rights reserved.