org.ow2.petals.se.eip.patterns
Class PatternHelper

java.lang.Object
  extended by org.ow2.petals.se.eip.patterns.PatternHelper

public class PatternHelper
extends java.lang.Object

Author:
alouis

Constructor Summary
PatternHelper()
           
 
Method Summary
static org.w3c.dom.Document aggregateContent(org.w3c.dom.Document document, org.w3c.dom.Document aggregatedDocument, java.lang.String contentName, java.lang.String namespace)
          Aggregate the item XML content into the global AggregateDocument
static org.w3c.dom.Document aggregateContent(javax.jbi.messaging.NormalizedMessage receivedMessage, org.w3c.dom.Document aggregatedDocument, java.lang.String name, java.lang.String namespace)
          Aggregate the received normalized message content into the global aggregated document
static void copy(javax.jbi.messaging.NormalizedMessage source, javax.jbi.messaging.NormalizedMessage target)
          Copies message's content, security, properties and attachments in another.
static void copy(javax.jbi.messaging.NormalizedMessage source, javax.jbi.messaging.NormalizedMessage target, boolean copyContent, boolean copySecurity, boolean copyAttachments, boolean copyProperties)
          Copies message's properties, attachments, content and security provided, in another.
static void copyAttachments(javax.jbi.messaging.NormalizedMessage sourceMessage, javax.jbi.messaging.NormalizedMessage destMessage)
          Copy the attachments.
static void copyProperties(javax.jbi.messaging.NormalizedMessage sourceMessage, javax.jbi.messaging.NormalizedMessage destMessage)
          Copy the properties.
static org.w3c.dom.Document createExceptionDocument(java.lang.String namespace)
          Create an document for the exceptions.
static org.w3c.dom.Document createResultDocument(java.lang.String namespace)
          Create an document to fill with response nodes.
static boolean evaluateXPathCondition(java.lang.String expression, org.w3c.dom.Node message)
           
static org.w3c.dom.NodeList evaluateXPathExpressionAsNodeList(java.lang.String expression, org.w3c.dom.Node message)
          Evaluate a XPath expression
static java.lang.String evaluateXPathExpressionAsString(java.lang.String expression, org.w3c.dom.Node message)
          Evaluate a XPath expression
static java.io.InputStream handleStreamSource(javax.jbi.messaging.NormalizedMessage message)
          Handle the streaming issue.
static javax.jbi.messaging.NormalizedMessage processSentExchange(org.ow2.petals.component.framework.api.message.Exchange sentExchange, ExchangeContext context)
          Process the result of a sent exchange.
- if the exchange contains an OUT, return it and close the sent exchange
- if the exchange contains a FAULT, return it and close the sent exchange
- if the exchange is on ERROR status, throw a JBI Exception - if the exchange is on DONE status, return a null Normalized Message
static org.ow2.petals.component.framework.api.Message.MEPConstants retrievePattern(org.ow2.petals.component.framework.jbidescriptor.generated.MEPType patternShortcut)
          Retrieve the MEP from the extensions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PatternHelper

public PatternHelper()
Method Detail

aggregateContent

public static org.w3c.dom.Document aggregateContent(org.w3c.dom.Document document,
                                                    org.w3c.dom.Document aggregatedDocument,
                                                    java.lang.String contentName,
                                                    java.lang.String namespace)
                                             throws javax.jbi.messaging.MessagingException
Aggregate the item XML content into the global AggregateDocument

Parameters:
document - xml content to append
aggregateDocument - the global document in which the item is appended
namespace - The namespace of the root element
Returns:
the document appended
Throws:
javax.jbi.messaging.MessagingException

aggregateContent

public static org.w3c.dom.Document aggregateContent(javax.jbi.messaging.NormalizedMessage receivedMessage,
                                                    org.w3c.dom.Document aggregatedDocument,
                                                    java.lang.String name,
                                                    java.lang.String namespace)
                                             throws org.ow2.petals.component.framework.api.exception.PEtALSCDKException,
                                                    javax.jbi.messaging.MessagingException
Aggregate the received normalized message content into the global aggregated document

Parameters:
receivedMessage - message containing the xml content to append
aggregatedDocument - the global document in which the content is appended
name - The name of the new element
namespace - The namespace of the new element
Returns:
The aggregated document
Throws:
org.ow2.petals.component.framework.api.exception.PEtALSCDKException
javax.jbi.messaging.MessagingException

copy

public static final void copy(javax.jbi.messaging.NormalizedMessage source,
                              javax.jbi.messaging.NormalizedMessage target)
                       throws javax.jbi.messaging.MessagingException,
                              org.ow2.petals.component.framework.api.exception.PEtALSCDKException
Copies message's content, security, properties and attachments in another.

Parameters:
source - The NormalizedMessage source (copied)
target - The NormalizedMessage target (pasted)
Throws:
javax.jbi.messaging.MessagingException - error while setting attachment
org.ow2.petals.component.framework.api.exception.PEtALSCDKException - error while using PEtALS object

copy

