More information: http://www.cs.berkeley.edu/~mdw/proj/seda/

seda.sandStorm.core
Class SimpleSink

java.lang.Object
  |
  +--seda.sandStorm.core.SimpleSink
All Implemented Interfaces:
ProfilableIF, SinkIF
Direct Known Subclasses:
AFile, AFileImpl, ATcpConnection, AUdpSocket, GnutellaConnection, httpConnection

public abstract class SimpleSink
extends java.lang.Object
implements SinkIF, ProfilableIF

The SimpleSink class is an abstract class which implements 'null' functionality for most of the administrative methods of SinkIF. This class can be extended to implement simple SinkIF's which don't require most of the special behavior of the fully general case.

Author:
Matt Welsh
See Also:
SinkIF

Constructor Summary
SimpleSink()
           
 
Method Summary
 void enqueue_abort(java.lang.Object key)
          Not supported; throws an IllegalArgumentException.
 void enqueue_commit(java.lang.Object key)
          Not supported; throws an IllegalArgumentException.
 boolean enqueue_lossy(QueueElementIF enqueueMe)
          Calls enqueue() and returns false if SinkException occurs.
 void enqueue_many(QueueElementIF[] enqueueMe)
          Simply calls enqueue() on each item in the array.
 java.lang.Object enqueue_prepare(QueueElementIF[] enqueueMe)
          Not supported; throws an IllegalArgumentException.
abstract  void enqueue(QueueElementIF enqueueMe)
          Must be implemented by subclasses.
 EnqueuePredicateIF getEnqueuePredicate()
          Returns null.
 int profileSize()
          Returns size.
 void setEnqueuePredicate(EnqueuePredicateIF pred)
          Not supported; throws an IllegalArgumentException.
 int size()
          Returns 0.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleSink

public SimpleSink()
Method Detail

enqueue

public abstract void enqueue(QueueElementIF enqueueMe)
                      throws SinkException
Must be implemented by subclasses.
Specified by:
enqueue in interface SinkIF
Following copied from interface: seda.sandStorm.api.SinkIF
Parameters:
element - The QueueElementIF to enqueue
Throws:
SinkFullException - Indicates that the sink is temporarily full.
SinkClosedException - Indicates that the sink is no longer being serviced.

enqueue_lossy

public boolean enqueue_lossy(QueueElementIF enqueueMe)
Calls enqueue() and returns false if SinkException occurs.
Specified by:
enqueue_lossy in interface SinkIF
Following copied from interface: seda.sandStorm.api.SinkIF
Parameters:
element - The QueueElementIF to enqueue
Returns:
true if the element was enqueued, false otherwise.

enqueue_many

public void enqueue_many(QueueElementIF[] enqueueMe)
                  throws SinkException
Simply calls enqueue() on each item in the array. Note that this behavior breaks the property that enqueue_many() should be an "all or nothing" operation, since enqueue() might reject some items but not others. Don't use SimpleSink if this is going to be a problem.
Specified by:
enqueue_many in interface SinkIF
Following copied from interface: seda.sandStorm.api.SinkIF
Parameters:
elements - The element array to enqueue
Throws:
SinkFullException - Indicates that the sink is temporarily full.
SinkClosedException - Indicates that the sink is no longer being serviced.

enqueue_prepare

public java.lang.Object enqueue_prepare(QueueElementIF[] enqueueMe)
                                 throws SinkException
Not supported; throws an IllegalArgumentException.
Specified by:
enqueue_prepare in interface SinkIF
Following copied from interface: seda.sandStorm.api.SinkIF
Parameters:
elements - The element array to provisionally enqueue
Returns:
A "transaction key" that may be used to commit or abort the provisional enqueue
Throws:
SinkFullException - Indicates that the sink is temporarily full and that the requested elements could not be provisionally enqueued.
SinkClosedException - Indicates that the sink is no longer being serviced.
See Also:
enqueue_commit, enqueue_abort

enqueue_commit

public void enqueue_commit(java.lang.Object key)
Not supported; throws an IllegalArgumentException.
Specified by:
enqueue_commit in interface SinkIF
Following copied from interface: seda.sandStorm.api.SinkIF
Parameters:
key - The enqueue key returned by a previous call to enqueue_prepare().
Throws:
java.lang.IllegalArgumentException - Thrown if an unknown enqueue key is provided.

enqueue_abort

public void enqueue_abort(java.lang.Object key)
Not supported; throws an IllegalArgumentException.
Specified by:
enqueue_abort in interface SinkIF
Following copied from interface: seda.sandStorm.api.SinkIF
Parameters:
key - The enqueue key returned by a previous call to enqueue_prepare().
Throws:
java.lang.IllegalArgumentException - Thrown if an unknown enqueue key is provided.

setEnqueuePredicate

public void setEnqueuePredicate(EnqueuePredicateIF pred)
Not supported; throws an IllegalArgumentException.
Specified by:
setEnqueuePredicate in interface SinkIF

getEnqueuePredicate

public EnqueuePredicateIF getEnqueuePredicate()
Returns null.
Specified by:
getEnqueuePredicate in interface SinkIF

size

public int size()
Returns 0.
Specified by:
size in interface SinkIF

profileSize

public int profileSize()
Returns size.
Specified by:
profileSize in interface ProfilableIF

More information: http://www.cs.berkeley.edu/~mdw/proj/seda/