org.alfresco.util.remote.server.socket
Class HostConfigurableSocketFactory

java.lang.Object
  extended by org.alfresco.util.remote.server.socket.HostConfigurableSocketFactory
All Implemented Interfaces:
java.io.Serializable, java.rmi.server.RMIClientSocketFactory, java.rmi.server.RMIServerSocketFactory, org.springframework.beans.factory.InitializingBean

public class HostConfigurableSocketFactory
extends java.lang.Object
implements java.rmi.server.RMIServerSocketFactory, java.rmi.server.RMIClientSocketFactory, org.springframework.beans.factory.InitializingBean, java.io.Serializable

This Spring depended class allows to control the binding of a RMI Registry to some port and concrete local host, e.g.: localhost, 192.168.0.1 etc. Host may be configured with the -Djava.rmi.server.hostname system property

NOTE: The system property configuration has the highest priority

See Also:
Spring dependence, RMIServerSocketFactory, RMIClientSocketFactory, Serialized Form

Constructor Summary
HostConfigurableSocketFactory()
           
 
Method Summary
 void afterPropertiesSet()
          Checks whether the -Djava.rmi.server.hostname system property presented and sets a host from this property if it is true
 java.net.ServerSocket createServerSocket(int port)
           
 java.net.Socket createSocket(java.lang.String host, int port)
           
 java.lang.String getHost()
           
 void setHost(java.net.InetAddress host)
           
 void setHost(java.lang.String host)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HostConfigurableSocketFactory

public HostConfigurableSocketFactory()
Method Detail

setHost

public void setHost(java.lang.String host)

setHost

public void setHost(java.net.InetAddress host)

getHost

public java.lang.String getHost()
Returns:
String value which represents either a Host Name or a Host (IP) Address if Host Name is not reachable

createSocket

public java.net.Socket createSocket(java.lang.String host,
                                    int port)
                             throws java.io.IOException
Specified by:
createSocket in interface java.rmi.server.RMIClientSocketFactory
Throws:
java.io.IOException

createServerSocket

public java.net.ServerSocket createServerSocket(int port)
                                         throws java.io.IOException
Specified by:
createServerSocket in interface java.rmi.server.RMIServerSocketFactory
Throws:
java.io.IOException

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Checks whether the -Djava.rmi.server.hostname system property presented and sets a host from this property if it is true

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.