org.ozoneDB.xml.dom4j.xpath
Class XPathPatternImpl

java.lang.Object
  extended byorg.ozoneDB.OzoneObject
      extended byorg.ozoneDB.xml.dom4j.xpath.XPathPatternImpl
All Implemented Interfaces:
NodeFilter, org.ozoneDB.OzoneCompatible, org.ozoneDB.OzoneCompatibleOrProxy, org.ozoneDB.OzoneRemote, Pattern, java.io.Serializable, XPathPattern

public class XPathPatternImpl
extends org.ozoneDB.OzoneObject
implements XPathPattern

XPathPatternImpl is an implementation of Pattern which uses an XPath xpath.

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

Field Summary
 
Fields inherited from interface org.dom4j.rule.Pattern
ANY_NODE, DEFAULT_PRIORITY, NONE, NUMBER_OF_TYPES
 
Constructor Summary
XPathPatternImpl(org.jaxen.pattern.Pattern pattern)
           
XPathPatternImpl(java.lang.String text)
           
 
Method Summary
static XPathPattern create(org.ozoneDB.OzoneInterface db, org.jaxen.pattern.Pattern pattern)
           
static XPathPattern create(org.ozoneDB.OzoneInterface db, java.lang.String text)
           
protected  org.jaxen.ContextSupport getContextSupport()
           
 java.lang.String getMatchesNodeName()
          For patterns which only match an ATTRIBUTE_NODE or an ELEMENT_NODE then this pattern may return the name of the element or attribute it matches.
 short getMatchType()
           
 double getPriority()
          Returns the default resolution policy of the pattern according to the XSLT conflict resolution spec.
 java.lang.String getText()
           
 Pattern[] getUnionPatterns()
          If this pattern is a union pattern then this method should return an array of patterns which describe the union pattern, which should contain more than one pattern.
protected  void handleJaxenException(org.jaxen.JaxenException e)
           
 boolean matches(Node node)
          matches returns true if the given node matches the filter condition.
 void setVariableContext(org.jaxen.VariableContext variableContext)
           
 java.lang.String toString()
           
 
Methods inherited from class org.ozoneDB.OzoneObject
container, database, deleteRecursive, equals, getHandle, getObjectID, handle, hashCode, onActivate, onCreate, onDelete, onPassivate, requireWriteLocking, self, setContainer, toXML
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.ozoneDB.OzoneCompatibleOrProxy
getObjectID
 

Constructor Detail

XPathPatternImpl

public XPathPatternImpl(org.jaxen.pattern.Pattern pattern)

XPathPatternImpl

public XPathPatternImpl(java.lang.String text)
Method Detail

create

public static XPathPattern create(org.ozoneDB.OzoneInterface db,
                                  org.jaxen.pattern.Pattern pattern)

create

public static XPathPattern create(org.ozoneDB.OzoneInterface db,
                                  java.lang.String text)

matches

public boolean matches(Node node)
Description copied from interface: NodeFilter

matches returns true if the given node matches the filter condition.

Specified by:
matches in interface Pattern
Returns:
true if the pattern matches the given DOM4J node.

getText

public java.lang.String getText()

getPriority

public double getPriority()
Description copied from interface: Pattern
Returns the default resolution policy of the pattern according to the XSLT conflict resolution spec.

Specified by:
getPriority in interface Pattern

getUnionPatterns

public Pattern[] getUnionPatterns()
Description copied from interface: Pattern
If this pattern is a union pattern then this method should return an array of patterns which describe the union pattern, which should contain more than one pattern. Otherwise this method should return null.

Specified by:
getUnionPatterns in interface Pattern
Returns:
an array of the patterns which make up this union pattern or null if this pattern is not a union pattern

getMatchType

public short getMatchType()
Specified by:
getMatchType in interface Pattern
Returns:
the type of node the pattern matches which by default should return ANY_NODE if it can match any kind of node.

getMatchesNodeName

public java.lang.String getMatchesNodeName()
Description copied from interface: Pattern
For patterns which only match an ATTRIBUTE_NODE or an ELEMENT_NODE then this pattern may return the name of the element or attribute it matches. This allows a more efficient rule matching algorithm to be performed, rather than a brute force approach of evaluating every pattern for a given Node.

Specified by:
getMatchesNodeName in interface Pattern
Returns:
the name of the element or attribute this pattern matches or null if this pattern matches any or more than one name.

setVariableContext

public void setVariableContext(org.jaxen.VariableContext variableContext)

toString

public java.lang.String toString()

getContextSupport

protected org.jaxen.ContextSupport getContextSupport()

handleJaxenException

protected void handleJaxenException(org.jaxen.JaxenException e)
                             throws XPathException
Throws:
XPathException


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