kaos.core.csi.transport
Class TransportSupportImpl

java.lang.Object
  extended by kaos.core.csi.transport.TransportSupportImpl
All Implemented Interfaces:
TransportSupport

public class TransportSupportImpl
extends java.lang.Object
implements TransportSupport

Defines the operations to bind an antity, whose Locator is given to the specified transport and to send messages via a given transport.


Method Summary
 void bindMsgListenerToTransport(MessageListener listener, java.lang.String listenerName, Locator locator, java.lang.String transportName)
          Bind the specified MessageListener to the given Locator.
 MessageReceiver bindToTransport(java.lang.String receiverName, Locator receiverLocator, java.lang.String transportName)
          Bind entity, whose name and Locator are given to the transport, whose name is specified.
 Locator createLocator(java.lang.String name, JasBean agentInitInfo, java.lang.String transportName)
           
static TransportSupport getInstance()
          Retrieve an instance of Registration.
 KAoSServiceRoot getServiceRoot(java.lang.String transportName)
          Return KAoSServiceRoot for the specified transportName.
 java.util.List getSupportedTransportsNames()
          Return the names of the currently supported transports.
 boolean isTransportSupported(java.lang.String name)
          Answer true if the given transport is supported, otherwise, answer false.
protected  void logMessage(java.lang.String msg, java.lang.Exception e, int logLevel)
           
protected  void logMessage(java.lang.String msg, int logLevel)
           
 void sendMessageTo(Locator senderLocator, Locator receiverLocator, java.lang.String senderName, java.lang.String receiverName, java.lang.String fipaPerformative, java.io.Serializable content)
          Send the given message content to the receiver, whose Locator is given.
 void sendMessageTo(Locator senderLocator, Locator receiverLocator, java.lang.String senderName, java.lang.String receiverName, java.lang.String fipaPerformative, java.io.Serializable content, java.lang.String transportName)
          Send the given message content to the receiver, whose Locator is given.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static TransportSupport getInstance()
Retrieve an instance of Registration.

Parameters:
transportName - String specifying the name of the transport to use for communication with the KAoS Directory Service.
Returns:
a singleton, Registration.

createLocator

public Locator createLocator(java.lang.String name,
                             JasBean agentInitInfo,
                             java.lang.String transportName)
Specified by:
createLocator in interface TransportSupport

bindMsgListenerToTransport

public void bindMsgListenerToTransport(MessageListener listener,
                                       java.lang.String listenerName,
                                       Locator locator,
                                       java.lang.String transportName)
                                throws NotLocatableException,
                                       TransportFailure
Bind the specified MessageListener to the given Locator.

Specified by:
bindMsgListenerToTransport in interface TransportSupport
Parameters:
listener - MessageListener to receive messages using the given Locator.
locator - Locator to be used to receive messages.
transportName - String indicating which transport to use
listenerName - String containing the name of the receiver.
Throws:
NotLocatableException - if locator is not a local locator.
TransportFailure - if the binding process fails

bindToTransport

public MessageReceiver bindToTransport(java.lang.String receiverName,
                                       Locator receiverLocator,
                                       java.lang.String transportName)
                                throws NotLocatableException,
                                       TransportFailure
Bind entity, whose name and Locator are given to the transport, whose name is specified. As a result of binding, the entity will receive the MessageReceiver in order to get messages from it (MessageReceiver.getMessage()), as opposed to listening for messages via the MessageListener interface.

Specified by:
bindToTransport in interface TransportSupport
Parameters:
receiverName - String containing the name of the entity binding to transport.
locator - Locator to be used to bind to a MessageReceiver.
transportName - String indicating which transport to use
Returns:
a MessageReceiver, from which to retrieve messages.
Throws:
NotLocatableException - if locator is not a local locator.
TransportFailure - if the binding process fails

sendMessageTo

public void sendMessageTo(Locator senderLocator,
                          Locator receiverLocator,
                          java.lang.String senderName,
                          java.lang.String receiverName,
                          java.lang.String fipaPerformative,
                          java.io.Serializable content,
                          java.lang.String transportName)
                   throws NotLocatableException,
                          TransportFailure
Send the given message content to the receiver, whose Locator is given.

Specified by:
sendMessageTo in interface TransportSupport
Parameters:
senderLocator - Locator of the sender.
receiverLocator - Locator of the receiver.
senderName - String containing the name of the sender.
receiverName - String containing the name of the receiver.
fipaPerformative - String containing the FIPA performative describing the message intent.
content - Serializable containing the message content.
transportName - String containing the name of the transport to be used.
Throws:
NotLocatableException - if the receiver cannot be located.
TransportFailure - if transport fails during message send.

sendMessageTo

public void sendMessageTo(Locator senderLocator,
                          Locator receiverLocator,
                          java.lang.String senderName,
                          java.lang.String receiverName,
                          java.lang.String fipaPerformative,
                          java.io.Serializable content)
                   throws NotLocatableException,
                          TransportFailure
Send the given message content to the receiver, whose Locator is given.

Specified by:
sendMessageTo in interface TransportSupport
Parameters:
senderLocator - Locator of the sender.
receiverLocator - Locator of the receiver.
senderName - String containing the name of the sender.
receiverName - String containing the name of the receiver.
fipaPerformative - String containing the FIPA performative describing the message intent.
content - Serializable containing the message content.
Throws:
NotLocatableException - if the receiver cannot be located.
TransportFailure - if transport fails during message send.

getSupportedTransportsNames

public java.util.List getSupportedTransportsNames()
Return the names of the currently supported transports.

Specified by:
getSupportedTransportsNames in interface TransportSupport
Returns:
a List containing Strings representing names of supported transports.

isTransportSupported

public boolean isTransportSupported(java.lang.String name)
Answer true if the given transport is supported, otherwise, answer false.

Specified by:
isTransportSupported in interface TransportSupport
Parameters:
name - String containing the name of the transport in question.
Returns:
a boolean indicating if the given transport is supported.

getServiceRoot

public KAoSServiceRoot getServiceRoot(java.lang.String transportName)
Return KAoSServiceRoot for the specified transportName.

Specified by:
getServiceRoot in interface TransportSupport
Parameters:
transportName - String containing the name of the transport to create a KAoSServiceRoot for.
Returns:
a KAoSServiceRoot specific for the transportName.

logMessage

protected void logMessage(java.lang.String msg,
                          int logLevel)

logMessage

protected void logMessage(java.lang.String msg,
                          java.lang.Exception e,
                          int logLevel)