org.apache.servicemix.components.util
Class ComponentSupport

java.lang.Object
  extended by org.apache.servicemix.jbi.management.BaseLifeCycle
      extended by org.apache.servicemix.components.util.PojoSupport
          extended by org.apache.servicemix.components.util.ComponentSupport
All Implemented Interfaces:
javax.jbi.component.Component, javax.jbi.component.ComponentLifeCycle, javax.jbi.management.LifeCycleMBean, MBeanInfoProvider
Direct Known Subclasses:
CounterMonitorComponent, DefaultServiceMixClient, HttpBindingSupport, HttpSoapInOutBinding, JmsInBinding, JmsServiceComponent, OutBinding, PipelineComponent, PollingComponentSupport, ProxyInOnlyBinding, ProxyInOutBinding, QuartzComponent, ReceiverComponent, SenderComponent, SubscriptionManager, TraceComponent, TransformComponentSupport

public abstract class ComponentSupport
extends PojoSupport
implements javax.jbi.component.Component

A useful base class for developers wishing to implement a JBI Component.

Version:
$Revision: 2153 $

Field Summary
 
Fields inherited from class org.apache.servicemix.components.util.PojoSupport
logger
 
Fields inherited from class org.apache.servicemix.jbi.management.BaseLifeCycle
currentState, INITIALIZED, listener
 
Fields inherited from interface javax.jbi.management.LifeCycleMBean
SHUTDOWN, STARTED, STOPPED, UNKNOWN
 
Constructor Summary
protected ComponentSupport()
           
protected ComponentSupport(QName service, String endpoint)
           
 
Method Summary
protected  javax.jbi.component.ComponentLifeCycle createComponentLifeCycle()
           
 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(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).
 javax.jbi.messaging.InOnly createInOnlyExchange(QName service, QName interfaceName, 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(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).
 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
protected  javax.jbi.component.ServiceUnitManager createServiceUnitManager()
           
 javax.jbi.messaging.InOut creatInOutExchange(QName service, QName interfaceName, QName operation, javax.jbi.messaging.MessageExchange srcExchange)
           
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, QName operationName)
           
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.
 javax.jbi.component.ComponentLifeCycle getLifeCycle()
           
 MessageTransformer getMessageTransformer()
           
 Document getServiceDescription(javax.jbi.servicedesc.ServiceEndpoint endpoint)
          Retrieves a DOM representation containing metadata which describes the service provided by this component, through the given endpoint.
 javax.jbi.component.ServiceUnitManager getServiceUnitManager()
           
protected  void initializeServiceUnitManager()
           
 void invoke(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.NormalizedMessage in, QName service, QName interfaceName, QName operation)
          Performs an invocation where the service, operation or interface name could be specified
 boolean isExchangeWithConsumerOkay(javax.jbi.servicedesc.ServiceEndpoint endpoint, javax.jbi.messaging.MessageExchange exchange)
          This method is called by JBI to check if this component, in the role of provider of the service indicated by the given exchange, can actually perform the operation desired.
 boolean isExchangeWithProviderOkay(javax.jbi.servicedesc.ServiceEndpoint endpoint, javax.jbi.messaging.MessageExchange exchange)
          This method is called by JBI to check if this component, in the role of consumer of the service indicated by the given exchange, can actually interact with the provider properly.
 void propagateCorrelationId(javax.jbi.messaging.MessageExchange source, javax.jbi.messaging.MessageExchange dest)
          Propagates the correlation id from an exchange to a newly created exchange
 javax.jbi.servicedesc.ServiceEndpoint resolveEndpointReference(DocumentFragment fragment)
           
 void setMessageTransformer(MessageTransformer transformer)
           
 
Methods inherited from class org.apache.servicemix.components.util.PojoSupport
answer, done, fail, fail, getBody, getContext, getDeliveryChannel, getDescription, getEndpoint, getExchangeFactory, getExtensionMBeanName, getService, init, init, isInAndOut, send, sendSync, sendSync, setBody, setEndpoint, setExtensionMBeanName, setService, shutDown
 
