com.saxonica.validate
Class AbstractWatch

java.lang.Object
  extended by com.saxonica.validate.AbstractWatch
All Implemented Interfaces:
Watch
Direct Known Subclasses:
ComposingWatch, EventPushingWatch, FieldWatch, SelectorWatch

public abstract class AbstractWatch
extends Object
implements Watch

A Watch represents a class that is interested in looking at nodes for the purpose of evaluating uniqueness and key constraints. A SelectorWatch looks for the nodes that match the selector in a unique, key, or keyref constraint. There are two concrete subclasses: one for key/unique, the other for keyref


Constructor Summary
AbstractWatch()
           
 
Method Summary
 void close()
          The close() method is called immediately before the Watch is destroyed, that is, when the element whose declaration scopes the constraint implemented by this Watch goes out of scope.
 FleetingNode getAnchorNode()
          Get the anchor node for the watch.
 NamespaceResolver getNamespaceResolver()
          Get the namespace resolver in use by the Watch
 PipelineConfiguration getPipelineConfiguration()
          Get the pipeline configuration in use
 Pattern getSelection()
          Get the selection (that is, the restricted XPath expression) that defines the nodes that this Watch is looking for
 void notifySelectedLeafNode(FleetingNode node, int locationId)
          Signal that a node (other than an element) that matches the selection has been found.
 void open()
          Open the watch.
 void setAnchorNode(FleetingNode anchor)
          Set the anchor node for the watch.
 void setNamespaceResolver(NamespaceResolver resolver)
          Set a NamespaceResolver for use by the Watch
 void setPipelineConfiguration(PipelineConfiguration pipe)
          Set the PipelineConfiguration in use
 void setSelection(Pattern selection)
          Set the selection (that is, the streamable XPath expression) that defines the nodes that this Watch is looking for
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.saxonica.stream.watch.Watch
endSelectedParentNode, startSelectedParentNode
 

Constructor Detail

AbstractWatch

public AbstractWatch()
Method Detail

setSelection

public final void setSelection(Pattern selection)
Set the selection (that is, the streamable XPath expression) that defines the nodes that this Watch is looking for

Specified by:
setSelection in interface Watch
Parameters:
selection - the streamable XPath expression

getSelection

public final Pattern getSelection()
Get the selection (that is, the restricted XPath expression) that defines the nodes that this Watch is looking for

Specified by:
getSelection in interface Watch
Returns:
the selection

setPipelineConfiguration

public final void setPipelineConfiguration(PipelineConfiguration pipe)
Set the PipelineConfiguration in use

Specified by:
setPipelineConfiguration in interface Watch
Parameters:
pipe - the PipelineConfiguration in use

getPipelineConfiguration

public PipelineConfiguration getPipelineConfiguration()
Get the pipeline configuration in use

Specified by:
getPipelineConfiguration in interface Watch
Returns:
the pipeline configuration

setNamespaceResolver

public final void setNamespaceResolver(NamespaceResolver resolver)
Set a NamespaceResolver for use by the Watch

Specified by:
setNamespaceResolver in interface Watch
Parameters:
resolver - the namespace resolver to be used

getNamespaceResolver

public NamespaceResolver getNamespaceResolver()
Get the namespace resolver in use by the Watch

Specified by:
getNamespaceResolver in interface Watch
Returns:
the namespace resolver

setAnchorNode

public void setAnchorNode(FleetingNode anchor)
Set the anchor node for the watch. This is the node to which the watch is scoped, typically the context node for the streamable path expression that defines the root of the subtree within which nodes are being sought.

Specified by:
setAnchorNode in interface Watch
Parameters:
anchor - The anchor node within which the watch is scoped

getAnchorNode

public FleetingNode getAnchorNode()
Get the anchor node for the watch. This is the node to which the watch is scoped, typically the context node for the streamable path expression that defines the root of the subtree within which nodes are being sought.

Specified by:
getAnchorNode in interface Watch
Returns:
The anchor node within which the watch is scoped

open

public void open()
          throws XPathException
Open the watch. This is done at the point where it first starts watching for nodes that match the selection.

Specified by:
open in interface Watch
Throws:
XPathException

notifySelectedLeafNode

public void notifySelectedLeafNode(FleetingNode node,
                                   int locationId)
                            throws XPathException
Signal that a node (other than an element) that matches the selection has been found.

Specified by:
notifySelectedLeafNode in interface Watch
Parameters:
node - the node that was matched.
locationId -
Throws:
XPathException

close

public void close()
           throws XPathException
The close() method is called immediately before the Watch is destroyed, that is, when the element whose declaration scopes the constraint implemented by this Watch goes out of scope. The default implementation does nothing.

Specified by:
close in interface Watch
Throws:
XPathException


Copyright (c) 2004-2010 Saxonica Limited. All rights reserved.