org.apache.servicemix.bean.support
Class BeanSupport

java.lang.Object
  extended by org.apache.servicemix.bean.support.BeanSupport
Direct Known Subclasses:
LoggingPojo, TransformBeanSupport

public abstract class BeanSupport
extends java.lang.Object

A useful base class for servicemix-bean POJOs

Version:
$$

Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
protected BeanSupport()
           
 
Method Summary
 void answer(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.NormalizedMessage answer)
          A helper method to indicate that the message exchange should be continued with the given response and send the message on the delivery channel.
 void answer(javax.jbi.messaging.MessageExchange exchange, javax.xml.transform.Source answer)
          A helper method to reply to a given message exchange with a given Source
 javax.jbi.messaging.InOnly createInOnlyExchange(javax.jbi.messaging.MessageExchange srcExchange)
          Creates an InOnly exchange and propagates the correlation id from the given exchange to the newly created exchange
 javax.jbi.messaging.InOnly createInOnlyExchange(javax.xml.namespace.QName service, javax.xml.namespace.QName interfaceName, javax.xml.namespace.QName operation)
          Creates a new InOnly exchange for the given service, interface and/or operation (any of which can be null).
 javax.jbi.messaging.InOnly createInOnlyExchange(javax.xml.namespace.QName service, javax.xml.namespace.QName interfaceName, javax.xml.namespace.QName operation, javax.jbi.messaging.MessageExchange beforeExchange)
           
 javax.jbi.messaging.InOptionalOut createInOptionalOutExchange(javax.jbi.messaging.MessageExchange srcExchange)
          Creates an InOptionalOut exchange and propagates the correlation id from the given exchange to the newly created exchange
 javax.jbi.messaging.InOut createInOutExchange(javax.jbi.messaging.MessageExchange srcExchange)
          Creates an InOut exchange and propagates the correlation id from the given exchange to the newly created exchange
 javax.jbi.messaging.InOut createInOutExchange(javax.xml.namespace.QName service, javax.xml.namespace.QName interfaceName, javax.xml.namespace.QName operation)
          Creates a new InOut exchange for the given service, interface and/or operation (any of which can be null).
 javax.jbi.messaging.InOut createInOutExchange(javax.xml.namespace.QName service, javax.xml.namespace.QName interfaceName, javax.xml.namespace.QName operation, javax.jbi.messaging.MessageExchange srcExchange)
           
 javax.jbi.messaging.RobustInOnly createRobustInOnlyExchange(javax.jbi.messaging.MessageExchange srcExchange)
          Creates an RobustInOnly exchange and propagates the correlation id from the given exchange to the newly created exchange
 void done(javax.jbi.messaging.MessageExchange exchange)
          A helper method to indicate that the message exchange is complete which will set the status to ExchangeStatus.DONE and send the message on the delivery channel.
 void fail(javax.jbi.messaging.MessageExchange exchange, java.lang.Exception error)
          A helper method which fails and completes the given exchange with the specified error
 void fail(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.Fault fault)
          A helper method which fails and completes the given exchange with the specified fault
protected  void forwardToExchange(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.InOnly outExchange, javax.jbi.messaging.NormalizedMessage in)
           
protected  void forwardToExchange(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.InOnly outExchange, javax.jbi.messaging.NormalizedMessage in, javax.xml.namespace.QName operationName)
           
 java.lang.Object getBody(javax.jbi.messaging.NormalizedMessage message)
          A helper method to return the body of the message as a POJO which could be a bean or some DOMish model of the body.
 javax.jbi.component.ComponentContext getContext()
           
 javax.jbi.messaging.DeliveryChannel getDeliveryChannel()
           
protected  java.lang.String getEndpoint()
           
 javax.jbi.messaging.MessageExchangeFactory getExchangeFactory()
          Provide access to the default message exchange exchangeFactory, lazily creating one.
 javax.management.ObjectName getExtensionMBeanName()
           
