seda.sandStorm.lib.Gnutella
Class GnutellaCatcher

java.lang.Object
  extended by seda.sandStorm.lib.Gnutella.GnutellaCatcher
All Implemented Interfaces:
EventHandlerIF

public class GnutellaCatcher
extends java.lang.Object
implements EventHandlerIF


Nested Class Summary
private  class GnutellaCatcher.searchDepth
           
 
Field Summary
private static boolean DEBUG
           
private  GnutellaServer gs
           
private  ManagerIF mgr
           
private  GnutellaServer mygs
           
private  int num_established
           
private static int SEARCH_DEPTH
           
private  java.util.Hashtable searchTbl
           
private  int total
           
 
Constructor Summary
GnutellaCatcher(ManagerIF mgr, GnutellaServer gs)
          Create a GnutellaCatcher in the context of the given vSpace clone, using the given GnutellaServer to establish new outgoing connections.
 
Method Summary
 void destroy()
          Called when an event handler is destroyed.
 void doCatch(int numconns)
          Create 'numconns' new connections to the Gnutella network, using "gnutellahosts.com:6346" as the bootstrapping host.
 void doCatch(int numconns, java.lang.String hostname, int port)
          Create 'numconns' new connections to the Gnutella network, using the given hostname:port as the bootstrapping host.
 void handleEvent(QueueElementIF item)
          Handle the event corresponding to the given QueueElementIF.
 void handleEvents(QueueElementIF[] qelarr)
          Handle the events corresponding to the given QueueElementIF array.
 void init(ConfigDataIF config)
          Called when an event handler is initialized.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values

SEARCH_DEPTH

private static final int SEARCH_DEPTH
See Also:
Constant Field Values

mgr

private ManagerIF mgr

gs

private GnutellaServer gs

mygs

private GnutellaServer mygs

total

private int total

num_established

private int num_established

searchTbl

private java.util.Hashtable searchTbl
Constructor Detail

GnutellaCatcher

public GnutellaCatcher(ManagerIF mgr,
                       GnutellaServer gs)
                throws java.lang.Exception
Create a GnutellaCatcher in the context of the given vSpace clone, using the given GnutellaServer to establish new outgoing connections.

Throws:
java.lang.Exception
Method Detail

init

public void init(ConfigDataIF config)
          throws java.lang.Exception
Description copied from interface: EventHandlerIF
Called when an event handler is initialized. This method should perform any initialization operations as required by the application.

Specified by:
init in interface EventHandlerIF
Parameters:
config - The set of configuration parameters for the stage.
Throws:
java.lang.Exception - The EventHandler can indicate an error to the runtime during initialization by throwing an Exception.

destroy

public void destroy()
Description copied from interface: EventHandlerIF
Called when an event handler is destroyed. This method should perform any cleanup or shutdown operations as required by the application before the event handler is removed from the system.

Specified by:
destroy in interface EventHandlerIF

doCatch

public void doCatch(int numconns,
                    java.lang.String hostname,
                    int port)
             throws java.net.UnknownHostException
Create 'numconns' new connections to the Gnutella network, using the given hostname:port as the bootstrapping host.

Throws:
java.net.UnknownHostException

doCatch

public void doCatch(int numconns)
             throws java.net.UnknownHostException
Create 'numconns' new connections to the Gnutella network, using "gnutellahosts.com:6346" as the bootstrapping host.

Throws:
java.net.UnknownHostException

handleEvent

public void handleEvent(QueueElementIF item)
Description copied from interface: EventHandlerIF
Handle the event corresponding to the given QueueElementIF. This method is invoked by the system when a single event is pending for the event handler.

Specified by:
handleEvent in interface EventHandlerIF

handleEvents

public void handleEvents(QueueElementIF[] qelarr)
Description copied from interface: EventHandlerIF
Handle the events corresponding to the given QueueElementIF array. This method is invoked when multiple events are pending for the event handler. The application may reorder, filter, or drop these events if it wishes to do so.

Specified by:
handleEvents in interface EventHandlerIF