com.ascert.comms.x25
Class X25SocketFactory

java.lang.Object
  |
  +--com.ascert.comms.x25.X25SocketFactory

public class X25SocketFactory
extends java.lang.Object

Convenience class for creating X.25 sockets using driver specific X25Factory implementations.

Since:
1.00
Version:
1.00, 21 May 2003
Author:
Rob Walker

Field Summary
protected  X25Factory impl
          Driver specific factory implementation to be used for creating X.25 sockets
 
Constructor Summary
X25SocketFactory(X25Factory impl)
          Constructor a new X25SocketFactory using either the supplied X25Factory implementation, or the default value if the supplied value is null.
 
Method Summary
 X25Socket getClientSocket(java.lang.String remoteAddr)
          Creates a new X.25 client socket connected to a specific remote NUA.
 X25Socket getServerSocket(java.lang.String localAddr)
          Creates a new X.25 server socket bound to a specific local NUA, and ready to X25Socket.accept() incoming connections.
 X25Socket getSocket()
          Creates a new X.25 socket using the factory implementation supplied at construction time.
static void setDefaultX25Factory(X25Factory impl)
          Sets the default X25Factory to be used for constructing X.25 socket objects where no specific driver factory is used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

impl

protected X25Factory impl
Driver specific factory implementation to be used for creating X.25 sockets

Constructor Detail

X25SocketFactory

public X25SocketFactory(X25Factory impl)
Constructor a new X25SocketFactory using either the supplied X25Factory implementation, or the default value if the supplied value is null.

Parameters:
impl - specific X25Factory implementation to use for socket creation, or null if the default is to be used
Method Detail

getClientSocket

public X25Socket getClientSocket(java.lang.String remoteAddr)
                          throws java.io.IOException
Creates a new X.25 client socket connected to a specific remote NUA. On successful return, the socket will already be connected to the NUA and be available for data transfer.

Parameters:
remoteAddr - remote NUA to connect to
Returns:
created socket connected to the remote NUA
Throws:
java.io.IOException - if an error occurs creating the socket or connecting to the NUA

getServerSocket

public X25Socket getServerSocket(java.lang.String localAddr)
                          throws java.io.IOException
Creates a new X.25 server socket bound to a specific local NUA, and ready to X25Socket.accept() incoming connections.

Parameters:
localAddr - local address to listen for incoming connections
Returns:
newly create server socket
Throws:
java.io.IOException - if an error occurs creating or initialising the server socket

getSocket

public X25Socket getSocket()
                    throws java.io.IOException
Creates a new X.25 socket using the factory implementation supplied at construction time.

Returns:
newly created X.25 socket
Throws:
java.io.IOException - if an error occurs constructing the socket

setDefaultX25Factory

public static void setDefaultX25Factory(X25Factory impl)
Sets the default X25Factory to be used for constructing X.25 socket objects where no specific driver factory is used. On initial loading of the X25SocketFactory class an attempt will be made to set the default value using the fully qualified class name specific in the X25Factory.FACTORY_CLASS_PROPERTY System property.

Parameters:
impl - The new default X25Factory value