Sun Adapter for TCP/IP HL7

com.stc.connector.tcpip.model.client
Class TCPIPSocketInfo

java.lang.Object
  extended by com.stc.connector.tcpip.model.client.TCPIPSocketInfo
All Implemented Interfaces:
TCPIPSocketInfoInterface

public class TCPIPSocketInfo
extends java.lang.Object
implements TCPIPSocketInfoInterface

This class represents TCPIP Socket configuration information. Basically, it represents java Socket options. Note: Once the socket connection is established, the host, port and socketFactoryImplClassName are not allowed to change.

Version:
cvs revision: $Revision: 1.13 $ Last Modified: $Date: 2008/04/23 07:15:13 $
Author:
Harry Liu

Field Summary
static java.lang.String CONNECTION_TYPE_CLIENT
           
static java.lang.String CONNECTION_TYPE_SERVER
           
static java.lang.String version
           
 
Constructor Summary
TCPIPSocketInfo()
          Constructor for TCPIPSocketInfo.
TCPIPSocketInfo(com.stc.connector.framework.util.ConfigurationHelper aConfiguration)
          Constructor for TCPIPSocketInfo.
 
Method Summary
 void attachSocket(java.net.Socket attachedSocket)
          Attach a socket object so the socket options can be refreshed along with socketInfo changes.
 java.net.Socket getAttachedSocket()
          Returns the attachedSocket.
 int getBacklog()
          Returns the backlog which is the maximum length of the queue.
 TCPIPSocketEstablishmentInfoInterface getClientConnectionEstablishmentInfo()
           
 java.lang.String getConnectionID()
          Returns the connectionID.
 java.lang.String getConnectionType()
           
 java.lang.String getHost()
          Returns the host.
 com.stc.connector.framework.util.ConfigurationHelper getInitPropertiesInfo()
          Returns the initial configuration.
 int getPort()
          Returns the port.
 int getReceiveBufferSize()
          Returns the receiveBufferSize.
 int getSendBufferSize()
          Returns the sendBufferSize.
 TCPIPServerPortBindingInfoInterface getServerPortBindingInfo()
           
 int getServerSoTimeout()
          Returns the server soTimeout.
 java.lang.String getServerWelcomeMessage()
           
 java.lang.String getSocketFactoryImplClassName()
          Returns the socketFactoryImplClassName.
 int getSoLingerTimeout()
          Returns the soLingerTimeout.
 int getSoTimeout()
          Returns the soTimeout.
 boolean isClientConnectionType()
           
 boolean isKeepAlive()
          Checks whether the keepAlive option is on.
 boolean isServerConnectionType()
           
 boolean isSocketConnected()
          Returns the socketConnected.
 boolean isSoLinger()
          Checks whether the SoLinger option is on.
 boolean isTcpNoDelay()
          Checks whether the TcpNoDelay option is on.
 boolean isThereAttachedSocket()
          Method isThereAttachedSocket.
 void setBacklog(int backlog)
          Sets the backlog which is the maximum length of the queue.
 void setClientConnectionEstablishmentInfo(TCPIPSocketEstablishmentInfo info)
           
 void setConnectionID(java.lang.String connectionID)
          Sets the connectionID.
 void setConnectionType(java.lang.String connectionType)
           
 void setHost(java.lang.String host)
          Sets the host.
 void setKeepAlive(boolean keepAlive)
          Sets the keepAlive.
 void setPort(int port)
          Sets the port.
 void setReceiveBufferSize(int receiveBufferSize)
          Sets the receiveBufferSize.
 void setSendBufferSize(int sendBufferSize)
          Sets the sendBufferSize.
 void setServerPortBindingInfo(TCPIPServerPortBindingInfo info)
           
 void setServerSoTimeout(int soTimeout)
          Sets the server soTimeout.
 void setServerWelcomeMessage(java.lang.String string)
           
 void setSocketConnected()
          Sets the socketConnected to true.
 void setSocketFactoryImplClassName(java.lang.String socketFactoryImplClassName)
          Sets the socketFactoryImplClassName.
 void setSoLinger(boolean soLinger)
          Sets the soLinger.
 void setSoLingerTimeout(int soLingerTimeout)
          Sets the soLingerTimeout.
 void setSoTimeout(int soTimeout)
          Sets the soTimeout.
 void setTcpNoDelay(boolean tcpNoDelay)
          Sets the tcpNoDelay.
 void validate()
          Validates the socket configuration settings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

version

public static final java.lang.String version
See Also:
Constant Field Values

CONNECTION_TYPE_SERVER

public static final java.lang.String CONNECTION_TYPE_SERVER
See Also:
Constant Field Values

CONNECTION_TYPE_CLIENT

public static final java.lang.String CONNECTION_TYPE_CLIENT
See Also:
Constant Field Values
Constructor Detail

TCPIPSocketInfo

public TCPIPSocketInfo()
                throws TCPIPApplicationException
Constructor for TCPIPSocketInfo.

