Class SimpleGnutellaServer

java.lang.Object
  extended bySimpleGnutellaServer
All Implemented Interfaces:
EventHandlerIF

public class SimpleGnutellaServer
extends java.lang.Object
implements EventHandlerIF

This is a simple Gnutella server implemented using the Sandstorm Gnutella library. It correctly implements packet routing. It does not respond to queries or host any shared files itself; it simply routes packets to other hosts on the network.

Author:
Matt Welsh

Nested Class Summary
(package private)  class SimpleGnutellaServer.timerEvent
          Small internal class to represent a timer event.
 
Constructor Summary
SimpleGnutellaServer()
           
 
Method Summary
 void destroy()
          Called when an event handler is destroyed.
 void handleEvent(QueueElementIF item)
          The main event handling code.
 void handleEvents(QueueElementIF[] items)
          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
 

Constructor Detail

SimpleGnutellaServer

public SimpleGnutellaServer()
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

handleEvent

public void handleEvent(QueueElementIF item)
The main event handling code.

Specified by:
handleEvent in interface EventHandlerIF

handleEvents

public void handleEvents(QueueElementIF[] items)
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