org.ow2.petals.component.framework.api.message
Interface Exchange


public interface Exchange

The MessageExchange wrapper to handle properly MessageExchange against the CDK.

Since:
1.0
Author:
rnaudin - EBM WebSourcing, chamerling - EBM WebSourcing

Field Summary
static QName DEFAULT_FAULT_QNAME
           
static String FAULT_MESSAGE_NAME
           
static String IN_MESSAGE_NAME
           
static String OUT_MESSAGE_NAME
           
static String PROPERTY_PROVIDER_LINKTYPE
           
 
Method Summary
 void addInMessageAttachment(String name, DataHandler dataHandler)
          Set In message Attachment.
 void addOutMessageAttachment(String name, DataHandler dataHandler)
          Set Out message Attachment.
 javax.jbi.messaging.Fault createFault()
           
 javax.jbi.servicedesc.ServiceEndpoint getEndpoint()
           
 String getEndpointName()
          Get the endpoint name specified in the message exchange
 Exception getError()
           
 String getExchangeId()
           
 URI getExchangePattern()
          Get the message exchange Pattern
 javax.jbi.messaging.Fault getFault()
          get the exchange fault.
 Map<QName,String> getInAddressing()
          Get the addressing data from the IN message.
 javax.jbi.messaging.NormalizedMessage getInMessage()
          Extract incoming NormalizedMessage from given MessageExchange.
 DataHandler getInMessageAttachment(String name)
          Get the "In" attachment matching the given name.
 Set<String> getInMessageAttachmentNames()
          Get all the "In" attachment names.
 Set<DataHandler> getInMessageAttachments()
          Get "In" attachments in a Set.
 Document getInMessageContentAsDocument()
          Get the content of the "in" message as a DOM document.
 Document getInMessageContentAsDocument(boolean forkSource)
          Get the content of the "in" message as a DOM document.
 Source getInMessageContentAsSource()
          Get the content of the "in" message as a Source
 Object getInMessageProperty(String name)
           
 Set<String> getInMessagePropertyNames()
           
 Subject getInSubject()
          Get "In" security subject
 QName getInterfaceName()
           
 QName getOperation()
           
 String getOperationName()
          Get the operation name (local part of the operation QName)
 javax.jbi.messaging.NormalizedMessage getOutMessage()
          Extract outgoing NormalizedMessage from given MessageExchange.
 DataHandler getOutMessageAttachment(String name)
          Get the "Out" attachment matching the attachment name.
 Set<String> getOutMessageAttachmentNames()
          Get all the "Out" attachment names.
 Set<DataHandler> getOutMessageAttachments()
          Get all the "Out" attachments in a Set.
 Document getOutMessageContentAsDocument()
          Get the content of the "out" message as a DOM document.
 Document getOutMessageContentAsDocument(boolean forkSource)
          Get the content of the "out" message as a DOM document.
 Source getOutMessageContentAsSource()
          Get the content of the "out" message as a Source
 Object getOutMessageProperty(String name)
           
 Set<?> getOutMessagePropertyNames()
           
 Subject getOutSubject()
          Get "Out" security subject
 URI getPattern()
           
 Object getProperty(String name)
           
 Set<?> getPropertyNames()
           
 javax.jbi.messaging.MessageExchange.Role getRole()
           
 QName getService()
           
 javax.jbi.messaging.ExchangeStatus getStatus()
           
 boolean isActiveStatus()
          Test if the message status is ACTIVE
 boolean isConsumerRole()
           
 boolean isDoneStatus()
          Test if the message status is DONE
 boolean isErrorStatus()
          Test if the message status is ERROR
 boolean isInMessage()
          True if an In message is set on the MessageExchange false otherwise
 boolean isInOnlyPattern()
           
 boolean isInOptionalOutPattern()
           
 boolean isInOutPattern()
           
 boolean isOutMessage()
          True if an Out message is set on the MessageExchange false otherwise
 boolean isProviderRole()
           
 boolean isRobustInOnlyPattern()
           
 boolean isTransacted()
           
 void setActiveStatus()
          Set the message exchange status to ACTIVE
 void setDoneStatus()
          Set the message exchange status to DONE
 void setEndpoint(javax.jbi.servicedesc.ServiceEndpoint endpoint)
           
 void setError(Exception error)
          Put the given exception as Error part of the message exchange.
 void setErrorStatus()
          Set the message exchange status to Error
 void setFault(javax.jbi.messaging.Fault fault)
           
 void setFault(Throwable e)
          Create a Fault with the given Exception and set it in the MessageExchange
 void setInAddressing(Map<QName,String> map)
          Set the addressing information in the IN message.
 void setInMessage(javax.jbi.messaging.NormalizedMessage msg)
          Set the input message
 void setInMessageAttachment(String name, DataHandler attachement)
          Put the attachment in the "out" message.
 void setInMessageAttachments(Map<String,DataHandler> attachements)
          Put a Map of attachments in the out message of the message exchange.
 void setInMessageContent(Document inContent)
          Put a Source object in the in message of the message exchange.
 void setInMessageContent(InputStream inContent)
          Put a String object in the in message of the message exchange.
 void setInMessageContent(Source inContent)
          Put a Source object in the in message of the message exchange.
 void setInMessageProperties(Map<String,Object> properties)
           
 void setInMessageProperty(String name, Object value)
           
 void setInSubject(Subject subject)
          Set "In" security subject.
 void setInterfaceName(QName interfaceName)
          Set the target interface name to invoke the service
 void setOperation(QName name)
          Set the message operation
 void setOutMessage(javax.jbi.messaging.NormalizedMessage msg)
          Set the output message
 void setOutMessageAttachment(String name, DataHandler attachment)
          Put the attachment in the "out" message.
 void setOutMessageAttachments(Map<String,DataHandler> attachements)
          Put a Map of attachments in the "out" message.
 void setOutMessageContent(Document outContent)
          Put a Source object in the out message of the message exchange.
 void setOutMessageContent(InputStream inContent)
          Put a String object in the in message of the message exchange.
 void setOutMessageContent(Source outContent)
          Put a Source object in the out message of the message exchange.
 void setOutMessageProperties(Map<String,Object> properties)
           
 void setOutMessageProperty(String name, Object value)
           
 void setOutSubject(Subject subject)
          Set Out security subject.
 void setProperty(String name, Object obj)
           
 void setService(QName service)
           
 void setStatus(javax.jbi.messaging.ExchangeStatus status)
           
 

