com.microfocus.cobol.connector.transport
Class BINPStream

java.lang.Object
  extended bycom.microfocus.cobol.connector.transport.BINPStream
All Implemented Interfaces:
Serializable

public class BINPStream
extends Object
implements Serializable

BINP Stream handler helper class

Copyright: Copyright (c) 2002-2003 Company: Micro Focus International Ltd

See Also:
Serialized Form

Field Summary
static int BF_HHDR_COMPRESS_SYSTEM_GZIP
           
static byte BF_HHDR_DIGEST_MD5
           
static byte BF_HHDR_DIGEST_NONE
           
static byte BF_HHDR_DIGEST_SHA_1
           
static int BF_HHDR_FLAG_COMPRESS
           
static int BF_HHDR_FLAG_DIGEST_INCLUDED
           
static int BF_HHDR_FLAG_KEEPALIVE_FLAGSINCLUDED
           
static int BF_HHDR_FLAG_SERVICE_CLASS_INCLUDED
           
static int BF_HHDR_FLAG_SERVICE_HANDLE_INCLUDED
           
static int BF_HHDR_FLAG_SERVICE_PRIORITY_INCLUDED
           
static int BF_HHDR_FLAG_SESSION_MAN_ACTIVATE
           
static int BF_HHDR_FLAG_SESSION_MAN_INCLUDED
           
static int BF_HHDR_FLAG_SESSION_MAN_PASSIVATE
           
static int BF_HHDR_FLAG_SESSION_MAN_RESERVED
           
static int BF_HHDR_FLAG_SESSIONID_INCLUDED
           
static int BF_HHDR_FLAG_TRACE_FLAGS_INCLUDED
           
static int BF_HHDR_VERSION
           
 
Constructor Summary
BINPStream(InetAddress hostname, int port)
          Construct a BINPStream instance given a hostname, port, no timeout and no sleep interval
BINPStream(InetAddress hostname, int port, long timeout, long sleepInterval)
          Construct a BINPStream instance given a hostname, port, timeout and sleep interval
BINPStream(Socket existingConnection)
          Construct a BINPStream instance given a existing socket
BINPStream(String hostname, int port, long timeout, long sleepInterval, boolean secure, String keystore, String keystorePassword)
          Construct a BINPStream instance given a hostname, port, timeout and sleep interval a keystore and keystorepassword (used for SSL access)
 
Method Summary
 void Activate()
          Activate a remote call
 void close()
          logically close the BINPStream, if keepalive is active and pooling is turned on then we pool the connection and avoid a physical close
static InetAddress getHostAddress(String host)
          get a cached InetAddress
 InetAddress getInetAddress()
          get the inetaddress of the current BINPStream instance
 InputStream getInputStream()
          get the inputstream for the BINPStream
 byte[] getLastMessage()
          Method declaration
static byte[] getMD5Digest(byte[] text)
          get MD5 digest given a byte[]
 OutputStream getOutputStream()
          get the outputstream for the BINPStream
 String getSessionId()
          Method declaration
static byte[] getSHA1Digest(byte[] text)
          get MD5 digest given a byte[]
static long getSocketsClosed()
           
static long getSocketsCreated()
           
static String getSocketStoreDebugInfo()
           
static int getSocketStoreSize()
           
 boolean isKeepConnectionAlive()
          return the keep alive connection status
 boolean isPoolConnection()
          query pool connection status
 boolean isSocketFromSocketStore()
          Method declaration
 void Passivate(boolean prepare)
          Passivate a remote call
 DataInputStream readMessage(DataInputStream physicalDis)
          Method declaration
 void registerBINPAuditor(BINPAuditor auditorInstance)
          Register a BINPAuditor for the BINPStream
 void reOpenClosedConnection()
          Method declaration
 void setCompress(boolean compress)
          Method declaration
 void setCompressionWaterMark(long compressionWaterMark)
          Method declaration
 void setKeepConnectionAlive(boolean keepConnectionAlive)
          set the keepalive connection status
 void setPoolConnection(boolean poolConnection)
          set connection pool status
