info.jedi.net
Interface PacketHandler

All Known Implementing Classes:
DefaultPacketHandler

public interface PacketHandler

This is the interface for JEDI packet handlers. It defines a handling function to process a packet.

See Also:
InputPacket, MailDaemon

Method Summary
 boolean handleError(java.lang.Exception e, OutputPacket packet)
          This method handles any error that might have occurred in sending an OutputPacket with this as one handler.
 boolean handlePacket(InputPacket packet)
          This method accepts an incoming packet and processes it.
 void initializePacket(OutputPacket packet)
          This method initializes an OutputPacket that will eventually be sent through this Handler.
 boolean sendPacket(OutputPacket packet)
          This method performs any work necessary to complete this packet before it is sent.
 

Method Detail

handlePacket

public boolean handlePacket(InputPacket packet)
                     throws java.io.IOException
This method accepts an incoming packet and processes it.
Parameters:
packet - the packet to process
Returns:
true if processing of this packet is complete
Throws:
java.io.IOException - if there is an IO error in processing the packet.

handleError

public boolean handleError(java.lang.Exception e,
                           OutputPacket packet)
This method handles any error that might have occurred in sending an OutputPacket with this as one handler.
Parameters:
e - the exception condition being handled
packet - the packet that was being sent when the error occurred
Returns:
true if the error was properly dealt with; false if the next higher PacketHandler should deal with it.

initializePacket

public void initializePacket(OutputPacket packet)
                      throws java.io.IOException
This method initializes an OutputPacket that will eventually be sent through this Handler.
Parameters:
packet - the OutputPacket to be initialized.
Throws:
java.io.IOException - if there is an IO error in initializing the packet.

sendPacket

public boolean sendPacket(OutputPacket packet)
                   throws java.io.IOException
This method performs any work necessary to complete this packet before it is sent.
Parameters:
packet - the OutputPacket to be updated
Returns:
true if the packet was completely sent and it is unnecessary to call sendPacket for handlers lower on the Handler stack. false if lower level handlers still need to send this packet.
Throws:
java.io.IOException - if there is an IO error in updating this packet