nl.west.aaa
Class AAAUnit

java.lang.Object
  |
  +--nl.west.aaa.MessageHandlerContainer
        |
        +--nl.west.aaa.AAAUnit

public class AAAUnit
extends MessageHandlerContainer

A AAAUnit is a class used for transporting AAA messages between different clients/servers. Messages are sent useing a RecordFormat and a TransportProtocol.


Fields inherited from class nl.west.aaa.MessageHandlerContainer
messageHandlers
 
Constructor Summary
AAAUnit(Identifier id)
          Construct a new AAAUnit with the given Identifier.
 
Method Summary
 void addMessageHandler(MessageHandler handler)
          Register the MessageHandler as a handler of incoming messages.
 void addRecordFormat(RecordFormat rf)
          Adds the given RecordFormat to the list of available RecordFormats.
 void addTransportProtocol(TransportProtocol prot)
          Add the given TransportProtocol to the list of supported protocols.
 void handleIncoming(byte[] data, Identifier from, TransportProtocol prot)
          Process incoming connections.
 void handleIncoming(java.io.InputStream in, Identifier from, TransportProtocol prot)
          Process incoming connections.
 boolean handleMessage(Message msg, AAAUnit unit)
          Handle an incoming message.
 void removeMessageHandler(MessageHandler handler)
          Remove the given MessageHandler from the list of registered MessageHandlers.
 void removeRecordFormat(RecordFormat rf)
          Remove the given RecordFormat from the list of available RecordFormats.
 void removeTransportProtocol(TransportProtocol prot)
          Remove the given TransportProtocol from the list of available TransportProtocols.
 void sendMessage(Message msg, Identifier to)
          Send a message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AAAUnit

public AAAUnit(Identifier id)
Construct a new AAAUnit with the given Identifier.
Method Detail

handleIncoming

public void handleIncoming(java.io.InputStream in,
                           Identifier from,
                           TransportProtocol prot)
Process incoming connections. This method is called by a TransportProtocol when incoming data is available from a connection. It reads messages from the stream and passes it to the registered handlers. This method only returns when the stream is closed.

handleIncoming

public void handleIncoming(byte[] data,
                           Identifier from,
                           TransportProtocol prot)
Process incoming connections. This method is called by a TransportProtocol when incoming data is available from a connection. Only one message may be present in the data.

handleMessage

public boolean handleMessage(Message msg,
                             AAAUnit unit)
Handle an incoming message. All incoming messages are passed to the registered MessageHandlers.
Overrides:
handleMessage in class MessageHandlerContainer

sendMessage

public void sendMessage(Message msg,
                        Identifier to)
                 throws java.io.IOException
Send a message. A Message may have a RecordFormat and/or TransportProtocol defined. If a RecordFormat or TransportProtocol is defined it is used (even if it is not registered). If no RecordFormat or TransportProtocol is defined the defaults are used.
Note that when sending a message with a non-registered TransportProtocol no replies sent by that TransportProtocol will be read.

addTransportProtocol

public void addTransportProtocol(TransportProtocol prot)
Add the given TransportProtocol to the list of supported protocols. This unit will be registered for processing incoming connections for the given TransportProtocol. The first added protocol will be the default for sending.

removeTransportProtocol

public void removeTransportProtocol(TransportProtocol prot)
Remove the given TransportProtocol from the list of available TransportProtocols. Incoming connections on the TransportProtocol will no longer be handled from this protocol. Existing connections will not be terminated.

addRecordFormat

public void addRecordFormat(RecordFormat rf)
Adds the given RecordFormat to the list of available RecordFormats. The first entry will be the default.

removeRecordFormat

public void removeRecordFormat(RecordFormat rf)
Remove the given RecordFormat from the list of available RecordFormats.

addMessageHandler

public void addMessageHandler(MessageHandler handler)
Register the MessageHandler as a handler of incoming messages. All incoming messages are fed through the registered MessageHandlers.
Overrides:
addMessageHandler in class MessageHandlerContainer

removeMessageHandler

public void removeMessageHandler(MessageHandler handler)
Remove the given MessageHandler from the list of registered MessageHandlers.
Overrides:
removeMessageHandler in class MessageHandlerContainer



Arthur <arthur@ch.twi.tudelft.nl> http://ch.twi.tudelft.nl/~arthur/
2002-05-27