com.ibm.maf.atp
Class ConnectionHandler

java.lang.Object
  extended byjava.lang.Thread
      extended bycom.ibm.maf.atp.ConnectionHandler
All Implemented Interfaces:
AtpConstants, java.lang.Runnable

final class ConnectionHandler
extends java.lang.Thread
implements AtpConstants

Version:
1.10 $Date: 2001/07/28 06:31:34 $
Author:
Danny D. Langue, Gaku Yamamoto, Mitsuru Oshima

Field Summary
private  Authentication _auth
           
private  boolean _authenticated
           
private  java.net.Socket _connection
           
private  MAFAgentSystem _maf
           
private static java.security.MessageDigest _mdigest
           
private  java.net.ServerSocket _serversocket
           
private static boolean authentication
           
private static int BUFFSIZE
           
private static java.lang.String CRLF
           
(package private)  byte[] future_reply
           
private static java.lang.ThreadGroup group
           
private  java.util.Hashtable headers
           
(package private) static boolean http_messaging
           
(package private) static boolean http_tunneling
           
private static int idle_handlers
           
private static int max_handlers
           
private static java.lang.String MESSAGE_DIGEST_ALGORITHM
          message digest algorithm.
private static int num_handlers
           
private static int number
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Fields inherited from interface com.ibm.atp.AtpConstants
ATCI_REQUEST, ATCI_RESPONSE, AUTHENTICATION_MANNER_DIGEST, AUTHENTICATION_MANNER_SIGNATURE, BAD_GATEWAY, BAD_REQUEST, DISPATCH, EXCEPTION, FETCH, FORBIDDEN, FUTURE, HANDLED, ILLEGAL_REQUEST, INTERNAL_ERROR, MAX_REQUEST_TYPE, MESSAGE, MOVED, NO_AUTHENTICATION_MANNER, NOT_AUTHENTICATED, NOT_FOUND, NOT_HANDLED, NOT_IMPLEMENTED, OKAY, ONEWAY, PING, REPLY, REQUEST_TYPE_BASE, RETRACT, SERVICE_UNAVAILABLE, SYNC
 
Constructor Summary
ConnectionHandler(MAFAgentSystem maf, java.net.ServerSocket s)
           
 
Method Summary
(package private) static byte[] calculateMIC(SharedSecret secret, byte[] agent)
           
private static void dumpBytes(byte[] bytes)
           
private static boolean equalsSeq(byte[] seqa, byte[] seqb)
           
private static byte[] getMIC(AtpRequest request)
           
private  void handle()
           
protected  void handleDispatchRequest(AtpRequest request, AtpResponse response)
          Handles Dispatch Requests
protected  void handleFetchRequest(AtpRequest request, AtpResponse response)
          Handles fetch requests.
protected  void handleMessageRequest(AtpRequest request, AtpResponse response)
           
(package private)  void handleRequest(AtpRequest request, AtpResponse response)
          Handle ATP Requests
protected  void handleRetractRequest(AtpRequest request, AtpResponse response)
          Handles retract requests.
 void run()
           
(package private)  void sendFutureReply(byte[] b)
           
private  void sendHttpResponse()
           
 java.lang.String toString()
           
static void update()
           
private static void verboseOut(java.lang.String msg)
           
(package private) static boolean verifyMIC(byte[] mic, SharedSecret secret, byte[] agent)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MESSAGE_DIGEST_ALGORITHM

private static final java.lang.String MESSAGE_DIGEST_ALGORITHM
message digest algorithm.

See Also:
Constant Field Values

_mdigest

private static java.security.MessageDigest _mdigest

_maf

private MAFAgentSystem _maf

_serversocket

private java.net.ServerSocket _serversocket

_connection

private java.net.Socket _connection

_auth

private Authentication _auth

_authenticated

private boolean _authenticated

group

private static java.lang.ThreadGroup group

BUFFSIZE

private static int BUFFSIZE

number

private static int number

authentication

private static boolean authentication

max_handlers

private static int max_handlers

num_handlers

private static int num_handlers

idle_handlers

private static int idle_handlers

http_tunneling

static boolean http_tunneling

http_messaging

static boolean http_messaging

headers

private java.util.Hashtable headers

future_reply

byte[] future_reply

CRLF

private static final java.lang.String CRLF
See Also:
Constant Field Values
Constructor Detail

ConnectionHandler

public ConnectionHandler(MAFAgentSystem maf,
                         java.net.ServerSocket s)
Method Detail

calculateMIC

static byte[] calculateMIC(SharedSecret secret,
                           byte[] agent)

dumpBytes

private static void dumpBytes(byte[] bytes)

equalsSeq

private static boolean equalsSeq(byte[] seqa,
                                 byte[] seqb)

getMIC

private static byte[] getMIC(AtpRequest request)

handle

private void handle()
             throws java.io.IOException
Throws:
java.io.IOException

handleDispatchRequest

protected void handleDispatchRequest(AtpRequest request,
                                     AtpResponse response)
                              throws java.io.IOException
Handles Dispatch Requests

Throws:
java.io.IOException

handleFetchRequest

protected void handleFetchRequest(AtpRequest request,
                                  AtpResponse response)
                           throws java.io.IOException
Handles fetch requests.

Parameters:
request -
response -
Throws:
java.io.IOException

handleMessageRequest

protected void handleMessageRequest(AtpRequest request,
                                    AtpResponse response)
                             throws java.io.IOException
Throws:
java.io.IOException

handleRequest

void handleRequest(AtpRequest request,
                   AtpResponse response)
             throws java.io.IOException
Handle ATP Requests

Throws:
java.io.IOException

handleRetractRequest

protected void handleRetractRequest(AtpRequest request,
                                    AtpResponse response)
                             throws java.io.IOException
Handles retract requests.

Parameters:
request -
response -
Throws:
java.io.IOException

run

public void run()
Specified by:
run in interface java.lang.Runnable

sendFutureReply

void sendFutureReply(byte[] b)

sendHttpResponse

private void sendHttpResponse()
                       throws java.io.IOException
Throws:
java.io.IOException

toString

public java.lang.String toString()

update

public static void update()

verboseOut

private static void verboseOut(java.lang.String msg)

verifyMIC

static boolean verifyMIC(byte[] mic,
                         SharedSecret secret,
                         byte[] agent)