ami
Class AMIServiceProcessor

java.lang.Object
  |
  +--ami.AMIServiceProcessor
All Implemented Interfaces:
Runnable

public class AMIServiceProcessor
extends Object
implements Runnable

Thread used to process incoming AIS ( AMI Input Services )

Singleton

Version:
1.0
Author:
Bertrand Florat

Field Summary
private static AMIServiceProcessor asp
          Self instance used for signleton pattern
static AMISubject asub
          A subject ( see observer pattern )
private static boolean bStop
           
private static String sOutputCode
           
(package private)  Thread t
           
private  Vector vAISPacketBuffer
           
 
Constructor Summary
private AMIServiceProcessor()
          Constructor for the AMIServiceProcessor object
 
Method Summary
private  void addAmiset(Hashtable hAIS)
          Add entry in a set
private  void addAr(Hashtable hAIS)
          used to add an AR into AMI engine buffer If an AR with the same id is already in buffer, we don't do anything
private  void addCleanrt(Hashtable hAIS)
          used to add a RT cleaning request
private  void addEai(Hashtable hAIS)
          used to add an EAI into AMI engine buffer
private  void addProtocol(Hashtable hAIS)
          used to add a new protocol on AMI engine We assume that the description file is correct ( well-formed and contains SYSTEM attribute ) to be added : check description file before registration
private  void addStop()
          Called to process STOP AIS
private  void check(Hashtable hAIS)
          Method used to autenticate the AIS
private  void getAmiparameter(Hashtable hAIS)
          used to get an AMI engine parameter value
private  void getAmiset(Hashtable hAIS)
          Get a set enumeration
private  void getInfopeer(Hashtable hAIS)
          used to get information on a peer
static AMIServiceProcessor getInstance()
          Return a self instance Implementation of the singleton pattern
private  void getIsolated(Hashtable hAIS)
          used to get our isolation flag ( are we alone ?)
static String getOutputCode()
          Returns the sOutputCode.
private  void getProtocolStatus(Hashtable hAIS)
          used to get the status of a protocol (available or not ).
private  boolean isOlderThan(AMIPublicKey apk, int iValue)
          Helper used to determine if a peer DLC is older than the given amount of seconds
private  void notifyObservers(String sCode)
          Helper used to notify obsersers about value change
(package private)  void processAISPacket(Vector vAISPacket)
          Method used to add an AISPacket to list to be processed
(package private) static void refreshArResult(String sArid)
          Called by the AMIInputProcessor to triger that we have a new result for a waited AR
private  void removeAmiset(Hashtable hAIS)
          Remove an entry from a set
private  void removeAr(Hashtable hAIS)
          used to remove an AR from AMI engine buffer
private  void removeProtocol(Hashtable hAIS)
          used to drop a protocol from AMI trusted protocols
private  void replyCode(String sID, String sCode)
          Convenient method used to reply with a code
 void run()
          Main processing method for the AMIServiceProcessor object
private  void setAmiparameter(Hashtable hAIS)
          used to set an AMI engine parameter value
static void setOutputCode(String sOutputCode)
          Sets the sOutputCode.
private  void setProtocolStatus(Hashtable hAIS)
          used to set the status of a protocol (available or not ).
(package private) static void stop()
          Finalize the service processor
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

t

Thread t

vAISPacketBuffer

private Vector vAISPacketBuffer

bStop

private static volatile boolean bStop

sOutputCode

private static String sOutputCode

asub

public static AMISubject asub
A subject ( see observer pattern )

asp

private static AMIServiceProcessor asp
Self instance used for signleton pattern
Constructor Detail

AMIServiceProcessor

private AMIServiceProcessor()
Constructor for the AMIServiceProcessor object
Method Detail

getInstance

public static AMIServiceProcessor getInstance()
Return a self instance

Implementation of the singleton pattern


run

public void run()
Main processing method for the AMIServiceProcessor object
Specified by:
run in interface Runnable

check

private void check(Hashtable hAIS)
            throws AMIException
Method used to autenticate the AIS

processAISPacket

void processAISPacket(Vector vAISPacket)
Method used to add an AISPacket to list to be processed
Parameters:
vAISPacket - Description of Parameter

addAr

private void addAr(Hashtable hAIS)
            throws AMIException
used to add an AR into AMI engine buffer If an AR with the same id is already in buffer, we don't do anything

refreshArResult

static void refreshArResult(String sArid)
Called by the AMIInputProcessor to triger that we have a new result for a waited AR

removeAr

private void removeAr(Hashtable hAIS)
               throws AMIException
used to remove an AR from AMI engine buffer

addEai

private void addEai(Hashtable hAIS)
             throws AMIException
used to add an EAI into AMI engine buffer

getIsolated

private void getIsolated(Hashtable hAIS)
                  throws AMIException
used to get our isolation flag ( are we alone ?)

getAmiparameter

private void getAmiparameter(Hashtable hAIS)
                      throws AMIException
used to get an AMI engine parameter value


setAmiparameter

private void setAmiparameter(Hashtable hAIS)
                      throws AMIException
used to set an AMI engine parameter value

addAmiset

private void addAmiset(Hashtable hAIS)
                throws AMIException
Add entry in a set

removeAmiset

private void removeAmiset(Hashtable hAIS)
                   throws AMIException
Remove an entry from a set

getAmiset

private void getAmiset(Hashtable hAIS)
                throws AMIException
Get a set enumeration

getInfopeer

private void getInfopeer(Hashtable hAIS)
                  throws AMIException
used to get information on a peer

addCleanrt

private void addCleanrt(Hashtable hAIS)
                 throws AMIException
used to add a RT cleaning request

isOlderThan

private boolean isOlderThan(AMIPublicKey apk,
                            int iValue)
Helper used to determine if a peer DLC is older than the given amount of seconds
Parameters:
apk - Peer to be checked
iValue - Period in seconds
Returns:
true if the peer hasn't been checked since ore that iValue seconds

notifyObservers

private void notifyObservers(String sCode)
Helper used to notify obsersers about value change

getProtocolStatus

private void getProtocolStatus(Hashtable hAIS)
                        throws AMIException
used to get the status of a protocol (available or not ). The core protocol ("ami" ) is always available and can't be disabled

setProtocolStatus

private void setProtocolStatus(Hashtable hAIS)
                        throws AMIException
used to set the status of a protocol (available or not ). The core protocol ("ami" ) is always available and can't be disabled

addProtocol

private void addProtocol(Hashtable hAIS)
                  throws AMIException
used to add a new protocol on AMI engine We assume that the description file is correct ( well-formed and contains SYSTEM attribute ) to be added : check description file before registration

removeProtocol

private void removeProtocol(Hashtable hAIS)
                     throws AMIException
used to drop a protocol from AMI trusted protocols

addStop

private void addStop()
              throws AMIException
Called to process STOP AIS

replyCode

private void replyCode(String sID,
                       String sCode)
Convenient method used to reply with a code

stop

static void stop()
Finalize the service processor

getOutputCode

public static String getOutputCode()
Returns the sOutputCode.
Returns:
String

setOutputCode

public static void setOutputCode(String sOutputCode)
Sets the sOutputCode.
Parameters:
sOutputCode - The sOutputCode to set