fipaos.mts
Class ExternalMTPBase

java.lang.Object
  |
  +--fipaos.mts.MTPBase
        |
        +--fipaos.mts.ExternalMTPBase
All Implemented Interfaces:
ExternalMTP, PostParserService, Service
Direct Known Subclasses:
HTTPComms, SUNIIOPComms

public abstract class ExternalMTPBase
extends MTPBase
implements ExternalMTP

Provides a basic implementation of a MTP, based upon the MTPBase object and implementing the ExternalMTP interface


Fields inherited from class fipaos.mts.MTPBase
_hap, _name, _ns_url, _shutdown, ACC_NAME
 
Fields inherited from interface fipaos.mts.service.Service
ACL_LANGUAGE_UNKNOWN, CONTENT_LANGUAGE_UNKNOWN, ERROR_STRING, ERROR_UNKNOWN, FIPAOS_DEBUG, FIPAOS_MSG_ID_SLOT, MALFORMED_ENVELOPE, MSG_DELIVERY_FAILURE_REASON, NONE, PROTOCOL_UNKNOWN, TARGET_UNKNOWN
 
Constructor Summary
protected ExternalMTPBase(java.lang.String name, URL ns)
          Initialises the MTP variables (i.e.
 
Method Summary
abstract  java.util.List getAddresses()
          Method to retreive the protocol dependant addresses of an object that can be used to receive messages.
abstract  java.util.List getProtocols()
          Retreives the protocols known by this comms implementation
protected  void handleIncoming(Envelope env, byte[] msg)
          Should be invoked by underlying MTP implementation when a message is received
 void incoming(Envelope env, byte[] msg)
          Incoming messages are passed to this via this method
 void initialise(PostParserService previous, PostParserService next)
          Invoked when the undelying implementation should initialise itself.
static void main(java.lang.String[] args)
           
 void outgoing(Envelope env, byte[] msg)
          Outgoing messages are passed to this via this method
protected abstract  void send(java.lang.Object target, Envelope env, byte[] msg)
          Invoked to send the given Message to the given target
abstract  void shutdown()
          This should be invoked when the service should be safely shutdown
 
Methods inherited from class fipaos.mts.MTPBase
bind, handleIncoming, handleOutgoing, lookup, lookup, shutdownMTPBase, unbind
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExternalMTPBase

protected ExternalMTPBase(java.lang.String name,
                          URL ns)
                   throws InitialisationException
Initialises the MTP variables (i.e. _hap, __name & _ns_url), and then invokes bind()
Method Detail

initialise

public void initialise(PostParserService previous,
                       PostParserService next)
Invoked when the undelying implementation should initialise itself. Allows references to other PreParserService's before and after it in the stack to be passed
Specified by:
initialise in interface PostParserService
Parameters:
previous - Previous PreParserService instance (Incoming messages should be passed to this)
next - Next PreParserService instance (Outgoing messages should be passed to this)

outgoing

public final void outgoing(Envelope env,
                           byte[] msg)
Outgoing messages are passed to this via this method
Specified by:
outgoing in interface PostParserService
Parameters:
msg - Outgoing message

incoming

public final void incoming(Envelope env,
                           byte[] msg)
Incoming messages are passed to this via this method
Specified by:
incoming in interface PostParserService
Parameters:
msg - Incoming message

handleIncoming

protected final void handleIncoming(Envelope env,
                                    byte[] msg)
Should be invoked by underlying MTP implementation when a message is received

getAddresses

public abstract java.util.List getAddresses()
Method to retreive the protocol dependant addresses of an object that can be used to receive messages.
Specified by:
getAddresses in interface ExternalMTP
Returns:
A List containing the required addresses, or null if this Comms doesn't publish such an object

getProtocols

public abstract java.util.List getProtocols()
Retreives the protocols known by this comms implementation
Specified by:
getProtocols in interface ExternalMTP
Overrides:
getProtocols in class MTPBase
Returns:
A List of String's

shutdown

public abstract void shutdown()
This should be invoked when the service should be safely shutdown
Specified by:
shutdown in interface Service

send

protected abstract void send(java.lang.Object target,
                             Envelope env,
                             byte[] msg)
                      throws UnknownTargetException,
                             UnknownProtocolException,
                             UnableToSendException
Invoked to send the given Message to the given target

main

public static void main(java.lang.String[] args)
                 throws java.lang.Throwable