org.ozoneDB.xml.dom4j.o3impl
Class OzoneDocumentFactoryImpl

java.lang.Object
  extended byorg.ozoneDB.OzoneObject
      extended byorg.ozoneDB.xml.dom4j.o3impl.OzoneDocumentFactoryImpl
All Implemented Interfaces:
NodeFactory, org.ozoneDB.OzoneCompatible, org.ozoneDB.OzoneCompatibleOrProxy, OzoneDocumentFactory, org.ozoneDB.OzoneRemote, java.io.Serializable, XPathFactory

public class OzoneDocumentFactoryImpl
extends org.ozoneDB.OzoneObject
implements OzoneDocumentFactory

OzoneDocumentFactoryImpl is a collection of factory methods to allow easy custom building of DOM4J trees. The default tree that is built uses a doubly linked tree.

The tree built allows full XPath expressions from anywhere on the tree.

Version:
$Revision: 1.1 $
Author:
James Strachan, Per Nyfelt
See Also:
Serialized Form

Field Summary
protected  O3NamespaceCache namespaceCache
           
protected  O3QNameCache qnameCache
           
 
Fields inherited from interface org.ozoneDB.xml.dom4j.OzoneDocumentFactory
OBJECT_NAME
 
Constructor Summary
OzoneDocumentFactoryImpl()
           
 
Method Summary
static OzoneDocumentFactory create(org.ozoneDB.OzoneInterface db)
           
 Attribute createAttribute(Element owner, QName qname, java.lang.String value)
           
 Attribute createAttribute(Element owner, java.lang.String name, java.lang.String value)
           
 CDATA createCDATA(java.lang.String text)
           
 Comment createComment(java.lang.String text)
           
 DocumentType createDocType(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
           
 Document createDocument()
           
 Document createDocument(Element rootElement)
           
 Document createDocument(Element rootElement, java.lang.String name)
           
 Document createDocument(java.lang.String name)
           
 Element createElement(QName qname)
           
 Element createElement(java.lang.String name)
           
 Element createElement(java.lang.String qualifiedName, java.lang.String namespaceURI)
           
 Entity createEntity(java.lang.String name, java.lang.String text)
           
 Namespace createNamespace(java.lang.String prefix, java.lang.String uri)
           
 Pattern createPattern(java.lang.String xpathPattern)
          createPattern parses the given XPath expression to create an XSLT style Pattern instance which can then be used in an XSLT processing model.
 ProcessingInstruction createProcessingInstruction(java.lang.String target, java.util.Map data)
           
 ProcessingInstruction createProcessingInstruction(java.lang.String target, java.lang.String data)
           
 QName createQName(java.lang.String localName)
           
 QName createQName(java.lang.String localName, Namespace namespace)
           
 QName createQName(java.lang.String qualifiedName, java.lang.String uri)
           
 QName createQName(java.lang.String name, java.lang.String prefix, java.lang.String uri)
           
 Text createText(java.lang.String text)
           
 XPath createXPath(java.lang.String xpathExpression)
          createXPath parses an XPath expression and creates a new XPath XPath instance.
 XPath createXPath(java.lang.String xpathExpression, org.jaxen.VariableContext variableContext)
          createXPath parses an XPath expression and creates a new XPath XPath instance.
 NodeFilter createXPathFilter(java.lang.String xpathFilterExpression)
          createXPathFilter parses a NodeFilter from the given XPath filter expression.
 NodeFilter createXPathFilter(java.lang.String xpathFilterExpression, org.jaxen.VariableContext variableContext)
          createXPathFilter parses a NodeFilter from the given XPath filter expression.
static OzoneDocumentFactory getInstance(org.ozoneDB.OzoneInterface db)
           
 Namespace getNamespace(java.lang.String uri)
           
 O3NamespaceCache getNamespaceCache()
           
 Namespace getNoNamespace()
           
 java.util.List getQNames()
          Deprecated. or was it just forgotten when the interfaces war created?
 Namespace getXmlNameSpace()
           
 java.util.Map getXPathNamespaceURIs()
           
protected  QName intern(QName qname)
           
 void onActivate()
           
 void onCreate()
           
 void onPassivate()
           
 void setNamespaceCache(O3NamespaceCache namespaceCache)
           
 void setXPathNamespaceURIs(java.util.Map xpathNamespaceURIs)
          Deprecated. or was it just forgotten and should be in XPathFactory
 
Methods inherited from class org.ozoneDB.OzoneObject
container, database, deleteRecursive, equals, getHandle, getObjectID, handle, hashCode, onDelete, requireWriteLocking, self, setContainer, toString, toXML
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.ozoneDB.OzoneCompatibleOrProxy
getObjectID
 

Field Detail

qnameCache

protected transient O3QNameCache qnameCache

namespaceCache

protected transient O3NamespaceCache namespaceCache
Constructor Detail

OzoneDocumentFactoryImpl

public OzoneDocumentFactoryImpl()
Method Detail

getInstance

public static OzoneDocumentFactory getInstance(org.ozoneDB.OzoneInterface db)

create

public static OzoneDocumentFactory create(org.ozoneDB.OzoneInterface db)

onCreate

public void onCreate()
Specified by:
onCreate in interface org.ozoneDB.OzoneCompatible

onActivate

public void onActivate()
Specified by:
onActivate in interface org.ozoneDB.OzoneCompatible

onPassivate

public void onPassivate()
Specified by:
onPassivate in interface org.ozoneDB.OzoneCompatible

createDocument

public Document createDocument()
Specified by:
createDocument in interface NodeFactory

createDocument

public Document createDocument(Element rootElement)
Specified by:
createDocument in interface NodeFactory

createDocument

public Document createDocument(java.lang.String name)
Specified by:
createDocument in interface OzoneDocumentFactory
Parameters:
name - is the name for the document which is used to retrieve the document at a later time.
Returns:

createDocument

public Document createDocument(Element rootElement,
                               java.lang.String name)
Specified by:
createDocument in interface OzoneDocumentFactory
Parameters:
rootElement -
name - is the name for the document which is used to retrieve the document at a later time.
Returns:

createDocType

public DocumentType createDocType(java.lang.String name,
                                  java.lang.String publicId,
                                  java.lang.String systemId)
Specified by:
createDocType in interface NodeFactory

createElement

public Element createElement(QName qname)
Specified by:
createElement in interface NodeFactory

createElement

public Element createElement(java.lang.String name)
Specified by:
createElement in interface NodeFactory

createElement

public Element createElement(java.lang.String qualifiedName,
                             java.lang.String namespaceURI)
Specified by:
createElement in interface NodeFactory

createAttribute

public Attribute createAttribute(Element owner,
                                 QName qname,
                                 java.lang.String value)
Specified by:
createAttribute in interface NodeFactory

createAttribute

public Attribute createAttribute(Element owner,
                                 java.lang.String name,
                                 java.lang.String value)
Specified by:
createAttribute in interface NodeFactory

createCDATA

public CDATA createCDATA(java.lang.String text)
Specified by:
createCDATA in interface NodeFactory

createComment

public Comment createComment(java.lang.String text)
Specified by:
createComment in interface NodeFactory

createText

public Text createText(java.lang.String text)
Specified by:
createText in interface NodeFactory

createEntity

public Entity createEntity(java.lang.String name,
                           java.lang.String text)
Specified by:
createEntity in interface NodeFactory

createNamespace

public Namespace createNamespace(java.lang.String prefix,
                                 java.lang.String uri)
Specified by:
createNamespace in interface NodeFactory

getNamespace

public Namespace getNamespace(java.lang.String uri)
Specified by:
getNamespace in interface NodeFactory

getXmlNameSpace

public Namespace getXmlNameSpace()
Specified by:
getXmlNameSpace in interface NodeFactory

getNoNamespace

public Namespace getNoNamespace()
Specified by:
getNoNamespace in interface NodeFactory

createProcessingInstruction

public ProcessingInstruction createProcessingInstruction(java.lang.String target,
                                                         java.lang.String data)
Specified by:
createProcessingInstruction in interface NodeFactory

createProcessingInstruction

public ProcessingInstruction createProcessingInstruction(java.lang.String target,
                                                         java.util.Map data)
Specified by:
createProcessingInstruction in interface NodeFactory

createQName

public QName createQName(java.lang.String localName,
                         Namespace namespace)
Specified by:
createQName in interface NodeFactory

createQName

public QName createQName(java.lang.String localName)
Specified by:
createQName in interface NodeFactory

createQName

public QName createQName(java.lang.String name,
                         java.lang.String prefix,
                         java.lang.String uri)
Specified by:
createQName in interface NodeFactory

createQName

public QName createQName(java.lang.String qualifiedName,
                         java.lang.String uri)
Specified by:
createQName in interface NodeFactory

createXPath

public XPath createXPath(java.lang.String xpathExpression)
                  throws InvalidXPathException

createXPath parses an XPath expression and creates a new XPath XPath instance.

Specified by:
createXPath in interface XPathFactory
Parameters:
xpathExpression - is the XPath expression to create
Returns:
a new XPath instance
Throws:
InvalidXPathException - if the XPath expression is invalid

createXPath

public XPath createXPath(java.lang.String xpathExpression,
                         org.jaxen.VariableContext variableContext)

createXPath parses an XPath expression and creates a new XPath XPath instance.

Specified by:
createXPath in interface XPathFactory
Parameters:
xpathExpression - is the XPath expression to create
variableContext - is the variable context to use when evaluating the XPath
Returns:
a new XPath instance
Throws:
InvalidXPathException - if the XPath expression is invalid

createXPathFilter

public NodeFilter createXPathFilter(java.lang.String xpathFilterExpression,
                                    org.jaxen.VariableContext variableContext)

createXPathFilter parses a NodeFilter from the given XPath filter expression. XPath filter expressions occur within XPath expressions such as self::node()[ filterExpression ]

Specified by:
createXPathFilter in interface XPathFactory
Parameters:
xpathFilterExpression - is the XPath filter expression to create
variableContext - is the variable context to use when evaluating the XPath
Returns:
a new NodeFilter instance

createXPathFilter

public NodeFilter createXPathFilter(java.lang.String xpathFilterExpression)

createXPathFilter parses a NodeFilter from the given XPath filter expression. XPath filter expressions occur within XPath expressions such as self::node()[ filterExpression ]

Specified by:
createXPathFilter in interface XPathFactory
Parameters:
xpathFilterExpression - is the XPath filter expression to create
Returns:
a new NodeFilter instance

createPattern

public Pattern createPattern(java.lang.String xpathPattern)

createPattern parses the given XPath expression to create an XSLT style Pattern instance which can then be used in an XSLT processing model.

Specified by:
createPattern in interface XPathFactory
Parameters:
xpathPattern - is the XPath pattern expression to create
Returns:
a new Pattern instance

getQNames

public java.util.List getQNames()
Deprecated. or was it just forgotten when the interfaces war created?

Returns a list of all the QNameImpl instances currently used by this document factory

Specified by:
getQNames in interface OzoneDocumentFactory

getXPathNamespaceURIs

public java.util.Map getXPathNamespaceURIs()
Specified by:
getXPathNamespaceURIs in interface OzoneDocumentFactory
Returns:
the Map of namespace URIs that will be used by by XPath expressions to resolve namespace prefixes into namespace URIs. The map is keyed by namespace prefix and the value is the namespace URI. This value could well be null to indicate no namespace URIs are being mapped.

setXPathNamespaceURIs

public void setXPathNamespaceURIs(java.util.Map xpathNamespaceURIs)
Deprecated. or was it just forgotten and should be in XPathFactory

Sets the namespace URIs to be used by XPath expressions created by this factory or by nodes associated with this factory. The keys are namespace prefixes and the values are namespace URIs.

Specified by:
setXPathNamespaceURIs in interface XPathFactory

getNamespaceCache

public O3NamespaceCache getNamespaceCache()

setNamespaceCache

public void setNamespaceCache(O3NamespaceCache namespaceCache)

intern

protected QName intern(QName qname)
Returns:
the cached QNameImpl instance if there is one or adds the given qname to the qnameCache if not


Copyright © 2004 The Ozone Database Project - www.ozone-db.org. All Rights Reserved.