com.ibm.jtopenlite
Class HostServerConnection

java.lang.Object
  extended by com.ibm.jtopenlite.HostServerConnection
All Implemented Interfaces:
Connection
Direct Known Subclasses:
CommandConnection, DatabaseConnection, DDMConnection, FileConnection, SignonConnection

public abstract class HostServerConnection
extends Object
implements Connection

Represents a TCP/IP socket connection to an IBM i Host Server job. All HostServerConnections have associated system information provided via the SystemInfo class.


Nested Class Summary
protected static class HostServerConnection.HostInputStream
           
protected static class HostServerConnection.HostOutputStream
           
 
Field Summary
protected  HostServerConnection.HostInputStream in_
           
protected  HostServerConnection.HostOutputStream out_
           
 
Constructor Summary
protected HostServerConnection(SystemInfo info, String user, String jobName, Socket socket, HostServerConnection.HostInputStream in, HostServerConnection.HostOutputStream out)
           
 
Method Summary
 void close()
          Sends an "end job" datastream (if supported) and closes the underlying socket.
protected static String connect(SystemInfo info, HostServerConnection.HostOutputStream dout, HostServerConnection.HostInputStream din, int serverID, String user, String password)
           
protected  void finalize()
           
protected static byte[] getEncryptedPassword(byte[] userBytes, byte[] passwordBytes, byte[] clientSeed, byte[] serverSeed, int passwordLevel)
           
 SystemInfo getInfo()
          Returns the system information associated with this connection.
 String getJobName()
          Returns the host server job string for the job that is connected to this connection.
 String getUser()
          Returns the currently authenticated user of this connection.
 boolean isClosed()
          Returns true if close() has been called on this connection.
 boolean isDatastreamDebug()
          Returns true if datastream debugging is currently enabled.
static boolean isDefaultDatastreamDebug()
          Returns true if debugging is enabled by default for all HostServerConnection datastreams.
protected abstract  void sendEndJobRequest()
           
 void setDatastreamDebug(boolean debug)
          If debug is true, enables datastream debugging for this connection.
protected static void writePadEBCDIC(String s, int len, HostServerConnection.HostOutputStream out)
           
protected static void writePadEBCDIC10(String s, HostServerConnection.HostOutputStream out)
           
protected static void writeStringToUnicodeBytes(String s, HostServerConnection.HostOutputStream out)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

in_

protected final HostServerConnection.HostInputStream in_

out_

protected final HostServerConnection.HostOutputStream out_
Constructor Detail

HostServerConnection

protected HostServerConnection(SystemInfo info,
                               String user,
                               String jobName,
                               Socket socket,
                               HostServerConnection.HostInputStream in,
                               HostServerConnection.HostOutputStream out)
Method Detail

isDefaultDatastreamDebug

public static boolean isDefaultDatastreamDebug()
Returns true if debugging is enabled by default for all HostServerConnection datastreams.


isDatastreamDebug

public boolean isDatastreamDebug()
Returns true if datastream debugging is currently enabled.


setDatastreamDebug

public void setDatastreamDebug(boolean debug)
If debug is true, enables datastream debugging for this connection.


close

public final void close()
                 throws IOException
Sends an "end job" datastream (if supported) and closes the underlying socket.

Specified by:
close in interface Connection
Throws:
IOException

sendEndJobRequest

protected abstract void sendEndJobRequest()
                                   throws IOException
Throws:
IOException

finalize

protected final void finalize()
                       throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

isClosed

public final boolean isClosed()
Returns true if close() has been called on this connection.

Specified by:
isClosed in interface Connection

getInfo

public final SystemInfo getInfo()
Returns the system information associated with this connection.


getUser

public final String getUser()
Returns the currently authenticated user of this connection.

Specified by:
getUser in interface Connection

getJobName

public final String getJobName()
Returns the host server job string for the job that is connected to this connection.

Specified by:
getJobName in interface Connection

getEncryptedPassword

protected static byte[] getEncryptedPassword(byte[] userBytes,
                                             byte[] passwordBytes,
                                             byte[] clientSeed,
                                             byte[] serverSeed,
                                             int passwordLevel)
                                      throws IOException
Throws:
IOException

connect

protected static String connect(SystemInfo info,
                                HostServerConnection.HostOutputStream dout,
                                HostServerConnection.HostInputStream din,
                                int serverID,
                                String user,
                                String password)
                         throws IOException
Throws:
IOException

writePadEBCDIC10

protected static void writePadEBCDIC10(String s,
                                       HostServerConnection.HostOutputStream out)
                                throws IOException
Throws:
IOException

writePadEBCDIC

protected static void writePadEBCDIC(String s,
                                     int len,
                                     HostServerConnection.HostOutputStream out)
                              throws IOException
Throws:
IOException

writeStringToUnicodeBytes

protected static void writeStringToUnicodeBytes(String s,
                                                HostServerConnection.HostOutputStream out)
                                         throws IOException
Throws:
IOException