Package jade.mtp.http
Class MessageTransportProtocol
- java.lang.Object
-
- jade.mtp.http.MessageTransportProtocol
-
- All Implemented Interfaces:
InChannel,MTP,OutChannel
public class MessageTransportProtocol extends Object implements MTP
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jade.mtp.InChannel
InChannel.Dispatcher
-
-
Constructor Summary
Constructors Constructor Description MessageTransportProtocol()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TransportAddressactivate(InChannel.Dispatcher disp)Old method, only for compliance with former versions (prior 3.0)TransportAddressactivate(InChannel.Dispatcher disp, Profile p)Activates an MTP handler for incoming messages on a default address.voidactivate(InChannel.Dispatcher disp, TransportAddress ta)voidactivate(InChannel.Dispatcher disp, TransportAddress ta, Profile p)Actual method to activate the HTTP MTP.StringaddrToStr(TransportAddress ta)Converts aTransportAddressobject into a string representation.voiddeactivate()Deactivates all the MTP handlers.voiddeactivate(TransportAddress ta)Deactivates the MTP handler listening at a given transport address.voiddeliver(String addr, Envelope env, byte[] payload)OutChannel Interface Methods *StringgetName()Reads the name of the message transport protocol managed by this MTP.String[]getSupportedProtocols()TransportAddressstrToAddr(String rep)MTP Interface Methods
-
-
-
Method Detail
-
strToAddr
public TransportAddress strToAddr(String rep) throws MTPException
MTP Interface Methods- Specified by:
strToAddrin interfaceMTP- Parameters:
rep- The string representation of the address.- Returns:
- A
TransportAddressobject, created from the given string. - Throws:
MTPException- If the given string is not a valid address according to this MTP.
-
addrToStr
public String addrToStr(TransportAddress ta) throws MTPException
Description copied from interface:MTPConverts aTransportAddressobject into a string representation.- Specified by:
addrToStrin interfaceMTP- Parameters:
ta- TheTransportAddressobject.- Returns:
- A string representing the given address.
- Throws:
MTPException- If the givenTransportAddressis not a valid address for this MTP.
-
getName
public String getName()
Description copied from interface:MTPReads the name of the message transport protocol managed by this MTP. The FIPA standard message transport protocols have a name starting with"fipa.mts.mtp".
-
getSupportedProtocols
public String[] getSupportedProtocols()
- Specified by:
getSupportedProtocolsin interfaceMTP
-
activate
public TransportAddress activate(InChannel.Dispatcher disp) throws MTPException
Old method, only for compliance with former versions (prior 3.0)- Throws:
MTPException
-
activate
public void activate(InChannel.Dispatcher disp, TransportAddress ta) throws MTPException
- Throws:
MTPException
-
activate
public TransportAddress activate(InChannel.Dispatcher disp, Profile p) throws MTPException
Description copied from interface:InChannelActivates an MTP handler for incoming messages on a default address.- Specified by:
activatein interfaceInChannel- Returns:
- A
TransportAddress, corresponding to the chosen default address. - Throws:
MTPException- Thrown if some MTP initialization error occurs.
-
activate
public void activate(InChannel.Dispatcher disp, TransportAddress ta, Profile p) throws MTPException
Actual method to activate the HTTP MTP. Customizable parameters read from profile:- port: the port this HTTP server listens to.
- numKeepAlive: Maximum number of keep-alive connections. Default value is 10. Set to 0 to disable keep-alive coonections (possible performance impact).
- proxyHost: Proxy host name or IP-address. No default value.
- proxyPort: Default value is 1080.
- outPort: Fix port to be used by HTTP client (for firewall configuration). Default value is freely chosen by Java
- parser: XML SAX2 parser implementation to use. Default value is JDK 1.4 default parser.
- policy: "conservative" (default value) or "aggressive". (see documentation for details).
- timeout: Timeout for keep-alive connections. Default value is 1 min. 0 means infinite.
- Specified by:
activatein interfaceInChannelta- ATransportAddressobject, representing the transport address to listen to.- Throws:
MTPException- Thrown if some MTP initialization error occurs.
-
deactivate
public void deactivate(TransportAddress ta) throws MTPException
Description copied from interface:InChannelDeactivates the MTP handler listening at a given transport address.- Specified by:
deactivatein interfaceInChannel- Parameters:
ta- TheTransportAddressobject the handle to close is listening to.- Throws:
MTPException- Thrown if some MTP cleanup error occurs.
-
deactivate
public void deactivate() throws MTPExceptionDescription copied from interface:InChannelDeactivates all the MTP handlers.- Specified by:
deactivatein interfaceInChannel- Throws:
MTPException- Thrown if some MTP cleanup error occurs.
-
deliver
public void deliver(String addr, Envelope env, byte[] payload) throws MTPException
OutChannel Interface Methods *- Specified by:
deliverin interfaceOutChannelenv- The message envelope, containing various fields related to message recipients, encoding, and timestamping.- Throws:
MTPException- Thrown if some MTP delivery error occurs.
-
-