info.jedi.net
Class RMCHandler

java.lang.Object
  |
  +--info.jedi.net.DefaultPacketHandler
        |
        +--info.jedi.net.RMCHandler

public class RMCHandler
extends DefaultPacketHandler

This class handles incoming JEDI remote method call requests. It creates a RMCCall object for each request and calls its methods to execute the remote method call and reply to the caller.

See Also:
RMCCall, MailDaemon

Field Summary
static int RMC_HANDLER_NUMBER
          The index of this handler in the MailDaemon handler list
 
Method Summary
 java.lang.Object call(java.net.InetAddress address, int port, java.lang.String objectName, java.lang.String methodName, java.util.Vector args, int timeout)
          Calls a remote method by creating a RMCCall object, sending it off to the remote machine, waiting for a response, and returing the appropriate value (or throwing an exception if there was an error).
static RMCHandler getHandler()
          gets the RMCHandler that was created most recently (or null if none has been created
 boolean handleError(java.lang.Exception e, OutputPacket packet)
          Handles any error that occurs in sending a remote method call.
 boolean handlePacket(InputPacket packet)
          Handles an incoming remote method call InputPacket by creating and executing an RMCCall object from it.
 HandlerStack stack()
          The HandlerStack for remote method call messages
 
Methods inherited from class info.jedi.net.DefaultPacketHandler
initializePacket, sendPacket
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RMC_HANDLER_NUMBER

public static final int RMC_HANDLER_NUMBER
The index of this handler in the MailDaemon handler list
Method Detail

handleError

public boolean handleError(java.lang.Exception e,
                           OutputPacket packet)
Handles any error that occurs in sending a remote method call.
Overrides:
handleError in class DefaultPacketHandler
Parameters:
e - the error that occurred
packet - the packet that was being sent when the error occurred

handlePacket

public boolean handlePacket(InputPacket packet)
                     throws java.io.IOException
Handles an incoming remote method call InputPacket by creating and executing an RMCCall object from it.
Overrides:
handlePacket in class DefaultPacketHandler
Throws:
java.io.IOException - if there is an error reading in the RMCCall from the InputPacket
See Also:
RMCCall

call

public java.lang.Object call(java.net.InetAddress address,
                             int port,
                             java.lang.String objectName,
                             java.lang.String methodName,
                             java.util.Vector args,
                             int timeout)
                      throws java.lang.Exception
Calls a remote method by creating a RMCCall object, sending it off to the remote machine, waiting for a response, and returing the appropriate value (or throwing an exception if there was an error).
Parameters:
address - the machine the remote object is on
port - the port the remote object is on
objectName - the name of the remote object in the Registry of the remote machine
methodName - the method to call
args - the arguments to the method, in order
Returns:
the value returned by the remote method
Throws:
java.lang.Exception - if the remote method threw an exception, it will be sent back over the network and thrown. If the remote object couldn't be found in the registry, or if the method didn't exist or couldn't be called, or if there was a network error, an exception is also thrown.

stack

public HandlerStack stack()
The HandlerStack for remote method call messages

getHandler

public static RMCHandler getHandler()
gets the RMCHandler that was created most recently (or null if none has been created