protected  javax.jbi.messaging.NormalizedMessage getInMessage(javax.jbi.messaging.MessageExchange exchange)
          Returns the in message or throws an exception if there is no in message.
 org.apache.servicemix.jbi.transformer.MessageTransformer getMessageTransformer()
           
protected  javax.xml.namespace.QName getService()
           
 javax.jbi.servicedesc.ServiceEndpoint getServiceEndpoint()
           
 void invoke(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.NormalizedMessage in, javax.xml.namespace.QName service, javax.xml.namespace.QName interfaceName, javax.xml.namespace.QName operation)
          Performs an invocation where the service, operation or interface name could be specified
protected  boolean isInAndOut(javax.jbi.messaging.MessageExchange exchange)
          A helper method which will return true if the exchange is capable of both In and Out such as InOut, InOptionalOut etc.
 void propagateCorrelationId(javax.jbi.messaging.MessageExchange source, javax.jbi.messaging.MessageExchange dest)
          Propagates the correlation id from an exchange to a newly created exchange
 void send(javax.jbi.messaging.MessageExchange exchange)
           
 boolean sendSync(javax.jbi.messaging.MessageExchange exchange)
           
 boolean sendSync(javax.jbi.messaging.MessageExchange exchange, long timeMillis)
           
 void setBody(javax.jbi.messaging.NormalizedMessage message, java.lang.Object body)
          Sets the body of the message as a POJO
 void setContext(javax.jbi.component.ComponentContext context)
           
 void setExtensionMBeanName(javax.management.ObjectName extensionMBeanName)
           
 void setMessageTransformer(org.apache.servicemix.jbi.transformer.MessageTransformer transformer)
           
 void setServiceEndpoint(javax.jbi.servicedesc.ServiceEndpoint serviceEndpoint)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected org.apache.commons.logging.Log logger
Constructor Detail

BeanSupport

protected BeanSupport()
Method Detail

getBody

public java.lang.Object getBody(javax.jbi.messaging.NormalizedMessage message)
                         throws javax.jbi.messaging.MessagingException
A helper method to return the body of the message as a POJO which could be a bean or some DOMish model of the body.

Parameters:
message - the message on which to extract the body
Returns:
the body of the message as a POJO or DOM object
Throws:
javax.jbi.messaging.MessagingException

setBody

public void setBody(javax.jbi.messaging.NormalizedMessage message,
                    java.lang.Object body)
             throws javax.jbi.messaging.MessagingException
Sets the body of the message as a POJO

Parameters:
message - the message on which to set the body
body - the POJO or DOMish model to set
Throws:
javax.jbi.messaging.MessagingException

getExtensionMBeanName

public javax.management.ObjectName getExtensionMBeanName()

setExtensionMBeanName

public void setExtensionMBeanName(javax.management.ObjectName extensionMBeanName)

getContext

public javax.jbi.component.ComponentContext getContext()

setContext

public void setContext(javax.jbi.component.ComponentContext context)

getServiceEndpoint

public javax.jbi.servicedesc.ServiceEndpoint getServiceEndpoint()

setServiceEndpoint

public void setServiceEndpoint(javax.jbi.servicedesc.ServiceEndpoint serviceEndpoint)

getExchangeFactory

public javax.jbi.messaging.MessageExchangeFactory getExchangeFactory()
                                                              throws javax.jbi.messaging.MessagingException
Provide access to the default message exchange exchangeFactory, lazily creating one.

Throws:
javax.jbi.messaging.MessagingException

getDeliveryChannel

public javax.jbi.messaging.DeliveryChannel getDeliveryChannel()
                                                       throws javax.jbi.messaging.MessagingException
Throws:
javax.jbi.messaging.MessagingException

done

public void done(javax.jbi.messaging.MessageExchange exchange)
          throws javax.jbi.messaging.MessagingException
A helper method to indicate that the message exchange is complete which will set the status to ExchangeStatus.DONE and send the message on the delivery channel.

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

