fipaos.mts.httpMTP
Class HTTPComms

java.lang.Object
  |
  +--fipaos.mts.MTPBase
        |
        +--fipaos.mts.ExternalMTPBase
              |
              +--fipaos.mts.httpMTP.HTTPComms
All Implemented Interfaces:
CallBack, ExternalMTP, PostParserService, Service

public class HTTPComms
extends ExternalMTPBase
implements CallBack


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
HTTPComms(java.lang.String our_name, URL ns_url)
          Comms initialiser
 
Method Summary
protected  void bind()
          Starts the HTTPTransportService using the port information gained from the acc_profile.
 java.util.List getAddresses()
          Method to retreive the protocol dependant addresses of an object that can be used to receive messages.
 java.util.List getProtocols()
          Provides information regarding the Protocol(s) that this MTP can support.
 void incomingCall(Envelope env, byte[] msg)
           
protected  java.lang.Object lookup(java.lang.String name)
          Attempt to lookup a reference to the MTS belonging to the given Agent
protected  java.lang.Object lookup(URL name)
          Lookup a reference to the MTS at the given URL todo this could create an InetAddress object to check the validity of the URL
protected  void send(java.lang.Object target, Envelope env, byte[] msg)
          Invoked to send the given Message to the given target.
 void shutdown()
          Invoked to safely shut down the Comms and to release any resources
protected  void unbind()
          Informs the httpTransport
 
Methods inherited from class fipaos.mts.ExternalMTPBase
handleIncoming, incoming, initialise, main, outgoing
 
Methods inherited from class fipaos.mts.MTPBase
handleIncoming, handleOutgoing, shutdownMTPBase
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTTPComms

public HTTPComms(java.lang.String our_name,
                 URL ns_url)
          throws InitialisationException
Comms initialiser
Parameters:
our_name - The name of the Agent
ns_url - URL for the transport
Method Detail

getAddresses

public java.util.List getAddresses()
Description copied from class: ExternalMTPBase
Method to retreive the protocol dependant addresses of an object that can be used to receive messages.
Overrides:
getAddresses in class ExternalMTPBase
Following copied from class: fipaos.mts.ExternalMTPBase
Returns:
A List containing the required addresses, or null if this Comms doesn't publish such an object

getProtocols

public java.util.List getProtocols()
Provides information regarding the Protocol(s) that this MTP can support.
Overrides:
getProtocols in class ExternalMTPBase
Returns:
List containing the Protocols supported by this transport

shutdown

public void shutdown()
Invoked to safely shut down the Comms and to release any resources
Overrides:
shutdown in class ExternalMTPBase

incomingCall

public void incomingCall(Envelope env,
                         byte[] msg)
Specified by:
incomingCall in interface CallBack

bind

protected void bind()
             throws InitialisationException
Starts the HTTPTransportService using the port information gained from the acc_profile.
Overrides:
bind in class MTPBase

unbind

protected void unbind()
Informs the httpTransport
Overrides:
unbind in class MTPBase

send

protected void send(java.lang.Object target,
                    Envelope env,
                    byte[] msg)
             throws UnknownTargetException,
                    UnknownProtocolException,
                    UnableToSendException
Invoked to send the given Message to the given target. This is called by handleOutgoing() from MTPBase. Creates a SenderThread instance to deal with encoding the contents into the FIPA compliant HTTP header and MIME content. SenderThread also deals with the responding message. Later implementations may do something with this, i.e. log outgoing and incoming information.
Overrides:
send in class ExternalMTPBase

lookup

protected java.lang.Object lookup(URL name)
                           throws UnknownTargetException
Lookup a reference to the MTS at the given URL todo this could create an InetAddress object to check the validity of the URL
Overrides:
lookup in class MTPBase

lookup

protected java.lang.Object lookup(java.lang.String name)
                           throws UnknownTargetException
Attempt to lookup a reference to the MTS belonging to the given Agent
Overrides:
lookup in class MTPBase