static void setSocketStoreSize(int newLimit)
           
 void writeMessageBundle(byte digestType, DataOutputStream dos, byte[] message, String guid)
          Method declaration
 byte[] writeMessageBundle(byte digestType, DataOutputStream dos, DataOutputStream physicalDos, ByteArrayOutputStream byteOutputStream, String guid)
          Method declaration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BF_HHDR_VERSION

public static final int BF_HHDR_VERSION
See Also:
Constant Field Values

BF_HHDR_FLAG_DIGEST_INCLUDED

public static final int BF_HHDR_FLAG_DIGEST_INCLUDED
See Also:
Constant Field Values

BF_HHDR_FLAG_SERVICE_HANDLE_INCLUDED

public static final int BF_HHDR_FLAG_SERVICE_HANDLE_INCLUDED
See Also:
Constant Field Values

BF_HHDR_FLAG_SERVICE_CLASS_INCLUDED

public static final int BF_HHDR_FLAG_SERVICE_CLASS_INCLUDED
See Also:
Constant Field Values

BF_HHDR_FLAG_SERVICE_PRIORITY_INCLUDED

public static final int BF_HHDR_FLAG_SERVICE_PRIORITY_INCLUDED
See Also:
Constant Field Values

BF_HHDR_FLAG_TRACE_FLAGS_INCLUDED

public static final int BF_HHDR_FLAG_TRACE_FLAGS_INCLUDED
See Also:
Constant Field Values

BF_HHDR_FLAG_KEEPALIVE_FLAGSINCLUDED

public static final int BF_HHDR_FLAG_KEEPALIVE_FLAGSINCLUDED
See Also:
Constant Field Values

BF_HHDR_FLAG_SESSIONID_INCLUDED

public static final int BF_HHDR_FLAG_SESSIONID_INCLUDED
See Also:
Constant Field Values

BF_HHDR_FLAG_SESSION_MAN_INCLUDED

public static final int BF_HHDR_FLAG_SESSION_MAN_INCLUDED
See Also:
Constant Field Values

BF_HHDR_FLAG_COMPRESS

public static final int BF_HHDR_FLAG_COMPRESS
See Also:
Constant Field Values

BF_HHDR_FLAG_SESSION_MAN_RESERVED

public static final int BF_HHDR_FLAG_SESSION_MAN_RESERVED
See Also:
Constant Field Values

BF_HHDR_FLAG_SESSION_MAN_PASSIVATE

public static final int BF_HHDR_FLAG_SESSION_MAN_PASSIVATE
See Also:
Constant Field Values

BF_HHDR_FLAG_SESSION_MAN_ACTIVATE

public static final int BF_HHDR_FLAG_SESSION_MAN_ACTIVATE
See Also:
Constant Field Values

BF_HHDR_DIGEST_NONE

public static final byte BF_HHDR_DIGEST_NONE
See Also:
Constant Field Values

BF_HHDR_DIGEST_MD5

public static final byte BF_HHDR_DIGEST_MD5
See Also:
Constant Field Values

BF_HHDR_DIGEST_SHA_1

public static final byte BF_HHDR_DIGEST_SHA_1
See Also:
Constant Field Values

BF_HHDR_COMPRESS_SYSTEM_GZIP

public static final int BF_HHDR_COMPRESS_SYSTEM_GZIP
See Also:
Constant Field Values
Constructor Detail

BINPStream

public BINPStream(InetAddress hostname,
                  int port)
           throws BindException,
                  Exception
Construct a BINPStream instance given a hostname, port, no timeout and no sleep interval

Parameters:
hostname -
port -
Throws:
BindException
Exception

BINPStream

public BINPStream(InetAddress hostname,
                  int port,
                  long timeout,
                  long sleepInterval)
           throws BindException,
                  Exception
Construct a BINPStream instance given a hostname, port, timeout and sleep interval

Parameters:
hostname -
port -
timeout -
sleepInterval -
Throws:
BindException
Exception

BINPStream

public BINPStream(String hostname,
                  int port,
                  long timeout,
                  long sleepInterval,
                  boolean secure,
                  String keystore,
                  String keystorePassword)
           throws BindException,
                  Exception
