bamboo.www
Class WebInterface

java.lang.Object
  extended by bamboo.util.StandardStage
      extended by bamboo.www.WebInterface
All Implemented Interfaces:
StorageManager.StorageMonitor, EventHandlerIF, SingleThreadedEventHandlerIF

public class WebInterface
extends StandardStage
implements SingleThreadedEventHandlerIF, StorageManager.StorageMonitor

A web interface to the router's state.

Version:
$Id: WebInterface.java,v 1.26 2005/03/02 02:25:13 srhea Exp $
Author:
Sean C. Rhea

Nested Class Summary
protected static class WebInterface.ConnState
           
 class WebInterface.CoordinateAlarmCb
           
static class WebInterface.MyReqProc
           
static class WebInterface.PingHandler
           
 
Field Summary
protected static long app_id
           
protected  VirtualCoordinate coordinate
           
static int CR
           
protected  int DIGIT_VALUES
           
protected  HashMap<String,Object> handlers
           
protected  String hostname
           
protected  long init_start_time_ms
           
protected  boolean initialized
           
protected static HashMap<ostore.util.NodeId,WebInterface> instances
           
protected  Map latencies
           
static int LF
           
protected  int listen_port
           
protected  BigInteger MODULUS
           
protected  BigInteger my_guid
           
protected  BambooNeighborInfo my_neighbor_info
           
protected  ASyncCore.TimerCB periodic_timer_cb
           
protected  BambooNeighborInfo[] preds
           
protected  Random rand
           
protected  RoutingTable rt
           
protected  int search_leaf_set_ttl
           
protected  BambooNeighborInfo[] succs
           
protected  ServerSocketChannel svr_ch
           
protected  long total_storage
           
protected  LinkedList wait_q
           
protected  WebAppender web_appender
           
 
Fields inherited from class bamboo.util.StandardStage
acore, classifier, DEBUG, event_types, inb_msg_types, logger, my_node_id, my_sink, outb_msg_types, sim_running
 
Constructor Summary
WebInterface()
           
 
Method Summary
protected  void close(WebInterface.ConnState state)
           
protected  void create_response(WebInterface.ConnState state)
           
protected  void create_response(WebInterface.ConnState state, byte[] resp)
           
protected  void handle_accept_ready()
           
protected  void handle_ls_changed(BambooLeafSetChanged msg)
           
protected  void handle_read_ready(SelectionKey skey, WebInterface.ConnState state)
           
protected  void handle_reg_resp(BambooRouterAppRegResp resp)
           
protected  void handle_rt_changed(BambooRoutingTableChanged msg)
           
protected  void handle_write_ready(SelectionKey skey, WebInterface.ConnState state)
           
 void handleEvent(QueueElementIF item)
           
 void init(ConfigDataIF config)
           
static WebInterface instance(ostore.util.NodeId node_id)
           
protected  void print_ls_table_row(StringBuffer r, int pos, BambooNeighborInfo ni, Long rtt_ms)
           
 void register_xml_rpc_handler(String name, Object handler)
           
 void storage_changed(boolean added, InetAddress client_id, long size)
           
 
Methods inherited from class bamboo.util.StandardStage
BUG, BUG, BUG, config_get_boolean, config_get_double, config_get_int, config_get_string, configGetInt, destroy, dispatch, enqueue, handleEvents, lookup_stage, now_ms, timer_ms
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instances

protected static HashMap<ostore.util.NodeId,WebInterface> instances

CR

public static final int CR
See Also:
Constant Field Values

LF

public static final int LF
See Also:
Constant Field Values

DIGIT_VALUES

protected int DIGIT_VALUES

MODULUS

protected BigInteger MODULUS

my_guid

protected BigInteger my_guid

my_neighbor_info

protected BambooNeighborInfo my_neighbor_info

initialized

protected boolean initialized

wait_q

protected LinkedList wait_q

app_id

protected static final long app_id

init_start_time_ms

protected long init_start_time_ms

preds

protected BambooNeighborInfo[] preds

succs

protected BambooNeighborInfo[] succs

rand

protected Random rand

search_leaf_set_ttl

protected int search_leaf_set_ttl

rt

protected RoutingTable rt

latencies

protected Map latencies

listen_port

protected int listen_port

svr_ch

protected ServerSocketChannel svr_ch

web_appender

protected WebAppender web_appender

hostname

protected String hostname

handlers

protected HashMap<String,Object> handlers

total_storage

protected long total_storage

coordinate

protected VirtualCoordinate coordinate

periodic_timer_cb

protected ASyncCore.TimerCB periodic_timer_cb
Constructor Detail

WebInterface

public WebInterface()
             throws Exception
Throws:
Exception
Method Detail

instance

public static WebInterface instance(ostore.util.NodeId node_id)

register_xml_rpc_handler

public void register_xml_rpc_handler(String name,
                                     Object handler)

storage_changed

public void storage_changed(boolean added,
                            InetAddress client_id,
                            long size)
Specified by:
storage_changed in interface StorageManager.StorageMonitor

init

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

handleEvent

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

handle_reg_resp

protected void handle_reg_resp(BambooRouterAppRegResp resp)

handle_accept_ready

protected void handle_accept_ready()

handle_read_ready

protected void handle_read_ready(SelectionKey skey,
                                 WebInterface.ConnState state)

close

protected void close(WebInterface.ConnState state)

handle_write_ready

protected void handle_write_ready(SelectionKey skey,
                                  WebInterface.ConnState state)

print_ls_table_row

protected void print_ls_table_row(StringBuffer r,
                                  int pos,
                                  BambooNeighborInfo ni,
                                  Long rtt_ms)

create_response

protected void create_response(WebInterface.ConnState state,
                               byte[] resp)

create_response

protected void create_response(WebInterface.ConnState state)

handle_ls_changed

protected void handle_ls_changed(BambooLeafSetChanged msg)

handle_rt_changed

protected void handle_rt_changed(BambooRoutingTableChanged msg)