Field Detail

DEFAULT_FAULT_QNAME

static final QName DEFAULT_FAULT_QNAME

FAULT_MESSAGE_NAME

static final String FAULT_MESSAGE_NAME
See Also:
Constant Field Values

IN_MESSAGE_NAME

static final String IN_MESSAGE_NAME
See Also:
Constant Field Values

OUT_MESSAGE_NAME

static final String OUT_MESSAGE_NAME
See Also:
Constant Field Values

PROPERTY_PROVIDER_LINKTYPE

static final String PROPERTY_PROVIDER_LINKTYPE
See Also:
Constant Field Values
Method Detail

addInMessageAttachment

void addInMessageAttachment(String name,
                            DataHandler dataHandler)
                            throws javax.jbi.messaging.MessagingException
Set In message Attachment.

Parameters:
name -
dataHandler -
Throws:
javax.jbi.messaging.MessagingException

addOutMessageAttachment

void addOutMessageAttachment(String name,
                             DataHandler dataHandler)
                             throws javax.jbi.messaging.MessagingException
Set Out message Attachment.

Parameters:
name -
dataHandler -
Throws:
javax.jbi.messaging.MessagingException

createFault

javax.jbi.messaging.Fault createFault()
                                      throws javax.jbi.messaging.MessagingException
