edu.ucsb.adl.middleware
Class PassthruAccumulator

java.lang.Object
  |
  +--edu.ucsb.adl.middleware.ResultAccumulator
        |
        +--edu.ucsb.adl.middleware.PassthruAccumulator

public final class PassthruAccumulator
extends ResultAccumulator

A result accumulator that immediately passes query results to the associated result set.

Version:
$Header: /export/home/gjanee/middleware/edu/ucsb/adl/middleware/RCS/PassthruAccumulator.java,v 1.3 2004/03/05 19:33:35 gjanee Exp $

$Log: PassthruAccumulator.java,v $ Revision 1.3 2004/03/05 19:33:35 gjanee
Added support for multiple middleware instances. A middleware instance is represented by a Global object that is tied to a main middleware configuration file. All service objects now maintain a reference to the appropriate Global object. Instance-wide variables formerly coded as class variables are now held by the Global object; various methods that return instance-wide variables now accept a Global object as an argument. The Global object is now passed to all service drivers.

Revision 1.2 2003/06/09 20:58:36 gjanee
Query results are now Result objects, i.e., triplets of standard metadata views.

Revision 1.1 2000/01/28 23:24:11 gjanee
Initial revision

Author:
Greg Janée
Alexandria Digital Library

Field Summary
 
Fields inherited from class edu.ucsb.adl.middleware.ResultAccumulator
m_maximumResults, m_set
 
Constructor Summary
PassthruAccumulator(edu.ucsb.adl.middleware.Global global, edu.ucsb.adl.middleware.ResultSet set, int maximumResults, long lifetime, boolean validateResults)
          Creates a PassthruAccumulator.
 
Method Summary
protected  void addResultInternal(edu.ucsb.adl.middleware.Result result)
          Adds a result to the associated result set.
protected  void flushToResultSet()
          Does nothing.
protected  int getTotalResultCount()
          Returns the number of results in the associated result set.
 
Methods inherited from class edu.ucsb.adl.middleware.ResultAccumulator
addResult, addSource, destroy, getAllInstances, getID, getInstance, getOutstandingSources, isStarted, sourceTerminated, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PassthruAccumulator

public PassthruAccumulator(edu.ucsb.adl.middleware.Global global,
                           edu.ucsb.adl.middleware.ResultSet set,
                           int maximumResults,
                           long lifetime,
                           boolean validateResults)
Creates a PassthruAccumulator.

Parameters:
global - The global object representing this instance of the middleware.
set - The associated result set. The result set should be incomplete, and no object other than the accumulator should ever mark it as being complete.
maximumResults - The maximum number of results to accumulate. Note that this is independent of the maximum number of results requested in the associated query.
lifetime - The lifetime of the accumulator in milliseconds.
validateResults - Indicates if query results should be validated.
Throws:
java.lang.NullPointerException - If global or set is null.
java.lang.IllegalArgumentException - If maximumResults or lifetime are negative.
Method Detail

addResultInternal

protected void addResultInternal(edu.ucsb.adl.middleware.Result result)
Adds a result to the associated result set. If the associated query specified a maximum number of results, the accumulator is destroyed when that number is reached. The accumulator is also destroyed when the accumulator's maximum number of results is exceeded.

Specified by:
addResultInternal in class ResultAccumulator
Parameters:
result - The result.

flushToResultSet

protected void flushToResultSet()
Does nothing.

Specified by:
flushToResultSet in class ResultAccumulator

getTotalResultCount

protected int getTotalResultCount()
Returns the number of results in the associated result set.

Specified by:
getTotalResultCount in class ResultAccumulator
Returns:
The number of results.