bamboo.util
Class StandardStage

java.lang.Object
  extended by bamboo.util.StandardStage
All Implemented Interfaces:
EventHandlerIF, SingleThreadedEventHandlerIF
Direct Known Subclasses:
CheckRunning, CheckRunning, DataManager, DataManagerTest, Dht, FairShareTestClient, FileShare, Gateway, GatewayClient, LookupService, LookupTest, MulticastClient, MulticastTest, Network, Network, PrintLeafSets, PutGetTest, RedirClient, RedirTest, RoutePerf, Router, RouterCallbackInterface, RoutingTableTest, Rpc, StorageManager, StorageManagerTest, TcpMessageTransport, TcpMessageTransportTest, Vivaldi, WebInterface

public abstract class StandardStage
extends Object
implements EventHandlerIF, SingleThreadedEventHandlerIF

Implements functionality common to most stages.

Version:
$Id: StandardStage.java,v 1.13 2005/03/02 23:35:12 srhea Exp $
Author:
Sean C. Rhea

Field Summary
protected  ASyncCore acore
           
protected  ostore.dispatch.Classifier classifier
           
protected  boolean DEBUG
           
protected  Class[] event_types
           
protected  Class[] inb_msg_types
           
protected  org.apache.log4j.Logger logger
           
protected  ostore.util.NodeId my_node_id
           
protected  SinkIF my_sink
           
protected  Class[] outb_msg_types
           
protected  boolean sim_running
           
 
Constructor Summary
protected StandardStage()
           
 
Method Summary
protected  void BUG(Exception e)
          Like calling assert(false) in C; prints a stack trace.
protected  void BUG(String msg)
          Like calling assert(false) in C.
protected  void BUG(String msg, Exception e)
          Like calling assert(false) in C; prints a stack trace.
protected  boolean config_get_boolean(ConfigDataIF config, String name)
           
protected  double config_get_double(ConfigDataIF config, String name)
           
protected  int config_get_int(ConfigDataIF config, String name)
           
protected  String config_get_string(ConfigDataIF config, String name)
           
protected  int configGetInt(ConfigDataIF config, String name, int defaultValue)
           
 void destroy()
           
protected  void dispatch(QueueElementIF item)
           
protected  void enqueue(SinkIF sink, QueueElementIF item)
           
 void handleEvent(QueueElementIF item)
           
 void handleEvents(QueueElementIF[] element_array)
           
 void init(ConfigDataIF config)
           
protected  EventHandlerIF lookup_stage(ConfigDataIF config, String name)
           
protected  long now_ms()
          Returns the current time in milliseconds; works correctly under the Bamboo simulator and the Simple OceanStore Simulator (SOSS).
protected  long timer_ms()
          Like now_ms, but uses GetTimeOfDayCC if it's available.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classifier

protected ostore.dispatch.Classifier classifier

my_node_id

protected ostore.util.NodeId my_node_id

my_sink

protected SinkIF my_sink

event_types

protected Class[] event_types

inb_msg_types

protected Class[] inb_msg_types

outb_msg_types

protected Class[] outb_msg_types

DEBUG

protected boolean DEBUG

sim_running

protected boolean sim_running

acore

protected ASyncCore acore

logger

protected org.apache.log4j.Logger logger
Constructor Detail

StandardStage

protected StandardStage()
Method Detail

lookup_stage

protected EventHandlerIF lookup_stage(ConfigDataIF config,
                                      String name)
                               throws NoSuchStageException
Throws:
NoSuchStageException

now_ms

protected long now_ms()
Returns the current time in milliseconds; works correctly under the Bamboo simulator and the Simple OceanStore Simulator (SOSS).


timer_ms

protected long timer_ms()
Like now_ms, but uses GetTimeOfDayCC if it's available. Also works correctly under the Bamboo simulator and SOSS.


BUG

protected final void BUG(String msg)
Like calling assert(false) in C.


BUG

protected final void BUG(String msg,
                         Exception e)
Like calling assert(false) in C; prints a stack trace.


BUG

protected final void BUG(Exception e)
Like calling assert(false) in C; prints a stack trace.


configGetInt

protected int configGetInt(ConfigDataIF config,
                           String name,
                           int defaultValue)

config_get_int

protected int config_get_int(ConfigDataIF config,
                             String name)

config_get_boolean

protected boolean config_get_boolean(ConfigDataIF config,
                                     String name)

config_get_string

protected String config_get_string(ConfigDataIF config,
                                   String name)

config_get_double

protected double config_get_double(ConfigDataIF config,
                                   String name)

init

public void init(ConfigDataIF config)
          throws Exception
Specified by:
init in interface EventHandlerIF
Throws:
Exception

destroy

public void destroy()
Specified by:
destroy in interface EventHandlerIF

handleEvent

public void handleEvent(QueueElementIF item)
Specified by:
handleEvent in interface EventHandlerIF

handleEvents

public void handleEvents(QueueElementIF[] element_array)
                  throws EventHandlerException
Specified by:
handleEvents in interface EventHandlerIF
Throws:
EventHandlerException

enqueue

protected final void enqueue(SinkIF sink,
                             QueueElementIF item)

dispatch

protected final void dispatch(QueueElementIF item)