de.fu_berlin.ties
Class CollectingProcessor

java.lang.Object
  extended by de.fu_berlin.ties.ConfigurableProcessor
      extended by de.fu_berlin.ties.CollectingProcessor
All Implemented Interfaces:
Closeable, Processor
Direct Known Subclasses:
ShuffleGenerator

public abstract class CollectingProcessor
extends ConfigurableProcessor
implements Closeable

Abstract base clase for a Processor that collects all the input arguments and processes the collected arguments when shutting down. The close(int) method delegates to the abstract process(List, ContextMap) method to process the collected arguments.

Instances of this class are not thread-safe and must be synchronized externally, if required.

Version:
$Revision: 1.5 $, $Date: 2004/09/06 17:21:46 $, $Author: siefkes $
Author:
Christian Siefkes

Constructor Summary
CollectingProcessor(TiesConfiguration conf)
          Creates a new instance.
 
Method Summary
 void close(int errorCount)
          Closes this instance, releasing all resources and stopping any background threads.
abstract  void process(List<String> collected, ContextMap context)
          Processes the collected input arguments.
 void process(String input)
          Processes an input argument.
 
Methods inherited from class de.fu_berlin.ties.ConfigurableProcessor
getConfig
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectingProcessor

public CollectingProcessor(TiesConfiguration conf)
Creates a new instance.

Parameters:
conf - used to configure this instance; if null, the standard configuration is used
Method Detail

close

public final void close(int errorCount)
                 throws IOException,
                        ProcessingException
Closes this instance, releasing all resources and stopping any background threads.

Specified by:
close in interface Closeable
Parameters:
errorCount - the number of errors (exceptions) that occurred during calls to this instance (0 if none)
Throws:
IOException - if an I/O error occurs
ProcessingException - if an error occurs during processing any remaining input

process

public final void process(String input)
Processes an input argument.

Specified by:
process in interface Processor
Parameters:
input - the input to process

process

public abstract void process(List<String> collected,
                             ContextMap context)
                      throws IOException,
                             ProcessingException
Processes the collected input arguments.

Parameters:
collected - a list of Strings containing the collected input arguments
context - a map of objects that are made available for processing; will be empty when called from the close(int) method in this class
Throws:
IOException - if an I/O error occurs
ProcessingException - if an error occurs during processing


Copyright © 2003-2004 Christian Siefkes. All Rights Reserved.