com.ls.lars.communication
Class RMIListener

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--com.ls.lars.communication.RMIListener
All Implemented Interfaces:
IRMIListener, Remote, Serializable

public class RMIListener
extends UnicastRemoteObject
implements IRMIListener

This class is managing incoming client RMI requests.

Version:
$Revision: 1.7 $
Author:
Last modified by $Author: MFehrenbach $
See Also:
Serialized Form

Field Summary
protected  Map connectionParameters
          contains the connection parameters for this Listener, e.g the port
protected  ILogger logger
          the reference to the owning agent's log file (initally set to SystemLogger.getLogger())
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
RMIListener(int port)
          Initializes the port on which the RMI Listener has to listen for incoming requests.
 
Method Summary
 boolean createConnection(String agentName)
          Creates a RMI connection to be used by remote agents.
 void setLog(ILogger log)
          Sets the ILogger for the listener.
 void setPort(int port)
          Sets the port number on which the RMIListener has to listen for incoming requests.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected ILogger logger
the reference to the owning agent's log file (initally set to SystemLogger.getLogger())

connectionParameters

protected Map connectionParameters
contains the connection parameters for this Listener, e.g the port
Constructor Detail

RMIListener

public RMIListener(int port)
            throws RemoteException
Initializes the port on which the RMI Listener has to listen for incoming requests.
Parameters:
listenerAgent - reference to the owning AgentListener instance
port - port number on which the RMI registry is running (on the local machine!)
Throws:
RemoteException - if remote method invocation fails
Method Detail

setLog

public void setLog(ILogger log)
Sets the ILogger for the listener. Should be called directly after creating the listener.
Specified by:
setLog in interface IRMIListener
Parameters:
log - reference to the ILogger of the owning agent

setPort

public void setPort(int port)
Sets the port number on which the RMIListener has to listen for incoming requests.
Parameters:
port - port number on which the RMIListener has to listen for incoming requests

createConnection

public boolean createConnection(String agentName)
                         throws RemoteException
Creates a RMI connection to be used by remote agents. This method is called, after a remote agent connects to the platform.
Specified by:
createConnection in interface IRMIListener
Parameters:
agentName - Name of the agent which requests a RMI connection
Returns:
true if ok; false else
Throws:
RemoteException - If remote method invocation fails