org.aselect.agent.handler
Class RequestHandler

java.lang.Object
  extended by java.lang.Thread
      extended by org.aselect.agent.handler.RequestHandler
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
TraceRequestHandler

public class RequestHandler
extends java.lang.Thread

Main A-Select Agent API Request handler.

Description:
This class implements the A-Select Agent API for applications.
The A-Select Agent main accept loop spawns an instance of this class for each incoming API request.
This class implements all the communication with the configured A-Select Servers and uses the Session and Ticket managers to perform ticket en session management.

Concurrency issues:
None.

Author:
Alfa & Ariss

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
protected  java.lang.String _sErrorCode
          A-Select error state identifier.
protected  SystemLogger _systemLogger
          Handle to SystemLogger.
 java.lang.String MODULE
          The module name.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
RequestHandler(java.net.Socket oSocket, IClientCommunicator oCommunicator, boolean bAuthorization)
          Initializes instance variables.
 
Method Summary
protected  java.util.Hashtable deserializeAttributes(java.lang.String sSerializedAttributes)
          Deserialize attributes and convertion to a Hashtable.
 IClientCommunicator getClientCommunicator()
          Returns the ClientCommunicator.
protected  void processRequest(Communicator oCommunicator)
          Main API request dispatch method.
 void run()
          Main method for reading the request and processing it.
protected  java.util.Hashtable sendRequestToASelectServer(java.lang.String sUrl, java.util.Hashtable htParamsTable)
          Uses a IClientCommunicator to send a API call to the A-Select server.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MODULE

public java.lang.String MODULE
The module name.


_systemLogger

protected SystemLogger _systemLogger
Handle to SystemLogger.


_sErrorCode

protected java.lang.String _sErrorCode
A-Select error state identifier.

Constructor Detail

RequestHandler

public RequestHandler(java.net.Socket oSocket,
                      IClientCommunicator oCommunicator,
                      boolean bAuthorization)
Initializes instance variables.

Description:
Constructs this object, sets fields and initializes managers.

Concurrency issues:
None.

Preconditions:
None.

Postconditions:
None.

Parameters:
oSocket - socket to read and write to.
oCommunicator - ClientCommunicator to use for communicating with the A-Select Server.
bAuthorization - true if authorization is enabled, otherwise false.
Method Detail

getClientCommunicator

public IClientCommunicator getClientCommunicator()
Returns the ClientCommunicator.

Returns:
A handle to the ClientCommunicator object.

run

public void run()
Main method for reading the request and processing it.

Description:
This method reads the request from the socket with the caller. The request may be one of the supported communication protocols. Once the corresponding protocol is recognized, the API request is deduced and dispatched to processRequest for processing.

Concurrency issues:
None.

Preconditions:
None.

Postconditions:
None.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

processRequest

protected void processRequest(Communicator oCommunicator)
Main API request dispatch method.

Description:
This method dispatches the API request to the approperiate methods.
Currently, the following API requests are supported:
Concurrency issues:
None.

Preconditions:
None.

Postconditions:
None.

Parameters:
oCommunicator - handle to Communicator object for the request.

sendRequestToASelectServer

protected java.util.Hashtable sendRequestToASelectServer(java.lang.String sUrl,
                                                         java.util.Hashtable htParamsTable)
Uses a IClientCommunicator to send a API call to the A-Select server.

Parameters:
sUrl - The A-Select Server URL.
htParamsTable - The parameters to send to A-Select.
Returns:
The return parameters in a Hashtable.

deserializeAttributes

protected java.util.Hashtable deserializeAttributes(java.lang.String sSerializedAttributes)
                                             throws ASelectException
Deserialize attributes and convertion to a Hashtable.

Parameters:
sSerializedAttributes - the serialized attributes.
Returns:
The deserialized attributes (key,value in Hashtable)
Throws:
ASelectException - If URLDecode fails


Copyright © 2008 SURFnet BV. All Rights Reserved.