Returns:
Throws:
javax.jbi.messaging.MessagingException

getEndpoint

javax.jbi.servicedesc.ServiceEndpoint getEndpoint()
Returns:

getEndpointName

String getEndpointName()
                       throws javax.jbi.messaging.MessagingException
Get the endpoint name specified in the message exchange

Returns:
the endpoint name
Throws:
javax.jbi.messaging.MessagingException - if no Endpoint is set

getError

Exception getError()
Returns:

getExchangeId

String getExchangeId()
Returns:

getExchangePattern

URI getExchangePattern()
                       throws javax.jbi.messaging.MessagingException
Get the message exchange Pattern

Returns:
the URI pattern. Can't be null
Throws:
javax.jbi.messaging.MessagingException - if no message exchange pattern is set

getFault

javax.jbi.messaging.Fault getFault()
get the exchange fault.

Returns:

getInAddressing

Map<QName,String> getInAddressing()
Get the addressing data from the IN message. Key is the addressing name (Values are available in Constants.Addressing), value is the URL as String...

Returns:
null if there is no addressing information in the input message

getInMessage

javax.jbi.messaging.NormalizedMessage getInMessage()
Extract incoming NormalizedMessage from given MessageExchange. Create the message if it is null.

Returns:
the incoming NormalizedMessage

getInMessageAttachment

DataHandler getInMessageAttachment(String name)
                                   throws javax.jbi.messaging.MessagingException
Get the "In" attachment matching the given name.

Parameters:
exchange -
Returns:
Throws:
javax.jbi.messaging.MessagingException

getInMessageAttachmentNames

Set<String> getInMessageAttachmentNames()
                                        throws javax.jbi.messaging.MessagingException
Get all the "In" attachment names.

Returns:
Throws:
javax.jbi.messaging.MessagingException

getInMessageAttachments

Set<DataHandler> getInMessageAttachments()
                                         throws javax.jbi.messaging.MessagingException
Get "In" attachments in a Set.

Parameters:
exchange -
Returns:
Throws:
javax.jbi.messaging.MessagingException

getInMessageContentAsDocument

Document getInMessageContentAsDocument()
                                       throws javax.jbi.messaging.MessagingException
Get the content of the "in" message as a DOM document.
If the Source is a Stream or Document, a fork is processed, which makes the Source still available, but can decreases the performance.

Returns:
the DOM document representation of the "in" message content
Throws:
javax.jbi.messaging.MessagingException - if error occurred during conversion of the Source or if "in" message is null

getInMessageContentAsDocument

Document getInMessageContentAsDocument(boolean forkSource)
                                       throws javax.jbi.messaging.MessagingException
Get the content of the "in" message as a DOM document.
If the Source is a Stream or Document and forkSource is true, a fork is processed, which makes the Source still available, but can decreases the performance.

Returns:
the DOM document representation of the "in" message content
Throws:
javax.jbi.messaging.MessagingException - if error occurred during conversion of the Source or if "in" message is null

getInMessageContentAsSource

Source getInMessageContentAsSource()
                                   throws javax.jbi.messaging.MessagingException
Get the content of the "in" message as a Source

Returns:
the "in" message content
Throws:
javax.jbi.messaging.MessagingException - if "in" message is null

getInMessageProperty

Object getInMessageProperty(String name)
                            throws javax.jbi.messaging.MessagingException
Parameters:
name -
Returns:
Throws:
javax.jbi.messaging.MessagingException

getInMessagePropertyNames

Set<String> getInMessagePropertyNames()
                                      throws javax.jbi.messaging.MessagingException
Returns:
Throws:
javax.jbi.messaging.MessagingException

getInSubject

Subject getInSubject()
                     throws javax.jbi.messaging.MessagingException
Get "In" security subject

Returns:
the subject or null if no subject
Throws:
javax.jbi.messaging.MessagingException

getInterfaceName

QName getInterfaceName()
Returns:

