org.apache.servicemix.bean.support
Class BeanSupport

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

public abstract class BeanSupport
extends Object

A useful base class for servicemix-bean POJOs

Version:
$$

Field Summary
protected  Log logger
           
 
Constructor Summary
protected BeanSupport()
           
 
Method Summary
 void answer(MessageExchange exchange, 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.
 InOnly createInOnlyExchange(MessageExchange srcExchange)
          Creates an InOnly exchange and propagates the correlation id from the given exchange to the newly created exchange
 InOnly createInOnlyExchange(QName service, QName interfaceName, QName operation)
          Creates a new InOnly exchange for the given service, interface and/or operation (any of which can be null).
 InOnly createInOnlyExchange(QName service, QName interfaceName, QName operation, MessageExchange beforeExchange)
           
 InOptionalOut createInOptionalOutExchange(MessageExchange srcExchange)
          Creates an InOptionalOut exchange and propagates the correlation id from the given exchange to the newly created exchange
 InOut createInOutExchange(MessageExchange srcExchange)
          Creates an InOut exchange and propagates the correlation id from the given exchange to the newly created exchange
 InOut createInOutExchange(QName service, QName interfaceName, QName operation)
          Creates a new InOut exchange for the given service, interface and/or operation (any of which can be null).
 InOut createInOutExchange(QName service, QName interfaceName, QName operation, MessageExchange srcExchange)
           
 RobustInOnly createRobustInOnlyExchange(MessageExchange srcExchange)
          Creates an RobustInOnly exchange and propagates the correlation id from the given exchange to the newly created exchange
 void done(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(MessageExchange exchange, Exception error)
          A helper method which fails and completes the given exchange with the specified error
 void fail(MessageExchange exchange, Fault fault)
          A helper method which fails and completes the given exchange with the specified fault
protected  void forwardToExchange(MessageExchange exchange, InOnly outExchange, NormalizedMessage in)
           
protected  void forwardToExchange(MessageExchange exchange, InOnly outExchange, NormalizedMessage in, QName operationName)
           
 Object getBody(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.
 ComponentContext getContext()
           
 DeliveryChannel getDeliveryChannel()
           
protected  String getEndpoint()
           
 MessageExchangeFactory getExchangeFactory()
          Provide access to the default message exchange exchangeFactory, lazily creating one.
 ObjectName getExtensionMBeanName()
           
protected  NormalizedMessage getInMessage(MessageExchange exchange)
          Returns the in message or throws an exception if there is no in message.
 MessageTransformer getMessageTransformer()
           
protected  QName getService()
           
 ServiceEndpoint getServiceEndpoint()
           
 void invoke(MessageExchange exchange, NormalizedMessage in, QName service, QName interfaceName, QName operation)
          Performs an invocation where the service, operation or interface name could be specified
protected  boolean isInAndOut(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(MessageExchange source, MessageExchange dest)
          Propagates the correlation id from an exchange to a newly created exchange
 void send(MessageExchange exchange)
           
 boolean sendSync(MessageExchange exchange)
           
 boolean sendSync(MessageExchange exchange, long timeMillis)
           
 void setBody(NormalizedMessage message, Object body)
          Sets the body of the message as a POJO
 void setContext(ComponentContext context)
           
 void setExtensionMBeanName(ObjectName extensionMBeanName)
           
 void setMessageTransformer(MessageTransformer transformer)
           
 void setServiceEndpoint(ServiceEndpoint serviceEndpoint)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected Log logger
Constructor Detail

BeanSupport

protected BeanSupport()
Method Detail

getBody

public Object getBody(NormalizedMessage message)
               throws 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:
MessagingException

setBody

public void setBody(NormalizedMessage message,
                    Object body)
             throws 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:
MessagingException

getExtensionMBeanName

public ObjectName getExtensionMBeanName()

setExtensionMBeanName

public void setExtensionMBeanName(ObjectName extensionMBeanName)

getContext

public ComponentContext getContext()

setContext

public void setContext(ComponentContext context)

getServiceEndpoint

public ServiceEndpoint getServiceEndpoint()

setServiceEndpoint

public void setServiceEndpoint(ServiceEndpoint serviceEndpoint)

getExchangeFactory

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

Throws:
MessagingException

getDeliveryChannel

public DeliveryChannel getDeliveryChannel()
                                   throws MessagingException
Throws:
MessagingException

done

public void done(MessageExchange exchange)
          throws 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:
MessagingException

send

public void send(MessageExchange exchange)
          throws MessagingException
Throws:
MessagingException

sendSync

public boolean sendSync(MessageExchange exchange)
                 throws MessagingException
Throws:
MessagingException

sendSync

public boolean sendSync(MessageExchange exchange,
                        long timeMillis)
                 throws MessagingException
Throws:
MessagingException

answer

public void answer(MessageExchange exchange,
                   NormalizedMessage answer)
            throws 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:
MessagingException

fail

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

Throws:
MessagingException

fail

public void fail(MessageExchange exchange,
                 Exception error)
          throws MessagingException
A helper method which fails and completes the given exchange with the specified error

Throws:
MessagingException

isInAndOut

protected boolean isInAndOut(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 NormalizedMessage getInMessage(MessageExchange exchange)
                                  throws NoInMessageAvailableException
Returns the in message or throws an exception if there is no in message.

Throws:
NoInMessageAvailableException

getMessageTransformer

public MessageTransformer getMessageTransformer()

setMessageTransformer

public void setMessageTransformer(MessageTransformer transformer)

invoke

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

Parameters:
exchange -
in -
service -
interfaceName -
operation -
Throws:
MessagingException

createInOnlyExchange

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

Throws:
MessagingException

createInOnlyExchange

public InOnly createInOnlyExchange(QName service,
                                   QName interfaceName,
                                   QName operation,
                                   MessageExchange beforeExchange)
                            throws MessagingException
Throws:
MessagingException

createInOutExchange

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

Throws:
MessagingException

createInOutExchange

public InOut createInOutExchange(QName service,
                                 QName interfaceName,
                                 QName operation,
                                 MessageExchange srcExchange)
                          throws MessagingException
Throws:
MessagingException

createInOnlyExchange

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

Parameters:
srcExchange -
Returns:
InOnly
Throws:
MessagingException

createInOptionalOutExchange

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

Parameters:
srcExchange -
Returns:
InOptionalOut
Throws:
MessagingException

createInOutExchange

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

Parameters:
srcExchange -
Returns:
InOut
Throws:
MessagingException

createRobustInOnlyExchange

public RobustInOnly createRobustInOnlyExchange(MessageExchange srcExchange)
                                        throws 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:
MessagingException

propagateCorrelationId

public void propagateCorrelationId(MessageExchange source,
                                   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(MessageExchange exchange,
                                 InOnly outExchange,
                                 NormalizedMessage in,
                                 QName operationName)
                          throws MessagingException
Throws:
MessagingException

forwardToExchange

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

getService

protected QName getService()

getEndpoint

protected String getEndpoint()


Copyright © 2005-2008 Apache Software Foundation. All Rights Reserved.