Throws:
TCPIPApplicationException - on error.

TCPIPSocketInfo

public TCPIPSocketInfo(com.stc.connector.framework.util.ConfigurationHelper aConfiguration)
                throws TCPIPApplicationException
Constructor for TCPIPSocketInfo.

Parameters:
aConfiguration - The initial properties into.
Throws:
TCPIPApplicationException - on error.
Method Detail

getConnectionType

public java.lang.String getConnectionType()
Specified by:
getConnectionType in interface TCPIPSocketInfoInterface
Returns:

isServerConnectionType

public boolean isServerConnectionType()
Specified by:
isServerConnectionType in interface TCPIPSocketInfoInterface
Returns:

isClientConnectionType

public boolean isClientConnectionType()
Specified by:
isClientConnectionType in interface TCPIPSocketInfoInterface
Returns:

setConnectionType

public void setConnectionType(java.lang.String connectionType)
                       throws TCPIPApplicationException
Parameters:
connectionType -
Throws:
TCPIPApplicationException

getServerSoTimeout

public int getServerSoTimeout()
Returns the server soTimeout.

Specified by:
getServerSoTimeout in interface TCPIPSocketInfoInterface
Returns:
The server soTimeout.

setServerSoTimeout

public void setServerSoTimeout(int soTimeout)
                        throws TCPIPApplicationException,
                               java.io.IOException
Sets the server soTimeout.

Specified by:
setServerSoTimeout in interface TCPIPSocketInfoInterface
Parameters:
soTimeout - The server soTimeout to set
Throws:
TCPIPApplicationException - on error
java.io.IOException - on i/o error.

getServerWelcomeMessage

public java.lang.String getServerWelcomeMessage()
Specified by:
getServerWelcomeMessage in interface TCPIPSocketInfoInterface
Returns:

setServerWelcomeMessage

public void setServerWelcomeMessage(java.lang.String string)
Parameters:
string -

getHost

public java.lang.String getHost()
Returns the host.

Specified by:
getHost in interface TCPIPSocketInfoInterface
Returns:
The host.

isKeepAlive

public boolean isKeepAlive()
Checks whether the keepAlive option is on.

Specified by:
isKeepAlive in interface TCPIPSocketInfoInterface
Returns:
boolean

getPort

public int getPort()
Returns the port.

Specified by:
getPort in interface TCPIPSocketInfoInterface
Returns:
The port.

getBacklog

public int getBacklog()
Returns the backlog which is the maximum length of the queue. It is for outbound server.

Specified by:
getBacklog in interface TCPIPSocketInfoInterface
Returns:
The backlog.

getReceiveBufferSize

public int getReceiveBufferSize()
Returns the receiveBufferSize.

Specified by:
getReceiveBufferSize in interface TCPIPSocketInfoInterface
Returns:
The receive buffer size

getSendBufferSize

public int getSendBufferSize()
Returns the sendBufferSize.

Specified by:
getSendBufferSize in interface TCPIPSocketInfoInterface
Returns:
The send buffer size.

isSoLinger

public boolean isSoLinger()
Checks whether the SoLinger option is on.

Specified by:
isSoLinger in interface TCPIPSocketInfoInterface
Returns:
boolean

getSoLingerTimeout

public int getSoLingerTimeout()
Returns the soLingerTimeout.

Specified by:
getSoLingerTimeout in interface TCPIPSocketInfoInterface
Returns:
The soLinger timeout

getSoTimeout

public int getSoTimeout()
Returns the soTimeout.

Specified by:
getSoTimeout in interface TCPIPSocketInfoInterface
Returns:
The soTimeout.

isTcpNoDelay

public boolean isTcpNoDelay()
Checks whether the TcpNoDelay option is on.

Specified by:
isTcpNoDelay in interface TCPIPSocketInfoInterface
Returns:
boolean

setHost

public void setHost(java.lang.String host)
             throws TCPIPApplicationException
Sets the host.

Parameters:
host - The host to set
Throws:
TCPIPApplicationException - on error

setPort

public void setPort(int port)
             throws TCPIPApplicationException
Sets the port.

Parameters:
port - The port to set
Throws:
TCPIPApplicationException - on error

setBacklog

public void setBacklog(int backlog)
                throws TCPIPApplicationException
Sets the backlog which is the maximum length of the queue. It is for outbound server.

Parameters:
backlog - The backLog to set
Throws:
TCPIPApplicationException - on error

setSocketFactoryImplClassName

public void setSocketFactoryImplClassName(java.lang.String socketFactoryImplClassName)
                                   throws TCPIPApplicationException
Sets the socketFactoryImplClassName.

Parameters:
socketFactoryImplClassName - The socketFactoryImplClassName to set
Throws:
TCPIPApplicationException - on error

setKeepAlive

public void setKeepAlive(boolean keepAlive)
                  throws java.io.IOException
Sets the keepAlive.

