disciple.connections
Class TcpConnectionFactory

java.lang.Object
  |
  +--disciple.connections.TcpConnectionFactory
All Implemented Interfaces:
ConnectionFactory

public class TcpConnectionFactory
extends java.lang.Object
implements ConnectionFactory

Factory to create TcpConnection's.

Default environment variables are:

host remote host address
port remote host port number
priority.levels priority levels of outgoing commands (default=3)

Copyright (c) 2003 Rutgers, The State University of New Jersey

Since:
Disciple v3.0

Constructor Summary
TcpConnectionFactory()
           
TcpConnectionFactory(java.util.Hashtable env)
           
TcpConnectionFactory(java.lang.String host, int port)
           
 
Method Summary
 java.lang.Object addToEnvironment(java.lang.String propName, java.lang.Object propVal)
           
 Connection createConnection()
          Creates a connection with the default user identity.
 Connection createConnection(java.lang.String name, java.lang.String password)
          Creates a connection with the specified user identity.
protected  java.net.Socket createSocket()
          Creates a socket connection to the remote server.
 java.util.Hashtable getEnvironment()
           
 int getProperty(java.lang.String name, int defaultValue)
          Convenience method to get int properties from the environment.
 java.lang.Object removeFromEnvironment(java.lang.String propName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TcpConnectionFactory

public TcpConnectionFactory()
Since:
Disciple v3.0
Rose:
3D08E679037D

TcpConnectionFactory

public TcpConnectionFactory(java.util.Hashtable env)
Since:
Disciple v3.0

TcpConnectionFactory

public TcpConnectionFactory(java.lang.String host,
                            int port)
Since:
Disciple v3.0
Method Detail

createConnection

public Connection createConnection()
                            throws java.lang.Exception
Description copied from interface: ConnectionFactory
Creates a connection with the default user identity.

Specified by:
createConnection in interface ConnectionFactory
Returns:
Connection
Throws:
java.lang.Exception
Since:
Disciple v3.0
Rose:
3D08E6790391

createConnection

public Connection createConnection(java.lang.String name,
                                   java.lang.String password)
                            throws java.lang.Exception
Description copied from interface: ConnectionFactory
Creates a connection with the specified user identity.

Specified by:
createConnection in interface ConnectionFactory
Parameters:
name -
password -
Returns:
Connection
Throws:
java.lang.Exception
Since:
Disciple v3.0
Rose:
3D08E67903AF

addToEnvironment

public java.lang.Object addToEnvironment(java.lang.String propName,
                                         java.lang.Object propVal)
Specified by:
addToEnvironment in interface ConnectionFactory
Parameters:
propName -
propVal -
Returns:
Object
Since:
Disciple v3.0

removeFromEnvironment

public java.lang.Object removeFromEnvironment(java.lang.String propName)
Specified by:
removeFromEnvironment in interface ConnectionFactory
Parameters:
propName -
Returns:
Object
Since:
Disciple v3.0

getEnvironment

public java.util.Hashtable getEnvironment()
Specified by:
getEnvironment in interface ConnectionFactory
Returns:
Hashtable
Since:
Disciple v3.0

getProperty

public int getProperty(java.lang.String name,
                       int defaultValue)
Convenience method to get int properties from the environment.


createSocket

protected java.net.Socket createSocket()
                                throws java.io.IOException
Creates a socket connection to the remote server.

Returns:
Socket the socket connection if established, else null
Throws:
java.io.IOException - if connection could not be established


Copyright (c) 2003 Rutgers, The State University of New Jersey