com.saxonica.stream.adjunct
Class StreamingAdjunct

java.lang.Object
  extended by com.saxonica.stream.adjunct.StreamingAdjunct
Direct Known Subclasses:
AdjacentTextNodeMergerAdjunct, ApplyImportsAdjunct, ApplyTemplatesAdjunct, AtomicSequenceConverterAdjunct, AtomizerAdjunct, AverageAdjunct, BlockAdjunct, CardinalityCheckerAdjunct, ChooseAdjunct, CopyAdjunct, CopyOfAdjunct, CountAdjunct, DistinctValuesAdjunct, DocumentInstrAdjunct, ElementInstrAdjunct, EmptyAdjunct, EmptyTextNodeRemoverAdjunct, ExistsAdjunct, FilterExpressionAdjunct, ForEachAdjunct, ForkAdjunct, GeneralComparisonAdjunct, ItemCheckerAdjunct, IterateAdjunct, LetExpressionAdjunct, MinimaxAdjunct, NextIterationAdjunct, NextMatchAdjunct, ResultDocumentAdjunct, SimpleNodeConstructorAdjunct, SingletonAtomizerAdjunct, StringFnAdjunct, StringJoinAdjunct, SumAdjunct, UnsupportedOperationAdjunct, WithParamAdjunct

public class StreamingAdjunct
extends Object

This abstract class supplements an Expression with methods used at compile-time to support streaming, by generating a Watch or Feed that allows the expression to be evaluated in push mode.

There is a subclass for each kind of expression that can be evaluated in push mode. Typically such evaluation will either be at event granularity (a Watch) or at item granularity (a Feed). Most expressions implement one or the other. There is a fallback implementation that allows any expression to be evaluated as a Feed, but it involves buffering the input in memory and only evaluating the expression when all the input is available.


Constructor Summary
StreamingAdjunct()
           
 
Method Summary
 Configuration getConfiguration()
          Get the Saxon Configuration
 FeedMaker getFeedMaker(Expression expression, int arg)
          Get a FeedMaker, a factory class that creates a Watch to evaluate this expression in streaming mode.
 WatchMaker getWatchMaker(Expression expression, List<String> reasonsForFailure)
          Get a WatchMaker, a factory class that creates a Watch to evaluate this expression in streaming mode.
static StreamingAdjunct makeStreamingAdjunct(Expression exp, Configuration config)
          Make a streaming adjunct for a particular expression.
 void setConfiguration(Configuration config)
          Set the Saxon Configuration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamingAdjunct

public StreamingAdjunct()
Method Detail

setConfiguration

public void setConfiguration(Configuration config)
Set the Saxon Configuration

Parameters:
config - the Configuration

getConfiguration

public Configuration getConfiguration()
Get the Saxon Configuration

Returns:
the configuration

getWatchMaker

public WatchMaker getWatchMaker(Expression expression,
                                List<String> reasonsForFailure)
                         throws XPathException
Get a WatchMaker, a factory class that creates a Watch to evaluate this expression in streaming mode. This method will only be called if the getImplementationMethod() method of the expression includes the value Expression.WATCH_METHOD

Parameters:
expression - the expression to be evaluated in streaming mode
reasonsForFailure - if non-null, this is a list supplied by the caller which will be populated by the callee with one or more messages indicating why it was not possible to allocate a WatchMaker. Normally if the list is non-empty on return, the return value from the method will be null.
Returns:
a Watchmaker to evaluate the expression, or null if it is not streamable with respect to the specificed argument.
Throws:
XPathException

getFeedMaker

public FeedMaker getFeedMaker(Expression expression,
                              int arg)
                       throws XPathException
Get a FeedMaker, a factory class that creates a Watch to evaluate this expression in streaming mode.

Parameters:
expression - the expression to be evaluated in streaming mode
arg - identifies the argument with respect to which the expression is to be inverted: usually 0 to indicate the first argument is the value that is streamed. Argument numbering is the same as the sequence of arguments/operands returned by the method Expression.iterateSubExpressions()
Returns:
a Watchmaker to evaluate the expression, or null if it is not streamable with respect to the specificed argument.
Throws:
XPathException

makeStreamingAdjunct

public static StreamingAdjunct makeStreamingAdjunct(Expression exp,
                                                    Configuration config)
Make a streaming adjunct for a particular expression.

This would normally be a method on the class Expression; the only reason it isn't is because this code is specific to commercial editions of Saxon.

Parameters:
exp - the expression to be compiled
config - the Saxon Configuration
Returns:
the compiler for this kind of expression


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