org.objectweb.carol.jndi.registry
Class RMIFixedPortFirewallSocketFactory

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

public class RMIFixedPortFirewallSocketFactory
extends java.rmi.server.RMISocketFactory

Socket factory allowing to use a fixed port instead of a random port (when it's 0). This is useful for firewall issues.

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 register(int port)
          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)
                                                 throws java.rmi.RemoteException
Register the factory

Parameters:
port - given port number for exporting objects
Returns:
the factory which was created
Throws:
java.rmi.RemoteException - if the registration is not possible