ABLE 2.0.0 07/02/2003 10:25:01

com.ibm.able.conversation
Class AbleJasMessageSystemAdapter

java.lang.Object
  |
  +--com.ibm.able.conversation.AbleJasMessageSystemAdapter
All Implemented Interfaces:
MessageSystemAdapter

public class AbleJasMessageSystemAdapter
extends java.lang.Object
implements MessageSystemAdapter

The AbleJasMessageSystemAdapter class is a MessageSystemAdapter that uses Java Agent Services (JAS) messaging.

It also contains a reference to an AbleBean--its putative owner--which it uses for logging and trace-logging.

In order for this MessageSystemAdapter to work, it must be initialized with a working JAS transport service.

See Also:
MessageTransportService

Field Summary
static java.lang.String RECEIVER_CONVERSATION_ID_KEY
          Key under which the sender of a message stores the recipient's conversation ID in the message's header.
static java.lang.String SENDER_CONVERSATION_ID_KEY
          Key under which the sender of a message stores its own conversation ID in the message's header.
 
Constructor Summary
AbleJasMessageSystemAdapter()
          Constructs an AbleJasMessageSystemAdapter with null instance variables.
AbleJasMessageSystemAdapter(AbleBean newOwner)
          Constructs an AbleJasMessageSystemAdapter with the given bean as owner.
AbleJasMessageSystemAdapter(AbleBean newOwner, javax.agent.service.transport.MessageTransportService newTransport)
          Constructs an AbleJasMessageSystemAdapter.
 
Method Summary
 MessageHandle createMessage()
          Creates and returns an instance of a message of the type that can be delivered by this MessageSystemAdapter.
protected  javax.agent.TransportMessage createTransportMessage(ConversationMetaData metaData, MessageHandle mh)
          Creates a TransportMessage out of the given MetaData and MessageHandle.
 javax.agent.service.transport.MessageTransportService getTransportService()
          Returns the MessageTransportService used in delivering messages.
protected  void initEnvelope(JasConversationMetaData jasMetaData, org.jagent.acr.AcrEnvelope envelope)
          Initializes a message's envelope.
protected  void logException(java.lang.String theMethodName, java.lang.Exception theException)
          Logs an exception with the AbleBean that "owns" this MessageSystemAdapter.
static MessageHandle makeMessageHandle(javax.agent.TransportMessage msg)
          Converts a TransportMessage (created by the JAS subsystem) into a MessageHandle.
static java.lang.String parseConversationId(javax.agent.TransportMessage msg)
          Extracts the recipient's conversation ID from the given message's header.
 void sendMessage(Conversation conv, MessageHandle mh)
          Undertakes to deliver the given message.
 void setLogOwner(AbleBean newOwner)
          Sets the AbleBean that "owns" this MessageSystemAdapter--i.e., the bean to use for logging and trace-logging.
 void setTransportService(javax.agent.service.transport.MessageTransportService svc)
          Sets the MessageTransportService used in delivering messages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SENDER_CONVERSATION_ID_KEY

public static final java.lang.String SENDER_CONVERSATION_ID_KEY
Key under which the sender of a message stores its own conversation ID in the message's header.

RECEIVER_CONVERSATION_ID_KEY

public static final java.lang.String RECEIVER_CONVERSATION_ID_KEY
Key under which the sender of a message stores the recipient's conversation ID in the message's header.
Constructor Detail

AbleJasMessageSystemAdapter

public AbleJasMessageSystemAdapter()
Constructs an AbleJasMessageSystemAdapter with null instance variables.

The transport service must be set (via setTransportService()) before this MessageSystemAdapter can be used.


AbleJasMessageSystemAdapter

public AbleJasMessageSystemAdapter(AbleBean newOwner)
Constructs an AbleJasMessageSystemAdapter with the given bean as owner.

The transport service must be set (via setTransportService()) before this MessageSystemAdapter can be used.