Construct a BINPStream instance given a hostname, port, timeout and sleep interval a keystore and keystorepassword (used for SSL access)

Parameters:
hostname -
port -
timeout -
sleepInterval -
Throws:
BindException
Exception

BINPStream

public BINPStream(Socket existingConnection)
Construct a BINPStream instance given a existing socket

Parameters:
existingConnection -
Method Detail

getInputStream

public InputStream getInputStream()
                           throws IOException
get the inputstream for the BINPStream

Returns:
a InputStream
Throws:
IOException

getInetAddress

public InetAddress getInetAddress()
get the inetaddress of the current BINPStream instance

Returns:
a InetAddress

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
get the outputstream for the BINPStream

Returns:
a OutputStream
Throws:
IOException

close

public void close()
           throws IOException
logically close the BINPStream, if keepalive is active and pooling is turned on then we pool the connection and avoid a physical close

Throws:
IOException

readMessage

public DataInputStream readMessage(DataInputStream physicalDis)
                            throws IOException
Method declaration

Parameters:
physicalDis -
Returns:
Throws:
IOException

writeMessageBundle

public byte[] writeMessageBundle(byte digestType,
                                 DataOutputStream dos,
                                 DataOutputStream physicalDos,
                                 ByteArrayOutputStream byteOutputStream,
                                 String guid)
                          throws IOException
Method declaration

Parameters:
digestType -
dos -
physicalDos -
byteOutputStream -
guid -
Throws:
IOException

writeMessageBundle

public void writeMessageBundle(byte digestType,
                               DataOutputStream dos,
                               byte[] message,
                               String guid)
                        throws IOException
Method declaration

Parameters:
digestType -
dos -
message -
guid -
Throws:
IOException

registerBINPAuditor

public void registerBINPAuditor(BINPAuditor auditorInstance)
Register a BINPAuditor for the BINPStream

Parameters:
auditorInstance -

getMD5Digest

public static byte[] getMD5Digest(byte[] text)
get MD5 digest given a byte[]

Parameters:
text -
Returns:
a byte[]

getSHA1Digest

public static byte[] getSHA1Digest(byte[] text)
get MD5 digest given a byte[]

Parameters:
text -
Returns:
a byte[]

getHostAddress

public static InetAddress getHostAddress(String host)
                                  throws UnknownHostException
get a cached InetAddress

Parameters:
host - String hostname
Returns:
InetAddress of the host
Throws:
UnknownHostException

isKeepConnectionAlive

public boolean isKeepConnectionAlive()
return the keep alive connection status

Returns:
a boolean

setKeepConnectionAlive

public void setKeepConnectionAlive(boolean keepConnectionAlive)
set the keepalive connection status

Parameters:
keepConnectionAlive - a boolean

isPoolConnection

public boolean isPoolConnection()
query pool connection status

Returns:
a boolean

setPoolConnection

public void setPoolConnection(boolean poolConnection)
set connection pool status

Parameters:
poolConnection - a boolean

getSessionId

public String getSessionId()
Method declaration

Returns:

getLastMessage

public byte[] getLastMessage()
Method declaration

Returns:

Activate

public void Activate()
              throws IOException
Activate a remote call

Throws:
IOException

Passivate

public void Passivate(boolean prepare)
Passivate a remote call


isSocketFromSocketStore

public boolean isSocketFromSocketStore()
Method declaration

Returns:

reOpenClosedConnection

public void reOpenClosedConnection()
                            throws IOException
Method declaration

Throws:
IOException

setCompress

public void setCompress(boolean compress)
Method declaration

Parameters:
compress -

setCompressionWaterMark

public void setCompressionWaterMark(long compressionWaterMark)
Method declaration

Parameters:
compressionWaterMark -

getSocketStoreSize

public static int getSocketStoreSize()

setSocketStoreSize

public static void setSocketStoreSize(int newLimit)

getSocketStoreDebugInfo

public static String getSocketStoreDebugInfo()

getSocketsCreated

public static long getSocketsCreated()

getSocketsClosed

public static long getSocketsClosed()



Copyright © 2000 Micro Focus International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.