SmartFrog 3.10.000

org.smartfrog.sfcore.security
Class SFClientSocketFactory

java.lang.Object
  extended by org.smartfrog.sfcore.security.SFClientSocketFactory
All Implemented Interfaces:
java.io.Serializable, java.rmi.server.RMIClientSocketFactory

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

A client socket factory that adapts a SSL client socket factory so that it can be used to generate RMI client sockets. This factory is created "empty" by the server, and fill up appropriately when the client unmarshalls it.

See Also:
Serialized Form

Constructor Summary
SFClientSocketFactory()
          Class Constructor invoked by the server.
SFClientSocketFactory(SFSecurityEnvironment secEnv)
          Class Constructor invoked in the client when not received from the server.
 
Method Summary
 java.net.Socket createSocket(java.lang.String host, int port)
          Create a client socket connected to the specified host and port.
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this one.
 int hashCode()
          Returns a hash code value for this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SFClientSocketFactory

public SFClientSocketFactory()
Class Constructor invoked by the server. Even though the actual initialization is done when the factory is unmarshalled, we have to initialize it here so equality works when we receive a local reference as if it were remote (We could put the server "requirements" for a valid client here, but in general we cannot trust the server to dictate client's security requirements).


SFClientSocketFactory

public SFClientSocketFactory(SFSecurityEnvironment secEnv)
Class Constructor invoked in the client when not received from the server.

Parameters:
secEnv - A security environment shared by all the SSL sockets.
Method Detail

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 an I/O error occurs during socket creation

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one. We need to override the default implementation because RMI uses a hashtable to reuse connections provided that they have "equal" client factory. However, since this factory is sent over the wire by value, you will always get a different one. The approach that we follow is that two factories are equal if their security environments are equal. This works because we assume a one to one mapping between security environment and factory (can't create two factories with different configuration sharing the same environment). We might decide to change this in the future though ...

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

hashCode

public int hashCode()
Returns a hash code value for this object. See 'equals' to understand why we need to override this method.

Overrides:
hashCode in class java.lang.Object
Returns:
A hash code value for this object.

SmartFrog CORE 3.10.000

(C) Copyright 1998-2006 Hewlett-Packard Development Company, LP