send

public void send(javax.jbi.messaging.MessageExchange exchange)
          throws javax.jbi.messaging.MessagingException
Throws:
javax.jbi.messaging.MessagingException

sendSync

public boolean sendSync(javax.jbi.messaging.MessageExchange exchange)
                 throws javax.jbi.messaging.MessagingException
Throws:
javax.jbi.messaging.MessagingException

sendSync

public boolean sendSync(javax.jbi.messaging.MessageExchange exchange,
                        long timeMillis)
                 throws javax.jbi.messaging.MessagingException
Throws:
javax.jbi.messaging.MessagingException

answer

public void answer(javax.jbi.messaging.MessageExchange exchange,
                   javax.jbi.messaging.NormalizedMessage answer)
            throws javax.jbi.messaging.MessagingException
A helper method to indicate that the message exchange should be continued with the given response and send the message on the delivery channel.

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

answer

public void answer(javax.jbi.messaging.MessageExchange exchange,
                   javax.xml.transform.Source answer)
            throws javax.jbi.messaging.MessagingException
A helper method to reply to a given message exchange with a given Source

Parameters:
exchange - the message exchange
answer - the answer as an XML source
Throws:
javax.jbi.messaging.MessagingException

fail

public void fail(javax.jbi.messaging.MessageExchange exchange,
                 javax.jbi.messaging.Fault fault)
          throws javax.jbi.messaging.MessagingException
A helper method which fails and completes the given exchange with the specified fault

Throws:
javax.jbi.messaging.MessagingException

fail

public void fail(javax.jbi.messaging.MessageExchange exchange,
                 java.lang.Exception error)
          throws javax.jbi.messaging.MessagingException
A helper method which fails and completes the given exchange with the specified error

Throws:
javax.jbi.messaging.MessagingException

isInAndOut

protected boolean isInAndOut(javax.jbi.messaging.MessageExchange exchange)
A helper method which will return true if the exchange is capable of both In and Out such as InOut, InOptionalOut etc.

Parameters:
exchange -
Returns:
true if the exchange can handle both input and output

getInMessage

protected javax.jbi.messaging.NormalizedMessage getInMessage(javax.jbi.messaging.MessageExchange exchange)
                                                      throws org.apache.servicemix.jbi.exception.NoInMessageAvailableException
Returns the in message or throws an exception if there is no in message.

Throws:
org.apache.servicemix.jbi.exception.NoInMessageAvailableException

getMessageTransformer

public org.apache.servicemix.jbi.transformer.MessageTransformer getMessageTransformer()

setMessageTransformer

public void setMessageTransformer(org.apache.servicemix.jbi.transformer.MessageTransformer transformer)

invoke

public void invoke(javax.jbi.messaging.MessageExchange exchange,
                   javax.jbi.messaging.NormalizedMessage in,
                   javax.xml.namespace.QName service,
                   javax.xml.namespace.QName interfaceName,
                   javax.xml.namespace.QName operation)
            throws javax.jbi.messaging.MessagingException
Performs an invocation where the service, operation or interface name could be specified

Parameters:
exchange -
in -
service -
interfaceName -
operation -
Throws:
javax.jbi.messaging.MessagingException

createInOnlyExchange

public javax.jbi.messaging.InOnly createInOnlyExchange(javax.xml.namespace.QName service,
                                                       javax.xml.namespace.QName interfaceName,
                                                       javax.xml.namespace.QName operation)
                                                throws javax.jbi.messaging.MessagingException
Creates a new InOnly exchange for the given service, interface and/or operation (any of which can be null).

Throws:
javax.jbi.messaging.MessagingException

createInOnlyExchange

public javax.jbi.messaging.InOnly createInOnlyExchange(javax.xml.namespace.QName service,
                                                       javax.xml.namespace.QName interfaceName,
                                                       javax.xml.namespace.QName operation,
                                                       javax.jbi.messaging.MessageExchange beforeExchange)
                                                throws javax.jbi.messaging.MessagingException
