javax.jbi.messaging
Interface MessageExchange

All Known Subinterfaces:
InOnly, InOptionalOut, InOut, RobustInOnly

public interface MessageExchange

MessageExchange represents a container for normalized messages which are described by an exchange pattern. The exchange pattern defines the names, sequence, and cardinality of messages in an exchange.

Author:
JSR208 Expert Group

Nested Class Summary
static class MessageExchange.Role
          Typesafe enum containing the roles a component can play in a service.
 
Field Summary
static java.lang.String JTA_TRANSACTION_PROPERTY_NAME
          JTA transaction context property name.
 
Method Summary
 Fault createFault()
          Generic factory method for Fault objects.
 NormalizedMessage createMessage()
          Creates a normalized message based on the specified message reference.
 ServiceEndpoint getEndpoint()
          Retrieves the endpoint used by this exchange.
 java.lang.Exception getError()
          Retrieves the Exception describing the exchanges error status.
 java.lang.String getExchangeId()
          Returns the unique identifier assigned by the NMS for this exchange.
 Fault getFault()
          Retrieves the fault message for this exchange, if one exists.
 javax.xml.namespace.QName getInterfaceName()
          Retrieves the interface name used by this exchange.
 NormalizedMessage getMessage(java.lang.String name)
          Retrieves a normalized message based on the specified message reference.
 javax.xml.namespace.QName getOperation()
          Retrieves the operation used by this exchange.
 java.net.URI getPattern()
          Returns the URI of the pattern for this exchange.
 java.lang.Object getProperty(java.lang.String name)
          Retrieves the specified property from the exchange.
 java.util.Set getPropertyNames()
          Returns the name of all properties for this exchange.
 MessageExchange.Role getRole()
          Queries the role that the caller plays in the exchange.
 javax.xml.namespace.QName getService()
          Retrieves the service used by this exchange.
 ExchangeStatus getStatus()
          Returns the processing status of the exchange.
 boolean isTransacted()
          Queries the existence of a transaction context.
 void setEndpoint(ServiceEndpoint endpoint)
          Specifies the endpoint used by this exchange.
 void setError(java.lang.Exception error)
          Used to specify the source of a failure status.
 void setFault(Fault fault)
          Specifies the fault message for this exchange, if one exists.
 void setInterfaceName(javax.xml.namespace.QName interfaceName)
          Specifies the interface name used by this exchange.
 void setMessage(NormalizedMessage msg, java.lang.String name)
          Sets a normalized message with the specified message reference.
 void setOperation(javax.xml.namespace.QName name)
          Specifies the operation used by this exchange.
 void setProperty(java.lang.String name, java.lang.Object obj)
          Specifies a property for the exchange.
 void setService(javax.xml.namespace.QName service)
          Specifies the service used by this exchange.
 void setStatus(ExchangeStatus status)
          Sets the processing status of the exchange.
 

Field Detail

JTA_TRANSACTION_PROPERTY_NAME

public static final java.lang.String JTA_TRANSACTION_PROPERTY_NAME
JTA transaction context property name.

See Also:
Constant Field Values
Method Detail

getPattern

public java.net.URI getPattern()
Returns the URI of the pattern for this exchange.

Returns:
pattern URI for this exchange

getExchangeId

public java.lang.String getExchangeId()
Returns the unique identifier assigned by the NMS for this exchange.

Returns:
unique id for this exchange

getStatus

public ExchangeStatus getStatus()
Returns the processing status of the exchange.

Returns:
status of the exchange

setStatus

public void setStatus(ExchangeStatus status)
               throws MessagingException
Sets the processing status of the exchange.

Parameters:
status - exchange status
Throws:
MessagingException - failed to set status, possibly due to an invalid state transition.

setError

public void setError(java.lang.Exception error)
Used to specify the source of a failure status. Invoking this method automatically adjusts the status of the ME to ExchangeStatus.ERROR.

Parameters:
error - error cause

getError

public java.lang.Exception getError()
Retrieves the Exception describing the exchanges error status.

Returns:
exception associated with this exchange

getFault

public Fault getFault()
Retrieves the fault message for this exchange, if one exists. A fault/message reference is unnecessary, since an exchange can carry at most one fault, and it is always the final message in an exchange.

Returns:
fault associated with the exchange, or null if not present

setFault

public void setFault(Fault fault)
              throws MessagingException
Specifies the fault message for this exchange, if one exists. A fault/message reference is unnecessary, since an exchange can carry at most one fault, and it is always the final message in an exchange.

Parameters:
fault - fault
Throws:
MessagingException - operation not permitted in the current exchange state

createMessage

public NormalizedMessage createMessage()
                                throws MessagingException
Creates a normalized message based on the specified message reference. The pattern governing this exchange must contain a definition for the reference name supplied.

Returns:
a new normalized message
Throws:
MessagingException - failed to create message

createFault

public Fault createFault()
                  throws MessagingException
Generic factory method for Fault objects.

Returns:
a new fault
Throws:
MessagingException - failed to create fault

getMessage

public NormalizedMessage getMessage(java.lang.String name)
Retrieves a normalized message based on the specified message reference.

Parameters:
name - message reference
Returns:
message with the specified reference name

setMessage

public void setMessage(NormalizedMessage msg,
                       java.lang.String name)
                throws MessagingException
Sets a normalized message with the specified message reference. The pattern governing this exchange must contain a definition for the reference name supplied.

Parameters:
msg - normalized message
name - message reference
Throws:
MessagingException - operation not permitted in the current exchange state

getProperty

public java.lang.Object getProperty(java.lang.String name)
Retrieves the specified property from the exchange.

Parameters:
name - property name
Returns:
property value

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object obj)
Specifies a property for the exchange.

Parameters:
name - property name
obj - property value

setEndpoint

public void setEndpoint(ServiceEndpoint endpoint)
Specifies the endpoint used by this exchange.

Parameters:
endpoint - endpoint address

setService

public void setService(javax.xml.namespace.QName service)
Specifies the service used by this exchange.

Parameters:
service - service address

setInterfaceName

public void setInterfaceName(javax.xml.namespace.QName interfaceName)
Specifies the interface name used by this exchange.

Parameters:
interfaceName - interface name

setOperation

public void setOperation(javax.xml.namespace.QName name)
Specifies the operation used by this exchange.

Parameters:
name - operation name

getEndpoint

public ServiceEndpoint getEndpoint()
Retrieves the endpoint used by this exchange.

Returns:
endpoint address for this message exchange

getInterfaceName

public javax.xml.namespace.QName getInterfaceName()
Retrieves the interface name used by this exchange.

Returns:
interface used for this message exchange

getService

public javax.xml.namespace.QName getService()
Retrieves the service used by this exchange.

Returns:
service address for this message exchange

getOperation

public javax.xml.namespace.QName getOperation()
Retrieves the operation used by this exchange.

Returns:
operation name for this message exchange

isTransacted

public boolean isTransacted()
Queries the existence of a transaction context.

Returns:
boolean transactional state of the exchange

getRole

public MessageExchange.Role getRole()
Queries the role that the caller plays in the exchange.

Returns:
Role expected of caller.

getPropertyNames

public java.util.Set getPropertyNames()
Returns the name of all properties for this exchange.

Returns:
a set of all the property names, as Strings.

Built 06/07/2005 11:16 AM on acer (SunOS 5.9)

Copyright (c) 2004-2005 Sun Microsystems Inc., All Rights Reserved.