fr.dyade.aaa.common.net
Class SocketFactory

java.lang.Object
  extended by fr.dyade.aaa.common.net.SocketFactory
Direct Known Subclasses:
SocketFactory13, SocketFactory14

public abstract class SocketFactory
extends java.lang.Object

This class wraps multiples implementations of the java.net.Socket class.


Field Summary
static java.lang.String DefaultFactory
          The default implementation of the SocketFactory interface is for JDK since 1.4.
private static SocketFactory factory
           
private static java.lang.String[] factoryClasses
           
(package private) static org.objectweb.util.monolog.api.Logger logger
          Logger statique des objets de la classe SocketFactory.
 
Constructor Summary
SocketFactory()
           
 
Method Summary
abstract  java.net.Socket createSocket(java.net.InetAddress addr, int port, java.net.InetAddress localAddr, int localPort, int timeout)
          Creates a socket and connects it to the specified remote host on the specified remote port.
abstract  java.net.Socket createSocket(java.net.InetAddress addr, int port, int timeout)
          Creates a stream socket and connects it to the specified port number at the specified IP address.
static SocketFactory getDefaultFactory()
          Returns the SocketFactory singleton for the specified default class.
static SocketFactory getFactory(java.lang.String sfcn)
          Returns the SocketFactory singleton for the specified class.
static SocketFactory getSocketFactory()
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static org.objectweb.util.monolog.api.Logger logger
Logger statique des objets de la classe SocketFactory.


DefaultFactory

public static final java.lang.String DefaultFactory
The default implementation of the SocketFactory interface is for JDK since 1.4.


factoryClasses

private static java.lang.String[] factoryClasses

factory

private static SocketFactory factory
Constructor Detail

SocketFactory

public SocketFactory()
Method Detail

getDefaultFactory

public static SocketFactory getDefaultFactory()
Returns the SocketFactory singleton for the specified default class.

Returns:
The SocketFactory singleton for the default class.

getFactory

public static SocketFactory getFactory(java.lang.String sfcn)
Returns the SocketFactory singleton for the specified class. If the specified class can not be instantiated the default one is used.

Parameters:
The - classname for SocketFactory class.
Returns:
The SocketFactory singleton for the specified class.

createSocket

public abstract java.net.Socket createSocket(java.net.InetAddress addr,
                                             int port,
                                             int timeout)
                                      throws java.io.IOException
Creates a stream socket and connects it to the specified port number at the specified IP address. Try to establish the connection to the server with a specified timeout value. A timeout of zero is interpreted as an infinite timeout. The connection will then block until established or an error occurs.

Parameters:
addr - the IP address.
port - the port number.
timeout - the timeout value to be used in milliseconds.
Throws:
java.io.IOException

createSocket

public abstract java.net.Socket createSocket(java.net.InetAddress addr,
                                             int port,
                                             java.net.InetAddress localAddr,
                                             int localPort,
                                             int timeout)
                                      throws java.io.IOException
Creates a socket and connects it to the specified remote host on the specified remote port. The Socket will also bind() to the local address and port supplied. Try to establish the connection to the server with a specified timeout value. A timeout of zero is interpreted as an infinite timeout. The connection will then block until established or an error occurs.

Parameters:
addr - the IP address of the remote host
port - the remote port
localAddr - the local address the socket is bound to
localPort - the local port the socket is bound to
timeout - the timeout value to be used in milliseconds.
Throws:
java.io.IOException

getSocketFactory

public static SocketFactory getSocketFactory()
                                      throws java.lang.Exception
Deprecated. 

Returns the SocketFactory singleton. The implementation seems to be choose in an historical way defined by the factoryClasses array.

Returns:
SocketFactory singleton.
Throws:
java.lang.Exception


Copyright © 2010 ScalAgent D.T.. All Rights Reserved.