org.objectweb.carol.jndi.registry
Class RMIManageableSocketFactory

java.lang.Object
  extended byjava.rmi.server.RMISocketFactory
      extended byorg.objectweb.carol.jndi.registry.RMIManageableSocketFactory
All Implemented Interfaces:
java.rmi.server.RMIClientSocketFactory, java.rmi.server.RMIServerSocketFactory

public class RMIManageableSocketFactory
extends java.rmi.server.RMISocketFactory

Socket factory allowing to : - use a fixed port instead of a random port (when port is 0). (This is useful for firewall issues) - Bind on a specific IP address - Supporting multiprotocol with a multi entries socket cache

Author:
Florent Benoit

Method Summary
 java.net.ServerSocket createServerSocket(int port)
          Create a server socket on the specified port (port 0 indicates an anonymous port).
 java.net.Socket createSocket(java.lang.String host, int port)
          Creates a client socket connected to the specified host and port.
static java.rmi.server.RMISocketFactory getFactory()
          Get the factory instance, null if not created
static java.rmi.server.RMISocketFactory register(int port, int objectPort, java.net.InetAddress inetAddress, java.lang.String protocol)
          Register the factory
 
Methods inherited from class java.rmi.server.RMISocketFactory
getDefaultSocketFactory, getFailureHandler, getSocketFactory, setFailureHandler, setSocketFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createServerSocket

public java.net.ServerSocket createServerSocket(int port)
                                         throws java.io.IOException
Create a server socket on the specified port (port 0 indicates an anonymous port).

Parameters:
port - the port number
Returns:
the server socket on the specified port
Throws:
java.io.IOException - if an I/O error occurs during server socket creation
See Also:
RMISocketFactory.createServerSocket(int)

createSocket

public java.net.Socket createSocket(java.lang.String host,
                                    int port)
                             throws java.io.IOException
Creates a client socket connected to the specified host and port.

Parameters:
host - the host name
port - the port number
Returns:
a socket connected to the specified host and port.
Throws:
java.io.IOException - if an I/O error occurs during socket creation
See Also:
RMISocketFactory.createSocket(java.lang.String, int)

register

public static java.rmi.server.RMISocketFactory register(int port,
                                                        int objectPort,
                                                        java.net.InetAddress inetAddress,
                                                        java.lang.String protocol)
                                                 throws java.rmi.RemoteException
Register the factory

Parameters:
port - given port number for registry
objectPort - given port number for exporting objects
inetAddress - ip to use for the bind (instead of all), if null take default 0.0.0.0 listener
protocol - protocol associated with the [port, inetAddress]
Returns:
the factory which was created
Throws:
java.rmi.RemoteException - if the registration is not possible

getFactory

public static java.rmi.server.RMISocketFactory getFactory()
Get the factory instance, null if not created

Returns:
the factory