Specified by:
setKeepAlive in interface TCPIPSocketInfoInterface
Parameters:
keepAlive - The keepAlive to set
Throws:
IOExeption - on i/oerror
java.io.IOException

setReceiveBufferSize

public void setReceiveBufferSize(int receiveBufferSize)
                          throws TCPIPApplicationException,
                                 java.io.IOException
Sets the receiveBufferSize.

Specified by:
setReceiveBufferSize in interface TCPIPSocketInfoInterface
Parameters:
receiveBufferSize - The receiveBufferSize to set
Throws:
TCPIPApplicationException - on error
IOExeption - on i/oerror
java.io.IOException

setSendBufferSize

public void setSendBufferSize(int sendBufferSize)
                       throws TCPIPApplicationException,
                              java.io.IOException
Sets the sendBufferSize.

Specified by:
setSendBufferSize in interface TCPIPSocketInfoInterface
Parameters:
sendBufferSize - The sendBufferSize to set
Throws:
TCPIPApplicationException - on error
IOExeption - on i/oerror
java.io.IOException

setSoLinger

public void setSoLinger(boolean soLinger)
                 throws java.io.IOException
Sets the soLinger.

Specified by:
setSoLinger in interface TCPIPSocketInfoInterface
Parameters:
soLinger - The soLinger to set
Throws:
IOExeption - on i/oerror
java.io.IOException

setSoLingerTimeout

public void setSoLingerTimeout(int soLingerTimeout)
                        throws java.io.IOException
Sets the soLingerTimeout.

Specified by:
setSoLingerTimeout in interface TCPIPSocketInfoInterface
Parameters:
soLingerTimeout - The soLingerTimeout to set
Throws:
IOExeption - on i/oerror
java.io.IOException

setSoTimeout

public void setSoTimeout(int soTimeout)
                  throws TCPIPApplicationException,
                         java.io.IOException
Sets the soTimeout.

Specified by:
setSoTimeout in interface TCPIPSocketInfoInterface
Parameters:
soTimeout - The soTimeout to set
Throws:
TCPIPApplicationException - on error
IOExeption - on i/oerror
java.io.IOException

setTcpNoDelay

public void setTcpNoDelay(boolean tcpNoDelay)
                   throws java.io.IOException
Sets the tcpNoDelay.

Specified by:
setTcpNoDelay in interface TCPIPSocketInfoInterface
Parameters:
tcpNoDelay - The tcpNoDelay to set
Throws:
IOExeption - on i/oerror
java.io.IOException

getConnectionID

public java.lang.String getConnectionID()
Returns the connectionID.

Returns:
The connectionID.

setConnectionID

public void setConnectionID(java.lang.String connectionID)
Sets the connectionID.

Parameters:
connectionID - The connectionID to set

getSocketFactoryImplClassName

public java.lang.String getSocketFactoryImplClassName()
Returns the socketFactoryImplClassName.

Specified by:
getSocketFactoryImplClassName in interface TCPIPSocketInfoInterface
Returns:
String

getInitPropertiesInfo

public com.stc.connector.framework.util.ConfigurationHelper getInitPropertiesInfo()
Returns the initial configuration.

Returns:
ConfigurationHelper

isSocketConnected

public boolean isSocketConnected()
Returns the socketConnected.

Returns:
boolean

setSocketConnected

public void setSocketConnected()
Sets the socketConnected to true. This method should be called right after the socket is created.


validate

public void validate()
              throws TCPIPApplicationException
Validates the socket configuration settings.

Throws:
TCPIPApplicationException - on error

isThereAttachedSocket

public boolean isThereAttachedSocket()
Method isThereAttachedSocket.

Returns:
boolean

getAttachedSocket

public java.net.Socket getAttachedSocket()
Returns the attachedSocket.

Returns:
Socket

attachSocket

public void attachSocket(java.net.Socket attachedSocket)
Attach a socket object so the socket options can be refreshed along with socketInfo changes.

Parameters:
attachedSocket - The attachedSocket to set

getClientConnectionEstablishmentInfo

public TCPIPSocketEstablishmentInfoInterface getClientConnectionEstablishmentInfo()
Specified by:
getClientConnectionEstablishmentInfo in interface TCPIPSocketInfoInterface
Returns:
info an instance of TCPIPSocketEstablishmentInfoInterface

setClientConnectionEstablishmentInfo

public void setClientConnectionEstablishmentInfo(TCPIPSocketEstablishmentInfo info)
Parameters:
info - an instance of TCPIPSocketEstablishmentInfo

getServerPortBindingInfo

public TCPIPServerPortBindingInfoInterface getServerPortBindingInfo()
Specified by:
getServerPortBindingInfo in interface TCPIPSocketInfoInterface
Returns:
an instance of TCPIPServerPortBindingInfo

setServerPortBindingInfo

public void setServerPortBindingInfo(TCPIPServerPortBindingInfo info)
Parameters:
info - an instance of TCPIPServerPortBindingInfo

Sun Adapter for TCP/IP HL7