com.ibm.di.api.remote.impl.rmi
Class RMISocketFactory

java.lang.Object
  extended by com.ibm.di.api.remote.impl.rmi.RMISocketFactory
All Implemented Interfaces:
java.io.Serializable, java.rmi.server.RMIClientSocketFactory, java.rmi.server.RMIServerSocketFactory

public class RMISocketFactory
extends java.lang.Object
implements java.rmi.server.RMIServerSocketFactory, java.rmi.server.RMIClientSocketFactory, java.io.Serializable

A wrapper class of RMIServerSocketFactory class. Class used by the RMI to obtain server and client sockets for RMI calls. This Factory is running only on TDI Server side.

See Also:
Serialized Form

Constructor Summary
RMISocketFactory(java.util.Vector<java.lang.String> aHosts)
          Constructor with two parameters.
RMISocketFactory(java.util.Vector<java.lang.String> aHosts, BindAddressPolicy bindAddrPol)
          Constructor with two parameters.
 
Method Summary
static boolean allowConnection()
          Verifies access of the socket associated with the current thread to this RMISocketFactory.
 java.net.ServerSocket createServerSocket(int aPort)
          Create a server socket on the specified port.
 java.net.Socket createSocket(java.lang.String host, int port)
          Create a client socket connected to the specified host and port.
protected static void setLocalThreadSocket(java.net.Socket aSocket)
          Sets the current thread's copy of this thread-local variable to the specified value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RMISocketFactory

public RMISocketFactory(java.util.Vector<java.lang.String> aHosts,
                        BindAddressPolicy bindAddrPol)
Constructor with two parameters.

Parameters:
aHosts - Vector object of provided hosts
bindAddrPol - Object where bind addresses are obtained from

RMISocketFactory

public RMISocketFactory(java.util.Vector<java.lang.String> aHosts)
Constructor with two parameters.

Parameters:
aHosts - Vector object of provided hosts
bindAddrPol - Object where bind addresses are obtained from
Method Detail

createServerSocket

public java.net.ServerSocket createServerSocket(int aPort)
                                         throws java.io.IOException
Create a server socket on the specified port. The Bind Address is set implicitly.

Specified by:
createServerSocket in interface java.rmi.server.RMIServerSocketFactory
Parameters:
aPort - the port. port 0 indicates an anonymous port
Returns:
the server socket on the specified port
Throws:
java.io.IOException - if I/O error occurs during server socket creation

createSocket

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

Specified by:
createSocket in interface java.rmi.server.RMIClientSocketFactory
Parameters:
host - the host name
port - the port number
Returns:
a socket connected to the specified host and port
Throws:
java.io.IOException - if I/O error occurs during socket creation

setLocalThreadSocket

protected static void setLocalThreadSocket(java.net.Socket aSocket)
Sets the current thread's copy of this thread-local variable to the specified value. Many applications will have no need for this functionality, relying solely on the initialValue method to set the values of thread-locals.

Parameters:
aSocket - the value to be stored in the current threads' copy of this thread-local.

allowConnection

public static boolean allowConnection()
                               throws java.lang.Exception
Verifies access of the socket associated with the current thread to this RMISocketFactory.

Returns:
true if the socket has access, otherwise returns false
Throws:
java.lang.Exception - if no Socket is associated with the current thread