Throws:
javax.jbi.messaging.MessagingException

createInOutExchange

public javax.jbi.messaging.InOut createInOutExchange(javax.xml.namespace.QName service,
                                                     javax.xml.namespace.QName interfaceName,
                                                     javax.xml.namespace.QName operation)
                                              throws javax.jbi.messaging.MessagingException
Creates a new InOut exchange for the given service, interface and/or operation (any of which can be null).

Throws:
javax.jbi.messaging.MessagingException

createInOutExchange

public javax.jbi.messaging.InOut createInOutExchange(javax.xml.namespace.QName service,
                                                     javax.xml.namespace.QName interfaceName,
                                                     javax.xml.namespace.QName operation,
                                                     javax.jbi.messaging.MessageExchange srcExchange)
                                              throws javax.jbi.messaging.MessagingException
Throws:
javax.jbi.messaging.MessagingException

createInOnlyExchange

public javax.jbi.messaging.InOnly createInOnlyExchange(javax.jbi.messaging.MessageExchange srcExchange)
                                                throws javax.jbi.messaging.MessagingException
Creates an InOnly exchange and propagates the correlation id from the given exchange to the newly created exchange

Parameters:
srcExchange -
Returns:
InOnly
Throws:
javax.jbi.messaging.MessagingException

createInOptionalOutExchange

public javax.jbi.messaging.InOptionalOut createInOptionalOutExchange(javax.jbi.messaging.MessageExchange srcExchange)
                                                              throws javax.jbi.messaging.MessagingException
Creates an InOptionalOut exchange and propagates the correlation id from the given exchange to the newly created exchange

Parameters:
srcExchange -
Returns:
InOptionalOut
Throws:
javax.jbi.messaging.MessagingException

createInOutExchange

public javax.jbi.messaging.InOut createInOutExchange(javax.jbi.messaging.MessageExchange srcExchange)
                                              throws javax.jbi.messaging.MessagingException
Creates an InOut exchange and propagates the correlation id from the given exchange to the newly created exchange

Parameters:
srcExchange -
Returns:
InOut
Throws:
javax.jbi.messaging.MessagingException

createRobustInOnlyExchange

public javax.jbi.messaging.RobustInOnly createRobustInOnlyExchange(javax.jbi.messaging.MessageExchange srcExchange)
                                                            throws javax.jbi.messaging.MessagingException
Creates an RobustInOnly exchange and propagates the correlation id from the given exchange to the newly created exchange

Parameters:
srcExchange -
Returns:
RobustInOnly the created exchange
Throws:
javax.jbi.messaging.MessagingException

propagateCorrelationId

public void propagateCorrelationId(javax.jbi.messaging.MessageExchange source,
                                   javax.jbi.messaging.MessageExchange dest)
Propagates the correlation id from an exchange to a newly created exchange

Parameters:
source - Exchange which already exists
dest - Newly created exchange which should get the correlation id

forwardToExchange

protected void forwardToExchange(javax.jbi.messaging.MessageExchange exchange,
                                 javax.jbi.messaging.InOnly outExchange,
                                 javax.jbi.messaging.NormalizedMessage in,
                                 javax.xml.namespace.QName operationName)
                          throws javax.jbi.messaging.MessagingException
Throws:
javax.jbi.messaging.MessagingException

forwardToExchange

protected void forwardToExchange(javax.jbi.messaging.MessageExchange exchange,
                                 javax.jbi.messaging.InOnly outExchange,
                                 javax.jbi.messaging.NormalizedMessage in)
                          throws javax.jbi.messaging.MessagingException
Throws:
javax.jbi.messaging.MessagingException

getService

protected javax.xml.namespace.QName getService()

getEndpoint

protected java.lang.String getEndpoint()


Copyright © 2005-2011 FuseSource. All Rights Reserved.