org.aselect.system.communication.client.raw
Class RawCommunicator

java.lang.Object
  extended by org.aselect.system.communication.client.raw.RawCommunicator
All Implemented Interfaces:
IClientCommunicator

public class RawCommunicator
extends java.lang.Object
implements IClientCommunicator

Client communicator which uses CGI messages.

Description:
The Raw communicator used by the A-Select agent to create, retrieve, and send URL encoded CGI messages.

Author:
Alfa & Ariss

Constructor Summary
RawCommunicator(SystemLogger systemLogger)
          Creates a new RawCommunicator.
 
Method Summary
 java.util.Hashtable convertCGIMessage(java.lang.String sMessage)
          Convert a CGI message string into a Hashtable.
 java.util.Hashtable sendMessage(java.util.Hashtable parameters, java.lang.String target)
          Sends a raw api call to the A-Select Server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RawCommunicator

public RawCommunicator(SystemLogger systemLogger)
Creates a new RawCommunicator.

Preconditions:
systemLogger should be initialized.

Postconditions:
_systemLogger is set with systemLogger.

Parameters:
systemLogger - the logger to log system information.
Method Detail

sendMessage

public java.util.Hashtable sendMessage(java.util.Hashtable parameters,
                                       java.lang.String target)
                                throws ASelectCommunicationException
Sends a raw api call to the A-Select Server.

Description:
Executes the following steps:

Specified by:
sendMessage in interface IClientCommunicator
Parameters:
parameters - The API call request parameters (Hashtable with name/value pairs)
target - A String containing the target URL
Returns:
The response parameters of the API call in a Hashtable
Throws:
ASelectCommunicationException - If sending fails.
See Also:
IClientCommunicator.sendMessage(java.util.Hashtable, java.lang.String)

convertCGIMessage

public java.util.Hashtable convertCGIMessage(java.lang.String sMessage)
                                      throws java.io.UnsupportedEncodingException
Convert a CGI message string into a Hashtable.

Description:
This method will convert a CGI request string ( key=value&key=value etc. ) into a hashtable for much easier processing.
The Hashtable will contain: Note: The key names are all converted to lowercase.

Concurrency issues:
The returned Hashtableis synchronized.

Preconditions:
sMessage must contain a valid CGI message.

Postconditions:
The returned Hashtable contains all the key/value pairs of the CGI message.

Parameters:
sMessage - The CGI message to be converted.
Returns:
A Hashtable containing the parameters from the CGI message
Throws:
java.io.UnsupportedEncodingException - If URL decoding fails.


Copyright © 2008 SURFnet BV. All Rights Reserved.