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
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. |
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
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 instanceport
- port number on which the RMI registry is running (on the local machine!)- Throws:
RemoteException
- if remote method invocation fails
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