Parameters:
newOwner - The AbleBean that "owns" this MessageSystemAdapter.

AbleJasMessageSystemAdapter

public AbleJasMessageSystemAdapter(AbleBean newOwner,
                                   javax.agent.service.transport.MessageTransportService newTransport)
Constructs an AbleJasMessageSystemAdapter.
Parameters:
newOwner - The AbleBean that "owns" this MessageSystemAdapter.
newTransport - The MessageTransportService to use in delivering messages.
Method Detail

getTransportService

public javax.agent.service.transport.MessageTransportService getTransportService()
Returns the MessageTransportService used in delivering messages.
Returns:
The MessageTransportService used in delivering messages.

setTransportService

public void setTransportService(javax.agent.service.transport.MessageTransportService svc)
Sets the MessageTransportService used in delivering messages.
Parameters:
svc - The MessageTransportService to use in delivering messages.

setLogOwner

public void setLogOwner(AbleBean newOwner)
Sets the AbleBean that "owns" this MessageSystemAdapter--i.e., the bean to use for logging and trace-logging.
Parameters:
newOwner - The bean that "owns" this MessageSystemAdapter.

parseConversationId

public static java.lang.String parseConversationId(javax.agent.TransportMessage msg)
Extracts the recipient's conversation ID from the given message's header.
Parameters:
TransportMessage - msg the message from which to extract the conversation id.
Returns:
The recipient's conversation ID, or null if none found.

makeMessageHandle

public static MessageHandle makeMessageHandle(javax.agent.TransportMessage msg)
Converts a TransportMessage (created by the JAS subsystem) into a MessageHandle.

For JAS-based messaging, the MessageHandle contains the payload. So this extracts the payload and copies it into the MessageHandle.

Parameters:
msg - The TransportMessage to be converted.
Returns:
The MessageHandle into which the message was converted.

createMessage

public MessageHandle createMessage()
Description copied from interface: MessageSystemAdapter
Creates and returns an instance of a message of the type that can be delivered by this MessageSystemAdapter. The message's contents are not filled in.
Specified by:
createMessage in interface MessageSystemAdapter
Following copied from interface: com.ibm.conversation.MessageSystemAdapter
Returns:
A MessageHandle contaioning the newly created message.

sendMessage

public void sendMessage(Conversation conv,
                        MessageHandle mh)
Description copied from interface: MessageSystemAdapter
Undertakes to deliver the given message.

Specified by:
sendMessage in interface MessageSystemAdapter
Following copied from interface: com.ibm.conversation.MessageSystemAdapter
Parameters:
conv - The Conversation associated with this message.
mh - The message to be delivered.

createTransportMessage

protected javax.agent.TransportMessage createTransportMessage(ConversationMetaData metaData,
                                                              MessageHandle mh)
Creates a TransportMessage out of the given MetaData and MessageHandle.

In JAS-based messaging, the MessageHandle contains a Payload. So this creates a new TransportMessage and puts the Payload into it. Also initializes the message envelope, so that the TransportMessage is ready for delivery..

Parameters:
metaData - The ConversationMetaData for the conversation this message is a part of.
mh - The message to convert into a TransportMessage
Returns:
The TransportMessage converted from the input args, ready for delivery.

initEnvelope

protected void initEnvelope(JasConversationMetaData jasMetaData,
                            org.jagent.acr.AcrEnvelope envelope)
Initializes a message's envelope.

Called by createTransportMessage(). Fills in the message's header: Adds sender & recipient conversation IDs, locators and names.


logException

protected void logException(java.lang.String theMethodName,
                            java.lang.Exception theException)
Logs an exception with the AbleBean that "owns" this MessageSystemAdapter.

If the owner is null, does nothing.

Parameters:
theMethodName - The name of the method in which the exception occurred.
theException - The exception to log.

ABLE 2.0.0 07/02/2003 10:25:01

(C) Copyright IBM Corporation 1999, 2003