ie.nuigalway.ecrg.jade.jmsmtp.common
Class MessageTransportProtocol

java.lang.Object
  |
  +--ie.nuigalway.ecrg.jade.jmsmtp.common.MessageTransportProtocol
All Implemented Interfaces:
JMSMTP

public class MessageTransportProtocol
extends java.lang.Object
implements JMSMTP


Field Summary
private static org.apache.log4j.Category log
           
private static java.util.HashMap providerManagers
           
 
Constructor Summary
MessageTransportProtocol()
           
 
Method Summary
 jade.mtp.TransportAddress activate(jade.mtp.InChannel.Dispatcher disp)
          Activate a default Address
 jade.mtp.TransportAddress activate(jade.mtp.InChannel.Dispatcher disp, jade.core.Profile p)
          Activate a default Address
 void activate(jade.mtp.InChannel.Dispatcher disp, jade.mtp.TransportAddress ta)
          Activate a specific TransportAddress
 void activate(jade.mtp.InChannel.Dispatcher disp, jade.mtp.TransportAddress ta, jade.core.Profile p)
          Activate a specific TransportAddress
 java.lang.String addrToStr(jade.mtp.TransportAddress ta)
          Given a TransportAddress convert it to a string
private  void closeProviderManagers()
          Close all connections in the hashmap
 void deactivate()
          Deactivate the MTP
 void deactivate(jade.mtp.TransportAddress ta)
          Deactivate a specific address
 void deliver(java.lang.String addr, jade.domain.FIPAAgentManagement.Envelope env, byte[] payload)
          Deliver a message to a jmsTA
 java.lang.String getName()
          Return the name of this MTP
 JmsProviderManager getProviderManager(JMSAddress jmsTA)
          Used to create a new broker connection or to retrive one from the hashmap
 java.lang.String[] getSupportedProtocols()
          Get prtocols supported by this MTP
private  void setupProviderManager(JMSAddress jmsTA)
          Create a QueueConnection to a specified broker and place it in the hashmap
 jade.mtp.TransportAddress strToAddr(java.lang.String rep)
          Converts a string to a JMS Transport address
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.log4j.Category log

providerManagers

private static java.util.HashMap providerManagers
Constructor Detail

MessageTransportProtocol

public MessageTransportProtocol()
Method Detail

activate

public jade.mtp.TransportAddress activate(jade.mtp.InChannel.Dispatcher disp,
                                          jade.core.Profile p)
                                   throws jade.mtp.MTPException
Activate a default Address

Specified by:
activate in interface JMSMTP
Parameters:
disp - Passed messages to the platform
p - Description of the Parameter
Returns:
Trnasport Address for the address activated
Throws:
jade.mtp.MTPException - Error during address activation

activate

public jade.mtp.TransportAddress activate(jade.mtp.InChannel.Dispatcher disp)
                                   throws jade.mtp.MTPException
Activate a default Address

Specified by:
activate in interface JMSMTP
Parameters:
disp - Passed messages to the platform
Returns:
Trnasport Address for the address activated
Throws:
jade.mtp.MTPException - Error during address activation

activate

public void activate(jade.mtp.InChannel.Dispatcher disp,
                     jade.mtp.TransportAddress ta,
                     jade.core.Profile p)
              throws jade.mtp.MTPException
Activate a specific TransportAddress

Specified by:
activate in interface JMSMTP
Parameters:
disp - Used to pass messages to the platform
ta - Address to activate
p - is the Profile from which the configuration parameters for this instance of JADE container can be retrieved
Throws:
jade.mtp.MTPException - Error during address activation

activate

public void activate(jade.mtp.InChannel.Dispatcher disp,
                     jade.mtp.TransportAddress ta)
              throws jade.mtp.MTPException
Activate a specific TransportAddress

Specified by:
activate in interface JMSMTP
Parameters:
disp - Used to pass messages to the platform
ta - Address to activate
Throws:
jade.mtp.MTPException - Error during address activation

deactivate

public void deactivate(jade.mtp.TransportAddress ta)
                throws jade.mtp.MTPException
Deactivate a specific address

Specified by:
deactivate in interface JMSMTP
Parameters:
ta - Address to deactivate
Throws:
jade.mtp.MTPException - Error during address deactivation

deactivate

public void deactivate()
                throws jade.mtp.MTPException
Deactivate the MTP

Specified by:
deactivate in interface JMSMTP
Throws:
jade.mtp.MTPException - Error with MTP deactivation

deliver

public void deliver(java.lang.String addr,
                    jade.domain.FIPAAgentManagement.Envelope env,
                    byte[] payload)
             throws jade.mtp.MTPException
Deliver a message to a jmsTA

Specified by:
deliver in interface JMSMTP
Parameters:
addr - Address to deliver too
env - Envelope of message
payload - Message payload
Throws:
jade.mtp.MTPException - Error during message send

getProviderManager

public JmsProviderManager getProviderManager(JMSAddress jmsTA)
                                      throws java.lang.Exception
Used to create a new broker connection or to retrive one from the hashmap

Parameters:
jmsTA - Address of the Broker
Returns:
QueueConnection A QueueConnection object for the broker in jmsTA
Throws:
java.lang.Exception - Error during manager creation

setupProviderManager

private void setupProviderManager(JMSAddress jmsTA)
                           throws jade.mtp.MTPException
Create a QueueConnection to a specified broker and place it in the hashmap

Parameters:
jmsTA - Contains details of the broker
Throws:
jade.mtp.MTPException - Description of the Exception
java.lang.Exception - Error during provider setup

closeProviderManagers

private void closeProviderManagers()
Close all connections in the hashmap


strToAddr

public jade.mtp.TransportAddress strToAddr(java.lang.String rep)
                                    throws jade.mtp.MTPException
Converts a string to a JMS Transport address

Specified by:
strToAddr in interface JMSMTP
Parameters:
rep - Contains the address as a string
Returns:
TransportAddress The address as a JMS Transport Address
Throws:
jade.mtp.MTPException - Error in Address conversion

addrToStr

public java.lang.String addrToStr(jade.mtp.TransportAddress ta)
                           throws jade.mtp.MTPException
Given a TransportAddress convert it to a string

Specified by:
addrToStr in interface JMSMTP
Parameters:
ta - The Address as a TransportAddress object
Returns:
String Address as a string
Throws:
jade.mtp.MTPException - Error in Address conversion

getName

public java.lang.String getName()
Return the name of this MTP

Specified by:
getName in interface JMSMTP
Returns:
MTP Name

getSupportedProtocols

public java.lang.String[] getSupportedProtocols()
Get prtocols supported by this MTP

Specified by:
getSupportedProtocols in interface JMSMTP
Returns:
The Protocols supported by this MTP