provided.rmiUtils
Interface IRMIUtils

All Known Implementing Classes:
RMIUtils

public interface IRMIUtils

Utility interface used to abstract and encapsulate the configuration initialization and shutdown of RMI

Author:
swong

Method Summary
 java.lang.String getLocalAddress()
          This method is designed to reliably return the actual local IP address across multiple platforms, particularly Linux.
 java.rmi.registry.Registry getLocalRegistry()
          Returns the RMI Registry on the local machine on port IRMI_Defs.REGISTRY_PORT, as a server would require.
 java.rmi.registry.Registry getRemoteRegistry(java.lang.String host)
          Returns the RMI Registry on a remote machine on port IRMI_Defs.REGISTRY_PORT, as a client would require.
 void startRMI(int classServerPort)
          Start up the RMI system.
 void stopRMI()
          Performs all necessary work to shut the RMI system down, such as shut the class server down.
 

Method Detail

getLocalRegistry

java.rmi.registry.Registry getLocalRegistry()
Returns the RMI Registry on the local machine on port IRMI_Defs.REGISTRY_PORT, as a server would require.

Returns:
The local Registry

getRemoteRegistry

java.rmi.registry.Registry getRemoteRegistry(java.lang.String host)
Returns the RMI Registry on a remote machine on port IRMI_Defs.REGISTRY_PORT, as a client would require.

Parameters:
host - The IP address or host name of the remote machine
Returns:
The Registry found there.

getLocalAddress

java.lang.String getLocalAddress()
                                 throws java.net.SocketException,
                                        java.net.UnknownHostException
This method is designed to reliably return the actual local IP address across multiple platforms, particularly Linux. This method is a replacement for "java.net.InetAddress.getLocalHost().getHostAddress()" which will return the loopback address in Linux, not the actual IP address. This method only returns IPv4 addresses, not IPv6 addresses. It returns the first valid address found.

Returns:
The first IPv4 address found for the system that is not a loopback address.
Throws:
java.net.SocketException - thrown when there is a problem retrieving the network interfaces.
java.net.UnknownHostException - thrown when the local host address cannot be found.

startRMI

void startRMI(int classServerPort)
Start up the RMI system. This method should be called before any other activity with that involves RMI. This method configures the system properties RMI needs, starts the security manager and starts the class server.
Typical classServerPort values are:
IRMI_Defs.CLASS_SERVER_PORT_SERVER and
IRMI_Defs.CLASS_SERVER_PORT_CLIENT

Parameters:
classServerPort - the port that the class server will use

stopRMI

void stopRMI()
Performs all necessary work to shut the RMI system down, such as shut the class server down. This method MUST be called before exiting the system or phantom processes may persist.