getOperation

QName getOperation()
Returns:

getOperationName

String getOperationName()
Get the operation name (local part of the operation QName)

Returns:
the operation name, NULL if no operation is set

getOutMessage

javax.jbi.messaging.NormalizedMessage getOutMessage()
Extract outgoing NormalizedMessage from given MessageExchange. Create the output message if message is null.

Returns:
the outgoing NormalizedMessage

getOutMessageAttachment

DataHandler getOutMessageAttachment(String name)
                                    throws javax.jbi.messaging.MessagingException
Get the "Out" attachment matching the attachment name.

Parameters:
exchange -
Returns:
Throws:
javax.jbi.messaging.MessagingException

getOutMessageAttachmentNames

Set<String> getOutMessageAttachmentNames()
                                         throws javax.jbi.messaging.MessagingException
Get all the "Out" attachment names.

Returns:
Throws:
javax.jbi.messaging.MessagingException

getOutMessageAttachments

Set<DataHandler> getOutMessageAttachments()
                                          throws javax.jbi.messaging.MessagingException
Get all the "Out" attachments in a Set.

Parameters:
exchange -
Returns:
Throws:
javax.jbi.messaging.MessagingException

getOutMessageContentAsDocument

Document getOutMessageContentAsDocument()
                                        throws javax.jbi.messaging.MessagingException
Get the content of the "out" message as a DOM document.
If the Source is a Stream or Document, a fork is processed, which makes the Source still available, but can decreases the performance.

Returns:
the DOM document representation of the "in" message content
Throws:
javax.jbi.messaging.MessagingException - if error occurred during conversion of the Source or if "in" message is null

getOutMessageContentAsDocument

Document getOutMessageContentAsDocument(boolean forkSource)
                                        throws javax.jbi.messaging.MessagingException
Get the content of the "out" message as a DOM document.
If the Source is a Stream or Document and forkSource is true, a fork is processed, which makes the Source still available, but can decreases the performance.

Returns:
the DOM document representation of the "in" message content
Throws:
javax.jbi.messaging.MessagingException - if error occurred during conversion of the Source or if "in" message is null

getOutMessageContentAsSource

Source getOutMessageContentAsSource()
                                    throws javax.jbi.messaging.MessagingException
Get the content of the "out" message as a Source

Returns:
the "out" message content
Throws:
javax.jbi.messaging.MessagingException - if "out" message is null

getOutMessageProperty

Object getOutMessageProperty(String name)
                             throws javax.jbi.messaging.MessagingException
Parameters:
name -
Returns:
Throws:
javax.jbi.messaging.MessagingException

getOutMessagePropertyNames

Set<?> getOutMessagePropertyNames()
                                  throws javax.jbi.messaging.MessagingException
Returns:
Throws:
javax.jbi.messaging.MessagingException

getOutSubject

Subject getOutSubject()
                      throws javax.jbi.messaging.MessagingException
Get "Out" security subject

Returns:
the subject or null if no subject
Throws:
javax.jbi.messaging.MessagingException

getPattern

URI getPattern()
Returns:

getProperty

Object getProperty(String name)
Parameters:
name -
Returns:

getPropertyNames

Set<?> getPropertyNames()
Returns:

getRole

javax.jbi.messaging.MessageExchange.Role getRole()
Returns:

getService

QName getService()
Returns:

getStatus

javax.jbi.messaging.ExchangeStatus getStatus()
Returns:

isActiveStatus

boolean isActiveStatus()
Test if the message status is ACTIVE

Returns:

isConsumerRole

boolean isConsumerRole()
Returns:
true is the message role is consumer

isDoneStatus

boolean isDoneStatus()
Test if the message status is DONE

Returns:

isErrorStatus

boolean isErrorStatus()
Test if the message status is ERROR

Returns:

isInMessage

boolean isInMessage()
True if an In message is set on the MessageExchange false otherwise