public static final void copy(javax.jbi.messaging.NormalizedMessage source,
                              javax.jbi.messaging.NormalizedMessage target,
                              boolean copyContent,
                              boolean copySecurity,
                              boolean copyAttachments,
                              boolean copyProperties)
                       throws javax.jbi.messaging.MessagingException,
                              org.ow2.petals.component.framework.api.exception.PEtALSCDKException
Copies message's properties, attachments, content and security provided, in another.

Parameters:
source -
target -
copyContent - Copy the content or not
copySecurity - Copy the security or not
copyAttachments - Copy the attachments or not
copyProperties - Copy the properties or not
Throws:
javax.jbi.messaging.MessagingException
org.ow2.petals.component.framework.api.exception.PEtALSCDKException

copyAttachments

public static void copyAttachments(javax.jbi.messaging.NormalizedMessage sourceMessage,
                                   javax.jbi.messaging.NormalizedMessage destMessage)
                            throws org.ow2.petals.component.framework.api.exception.PEtALSCDKException,
                                   javax.jbi.messaging.MessagingException
Copy the attachments.

Parameters:
sourceMessage - message containing the attachments
destMessage -
Throws:
org.ow2.petals.component.framework.api.exception.PEtALSCDKException
javax.jbi.messaging.MessagingException

copyProperties

public static void copyProperties(javax.jbi.messaging.NormalizedMessage sourceMessage,
                                  javax.jbi.messaging.NormalizedMessage destMessage)
                           throws org.ow2.petals.component.framework.api.exception.PEtALSCDKException,
                                  javax.jbi.messaging.MessagingException
Copy the properties.

Parameters:
destMessage - message containing the properties
destMessage -
Throws:
org.ow2.petals.component.framework.api.exception.PEtALSCDKException
javax.jbi.messaging.MessagingException

createExceptionDocument

public static org.w3c.dom.Document createExceptionDocument(java.lang.String namespace)
Create an document for the exceptions.

Parameters:
namespace - The namespace of the root element
Returns:
the document

createResultDocument

public static org.w3c.dom.Document createResultDocument(java.lang.String namespace)
Create an document to fill with response nodes.

Parameters:
namespace - The namespace of the root element
Returns:
the document

evaluateXPathCondition

public static final boolean evaluateXPathCondition(java.lang.String expression,
                                                   org.w3c.dom.Node message)
                                            throws javax.xml.xpath.XPathExpressionException
Parameters:
condition -
message -
context -
Returns:
Throws:
javax.xml.xpath.XPathExpressionException

evaluateXPathExpressionAsNodeList

public static final org.w3c.dom.NodeList evaluateXPathExpressionAsNodeList(java.lang.String expression,
                                                                           org.w3c.dom.Node message)
                                                                    throws javax.xml.xpath.XPathExpressionException
Evaluate a XPath expression

Parameters:
expression - The XPath expression to compile
message - The Node to evaluate
Returns:
The NodeList evaluated by XPath under the message
Throws:
javax.xml.xpath.XPathExpressionException

evaluateXPathExpressionAsString

public static final java.lang.String evaluateXPathExpressionAsString(java.lang.String expression,
                                                                     org.w3c.dom.Node message)
                                                              throws javax.xml.xpath.XPathExpressionException
Evaluate a XPath expression

Parameters:
expression - The XPath expression to compile
message - The Node to evaluate
Returns:
The String evaluated by XPath under the message
Throws:
javax.xml.xpath.XPathExpressionException

handleStreamSource

public static final java.io.InputStream handleStreamSource(javax.jbi.messaging.NormalizedMessage message)
                                                    throws javax.jbi.messaging.MessagingException
Handle the streaming issue.

Parameters:
streamSource -
Returns:
a forked InputStream or null if the content of the message isn't a stream source
Throws:
javax.jbi.messaging.MessagingException

processSentExchange

public static final javax.jbi.messaging.NormalizedMessage processSentExchange(org.ow2.petals.component.framework.api.message.Exchange sentExchange,
                                                                              ExchangeContext context)
                                                                       throws javax.jbi.messaging.MessagingException
Process the result of a sent exchange.
- if the exchange contains an OUT, return it and close the sent exchange
- if the exchange contains a FAULT, return it and close the sent exchange
- if the exchange is on ERROR status, throw a JBI Exception - if the exchange is on DONE status, return a null Normalized Message

Parameters:
sentExchange -
originalExchange -
context -
setFailure -
Returns:
the OUT message of the sent exchange, if any. When null, the original exchange has been updated
Throws:
javax.jbi.messaging.MessagingException - An exception from the sentExchange

retrievePattern

public static final org.ow2.petals.component.framework.api.Message.MEPConstants retrievePattern(org.ow2.petals.component.framework.jbidescriptor.generated.MEPType patternShortcut)
                                                                                         throws javax.jbi.messaging.MessagingException
Retrieve the MEP from the extensions.

Parameters:
extensions -
Returns:
mep specified in extensions
Throws:
javax.jbi.messaging.MessagingException - MEP pattern specified in consumes extension isn't valid or if no MEP pattern specified in extensions.


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