Methods inherited from class org.apache.servicemix.jbi.management.BaseLifeCycle
firePropertyChanged, getAttributeInfos, getCurrentState, getName, getObjectToManage, getOperationInfos, getSubType, getType, isInitialized, isShutDown, isStarted, isStopped, isUnknown, setCurrentState, setPropertyChangeListener, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.jbi.component.ComponentLifeCycle
start, stop
 

Constructor Detail

ComponentSupport

protected ComponentSupport()

ComponentSupport

protected ComponentSupport(QName service,
                           String endpoint)
Method Detail

getLifeCycle

public javax.jbi.component.ComponentLifeCycle getLifeCycle()
Specified by:
getLifeCycle in interface javax.jbi.component.Component
Returns:
the lifecycel control implementation

getServiceUnitManager

public javax.jbi.component.ServiceUnitManager getServiceUnitManager()
Specified by:
getServiceUnitManager in interface javax.jbi.component.Component
Returns:
the ServiceUnitManager or null if there isn't one

resolveEndpointReference

public javax.jbi.servicedesc.ServiceEndpoint resolveEndpointReference(DocumentFragment fragment)
Specified by:
resolveEndpointReference in interface javax.jbi.component.Component
Parameters:
fragment -
Returns:
the description of the specified reference

getServiceDescription

public Document getServiceDescription(javax.jbi.servicedesc.ServiceEndpoint endpoint)
Retrieves a DOM representation containing metadata which describes the service provided by this component, through the given endpoint. The result can use WSDL 1.1 or WSDL 2.0.

Specified by:
getServiceDescription in interface javax.jbi.component.Component
Parameters:
endpoint - the service endpoint.
Returns:
the description for the specified service endpoint.

isExchangeWithConsumerOkay

public boolean isExchangeWithConsumerOkay(javax.jbi.servicedesc.ServiceEndpoint endpoint,
                                          javax.jbi.messaging.MessageExchange exchange)
This method is called by JBI to check if this component, in the role of provider of the service indicated by the given exchange, can actually perform the operation desired.

Specified by:
isExchangeWithConsumerOkay in interface javax.jbi.component.Component
Parameters:
endpoint - the endpoint to be used by the consumer; must be non-null.
exchange - the proposed message exchange to be performed; must be non-null.
Returns:
true if this provider component can perform the given exchange with the described consumer.

isExchangeWithProviderOkay

public boolean isExchangeWithProviderOkay(javax.jbi.servicedesc.ServiceEndpoint endpoint,
                                          javax.jbi.messaging.MessageExchange exchange)
This method is called by JBI to check if this component, in the role of consumer of the service indicated by the given exchange, can actually interact with the provider properly. The provider is described by the given endpoint and the service description supplied by that endpoint.

Specified by:
isExchangeWithProviderOkay in interface javax.jbi.component.Component
Parameters:
endpoint - the endpoint to be used by the provider; must be non-null.
exchange - the proposed message exchange to be performed; must be non-null.
Returns:
true if this consumer component can interact with the described provider to perform the given exchange.

initializeServiceUnitManager

protected void initializeServiceUnitManager()

createServiceUnitManager

protected javax.jbi.component.ServiceUnitManager createServiceUnitManager()

createComponentLifeCycle

protected javax.jbi.component.ComponentLifeCycle createComponentLifeCycle()

getInMessage

protected javax.jbi.messaging.NormalizedMessage getInMessage(javax.jbi.messaging.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(javax.jbi.messaging.MessageExchange exchange,
                   javax.jbi.messaging.NormalizedMessage in,
                   QName service,
                   QName interfaceName,
                   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(QName service,
                                                       QName interfaceName,
                                                       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(QName service,
                                                       QName interfaceName,
                                                       QName operation,
                                                       javax.jbi.messaging.MessageExchange beforeExchange)
                                                throws javax.jbi.messaging.MessagingException
Throws:
javax.jbi.messaging.MessagingException

createInOutExchange

public javax.jbi.messaging.InOut createInOutExchange(QName service,
                                                     QName interfaceName,
                                                     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

creatInOutExchange

public javax.jbi.messaging.InOut creatInOutExchange(QName service,
                                                    QName interfaceName,
                                                    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,
                                 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


Copyright © 2005-2010 The Apache Software Foundation. All Rights Reserved.