isInOnlyPattern

boolean isInOnlyPattern()
Returns:

isInOptionalOutPattern

boolean isInOptionalOutPattern()
Returns:

isInOutPattern

boolean isInOutPattern()
Returns:

isOutMessage

boolean isOutMessage()
True if an Out message is set on the MessageExchange false otherwise


isProviderRole

boolean isProviderRole()
Returns:
true is the message role is provider

isRobustInOnlyPattern

boolean isRobustInOnlyPattern()
Returns:

isTransacted

boolean isTransacted()
Returns:

setActiveStatus

void setActiveStatus()
                     throws javax.jbi.messaging.MessagingException
Set the message exchange status to ACTIVE

Throws:
javax.jbi.messaging.MessagingException

setDoneStatus

void setDoneStatus()
                   throws javax.jbi.messaging.MessagingException
Set the message exchange status to DONE

Throws:
javax.jbi.messaging.MessagingException

setEndpoint

void setEndpoint(javax.jbi.servicedesc.ServiceEndpoint endpoint)
Parameters:
endpoint -

setError

void setError(Exception error)
Put the given exception as Error part of the message exchange. Allowed exception types are : java.*, org.w3c.* and org.xml.*.


setErrorStatus

void setErrorStatus()
                    throws javax.jbi.messaging.MessagingException
Set the message exchange status to Error

Throws:
javax.jbi.messaging.MessagingException

setFault

void setFault(javax.jbi.messaging.Fault fault)
              throws javax.jbi.messaging.MessagingException
Parameters:
fault -
Throws:
javax.jbi.messaging.MessagingException

setFault

void setFault(Throwable e)
              throws javax.jbi.messaging.MessagingException
Create a Fault with the given Exception and set it in the MessageExchange

Parameters:
e - the Throwable to transform in Fault
Throws:
javax.jbi.messaging.MessagingException

setInAddressing

void setInAddressing(Map<QName,String> map)
Set the addressing information in the IN message. An example of map data is organized like this : Possible keys can be found in Constants.Addressing and values are the URL as String. If the NormalizedMessage already contains the addressing data, they will be overrided by the input map. If No addressing data is available in the message, the input map will be the addressing data.

Parameters:
map -

setInMessage

void setInMessage(javax.jbi.messaging.NormalizedMessage msg)
                  throws javax.jbi.messaging.MessagingException
Set the input message

Parameters:
msg -
Throws:
javax.jbi.messaging.MessagingException

setInMessageAttachment

void setInMessageAttachment(String name,
                            DataHandler attachement)
                            throws javax.jbi.messaging.MessagingException
Put the attachment in the "out" message. If the out normalized message is null, it is created here.

Parameters:
name -
attachement -
Throws:
javax.jbi.messaging.MessagingException

setInMessageAttachments

void setInMessageAttachments(Map<String,DataHandler> attachements)
                             throws javax.jbi.messaging.MessagingException
Put a Map of attachments in the out message of the message exchange. If the out normalized message is null, it is created here.

Parameters:
attachements - the attachments to put in the out message
Throws:
javax.jbi.messaging.MessagingException - if error occurred during out message creation

setInMessageContent

void setInMessageContent(Document inContent)
                         throws javax.jbi.messaging.MessagingException
Put a Source object in the in message of the message exchange. If the in normalized message is null, it is created here.

Parameters:
inContent - the DOM Document content to put in the in message
Throws:
javax.jbi.messaging.MessagingException - if error occurred during in message creation

setInMessageContent

void setInMessageContent(InputStream inContent)
                         throws javax.jbi.messaging.MessagingException
Put a String object in the in message of the message exchange. If the in normalized message is null, it is created here.

Parameters:
inContent - the Source content to put in the in message
Throws:
javax.jbi.messaging.MessagingException - if error occurred during in message creation

setInMessageContent

void setInMessageContent(Source inContent)
                         throws javax.jbi.messaging.MessagingException
