org.opends.server.protocols.jmx
Class DirectoryRMIClientSocketFactory

java.lang.Object
  extended by org.opends.server.protocols.jmx.DirectoryRMIClientSocketFactory
All Implemented Interfaces:
java.io.Serializable, java.rmi.server.RMIClientSocketFactory

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

A DirectoryRMIClientSocketFactory instance is used by the RMI runtime in order to obtain client sockets for RMI calls via SSL.

This class implements RMIClientSocketFactory over the Secure Sockets Layer (SSL) or Transport Layer Security (TLS) protocols.

See Also:
Serialized Form

Constructor Summary
DirectoryRMIClientSocketFactory(boolean wellknown)
          Constructs a new DirectoryRMIClientSocketFactory.
 
Method Summary
 java.net.Socket createSocket(java.lang.String host, int port)
          Creates an SSL socket configured with the right trust stores and the right target host.
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this one.
static java.util.Map getConnectionEnv()
          Returns the thread-local connection environment.
 boolean getNeedClientCertificate()
          Returns the connection mode as configured at construction time.
static java.lang.String getServerHostname()
          Returns the thread-local target server hostname.
 int hashCode()
          Returns a hash code value for this DirectoryRMIClientSocketFactory.
static void setConnectionEnv(java.util.Map connectionEnv)
          Sets the thread-local connection environment.
static void setServerHostname(java.lang.String serverHostname)
          Sets the thread-local target server hostname.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectoryRMIClientSocketFactory

public DirectoryRMIClientSocketFactory(boolean wellknown)
Constructs a new DirectoryRMIClientSocketFactory.

Parameters:
wellknown - true for wellknown, false otherwise
Method Detail

setConnectionEnv

public static void setConnectionEnv(java.util.Map connectionEnv)
Sets the thread-local connection environment.

Parameters:
connectionEnv - the new connection env

getConnectionEnv

public static java.util.Map getConnectionEnv()
Returns the thread-local connection environment.

Returns:
Map the connection environment used by new connections

setServerHostname

public static void setServerHostname(java.lang.String serverHostname)
Sets the thread-local target server hostname.

Parameters:
serverHostname - the target server hostname

getServerHostname

public static java.lang.String getServerHostname()
Returns the thread-local target server hostname.

Returns:
String the target server hostname

getNeedClientCertificate

public boolean getNeedClientCertificate()
Returns the connection mode as configured at construction time.

Returns:
boolean true for wellknown, false otherwise

createSocket

public java.net.Socket createSocket(java.lang.String host,
                                    int port)
                             throws java.io.IOException
Creates an SSL socket configured with the right trust stores and the right target host.

The keystore and truststore used come from client configuration and depend on the connection mode specified at construction time.

The target host is the host specified except if a different host was specified in the connection environment.

Specified by:
createSocket in interface java.rmi.server.RMIClientSocketFactory
Parameters:
host - the target host as known by the RMI stack
port - the target port number
Returns:
an SSL socket
Throws:
java.io.IOException - if an error occurs while configuring the socket

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.

Because each RMI client might have its own configuration, we do not try to optimize anything. Each RMI connector uses its own RMI client socket factory. In other words, Directory RMI clients never share the same client socket factory.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the reference object with which to compare
Returns:
true if this object is the same as the obj argument false otherwise

hashCode

public int hashCode()
Returns a hash code value for this DirectoryRMIClientSocketFactory.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value for this DirectoryRMIClientSocketFactory