Put a Source object in the in message of the message exchange. If the in normalized message is null, it is created here.

Parameters:
inContent - the Source content to put in the in message
Throws:
javax.jbi.messaging.MessagingException - if error occurred during in message creation

setInMessageProperties

void setInMessageProperties(Map<String,Object> properties)
                            throws javax.jbi.messaging.MessagingException
Parameters:
properties -
Throws:
javax.jbi.messaging.MessagingException

setInMessageProperty

void setInMessageProperty(String name,
                          Object value)
                          throws javax.jbi.messaging.MessagingException
Parameters:
name -
value -
Throws:
javax.jbi.messaging.MessagingException

setInSubject

void setInSubject(Subject subject)
Set "In" security subject.

Parameters:
subject -

setInterfaceName

void setInterfaceName(QName interfaceName)
Set the target interface name to invoke the service

Parameters:
interfaceName -

setOperation

void setOperation(QName name)
Set the message operation

Parameters:
name -

setOutMessage

void setOutMessage(javax.jbi.messaging.NormalizedMessage msg)
                   throws javax.jbi.messaging.MessagingException
Set the output message

Parameters:
msg -
Throws:
javax.jbi.messaging.MessagingException

setOutMessageAttachment

void setOutMessageAttachment(String name,
                             DataHandler attachment)
                             throws javax.jbi.messaging.MessagingException
Put the attachment in the "out" message. If the out normalized message is null, it is created here.

Parameters:
name -
attachment -
Throws:
javax.jbi.messaging.MessagingException

setOutMessageAttachments

void setOutMessageAttachments(Map<String,DataHandler> attachements)
                              throws javax.jbi.messaging.MessagingException
Put a Map of attachments in the "out" message. If the out normalized message is null, it is created here.

Parameters:
attachements - the attachements to put in the out message
Throws:
javax.jbi.messaging.MessagingException - if error occured during out message creation

setOutMessageContent

void setOutMessageContent(Document outContent)
                          throws javax.jbi.messaging.MessagingException
Put a Source object in the out message of the message exchange. If the out normalized message is null, it is created here.

Parameters:
outContent - the DOM document content to put in the out message
Throws:
javax.jbi.messaging.MessagingException - if error occured during out message creation

setOutMessageContent

void setOutMessageContent(InputStream inContent)
                          throws javax.jbi.messaging.MessagingException
Put a String object in the in message of the message exchange. If the in normalized message is null, it is created here.

Parameters:
inContent - the Source content to put in the in message
Throws:
javax.jbi.messaging.MessagingException - if error occurred during in message creation

setOutMessageContent

void setOutMessageContent(Source outContent)
                          throws javax.jbi.messaging.MessagingException
Put a Source object in the out message of the message exchange. If the out normalized message is null, it is created here.

Parameters:
outContent - the Source content to put in the out message
Throws:
javax.jbi.messaging.MessagingException - if error occured during out message creation

setOutMessageProperties

void setOutMessageProperties(Map<String,Object> properties)
                             throws javax.jbi.messaging.MessagingException
Parameters:
properties -
Throws:
javax.jbi.messaging.MessagingException

setOutMessageProperty

void setOutMessageProperty(String name,
                           Object value)
                           throws javax.jbi.messaging.MessagingException
Parameters:
name -
value -
Throws:
javax.jbi.messaging.MessagingException

setOutSubject

void setOutSubject(Subject subject)
Set Out security subject.

Parameters:
subject -

setProperty

void setProperty(String name,
                 Object obj)
Parameters:
name -
obj -

setService

void setService(QName service)
Parameters:
service -

setStatus

void setStatus(javax.jbi.messaging.ExchangeStatus status)
               throws javax.jbi.messaging.MessagingException
Parameters:
status -
Throws:
javax.jbi.messaging.MessagingException


Copyright © 2005-2012 Petals Link (EBM Websourcing). All Rights Reserved.