org.apache.servicemix.common
Class BaseComponent

java.lang.Object
  extended by org.apache.servicemix.common.BaseComponent
All Implemented Interfaces:
javax.jbi.component.Component, ServiceMixComponent

public abstract class BaseComponent
extends Object
implements ServiceMixComponent

Base class for a component.

Since:
3.0
Version:
$Revision: 514613 $
Author:
Guillaume Nodet

Field Summary
protected  BaseLifeCycle lifeCycle
           
protected  Log logger
           
protected  Registry registry
           
protected  BaseServiceUnitManager serviceUnitManager
           
 
Constructor Summary
BaseComponent()
           
 
Method Summary
protected  BaseLifeCycle createLifeCycle()
          Create the life cycle object.
protected  Registry createRegistry()
           
protected  BaseServiceUnitManager createServiceUnitManager()
          Create the service unit manager.
 javax.jbi.component.ComponentContext getComponentContext()
           
 String getComponentName()
           
 QName getEPRElementName()
           
 org.apache.servicemix.executors.Executor getExecutor()
          Shortcut to retrieve this component's executor.
 javax.jbi.component.ComponentLifeCycle getLifeCycle()
           
 Log getLogger()
           
 Registry getRegistry()
           
 Document getServiceDescription(javax.jbi.servicedesc.ServiceEndpoint endpoint)
           
 javax.jbi.component.ServiceUnitManager getServiceUnitManager()
           
 boolean isExchangeWithConsumerOkay(javax.jbi.servicedesc.ServiceEndpoint endpoint, javax.jbi.messaging.MessageExchange exchange)
           
 boolean isExchangeWithProviderOkay(javax.jbi.servicedesc.ServiceEndpoint endpoint, javax.jbi.messaging.MessageExchange exchange)
           
 void prepareConsumerExchange(javax.jbi.messaging.MessageExchange exchange, Endpoint endpoint)
          Prepare a consumer exchange from the given endpoint.
 javax.jbi.servicedesc.ServiceEndpoint resolveEndpointReference(DocumentFragment epr)
           
 void sendConsumerExchange(javax.jbi.messaging.MessageExchange exchange, Endpoint endpoint)
          Sends a consumer exchange from the given endpoint.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final transient Log logger

lifeCycle

protected BaseLifeCycle lifeCycle

registry

protected Registry registry

serviceUnitManager

protected BaseServiceUnitManager serviceUnitManager
Constructor Detail

BaseComponent

public BaseComponent()
Method Detail

getLifeCycle

public javax.jbi.component.ComponentLifeCycle getLifeCycle()
Specified by:
getLifeCycle in interface javax.jbi.component.Component

getServiceUnitManager

public javax.jbi.component.ServiceUnitManager getServiceUnitManager()
Specified by:
getServiceUnitManager in interface javax.jbi.component.Component

getServiceDescription

public Document getServiceDescription(javax.jbi.servicedesc.ServiceEndpoint endpoint)
Specified by:
getServiceDescription in interface javax.jbi.component.Component

isExchangeWithConsumerOkay

public boolean isExchangeWithConsumerOkay(javax.jbi.servicedesc.ServiceEndpoint endpoint,
                                          javax.jbi.messaging.MessageExchange exchange)
Specified by:
isExchangeWithConsumerOkay in interface javax.jbi.component.Component

isExchangeWithProviderOkay

public boolean isExchangeWithProviderOkay(javax.jbi.servicedesc.ServiceEndpoint endpoint,
                                          javax.jbi.messaging.MessageExchange exchange)
Specified by:
isExchangeWithProviderOkay in interface javax.jbi.component.Component

resolveEndpointReference

public javax.jbi.servicedesc.ServiceEndpoint resolveEndpointReference(DocumentFragment epr)
Specified by:
resolveEndpointReference in interface javax.jbi.component.Component

createLifeCycle

protected BaseLifeCycle createLifeCycle()
Create the life cycle object. Derived classes should override this method to be able to use a custom life cycle implementation.

Returns:
a life cycle object

createServiceUnitManager

protected BaseServiceUnitManager createServiceUnitManager()
Create the service unit manager. Derived classes should override this method and return a BaseServiceUnitManager so that the component is able to handle service unit deployment.

Returns:
a service unit manager

createRegistry

protected Registry createRegistry()

getComponentContext

public javax.jbi.component.ComponentContext getComponentContext()
Specified by:
getComponentContext in interface ServiceMixComponent
Returns:
Returns the components context

getComponentName

public String getComponentName()
Specified by:
getComponentName in interface ServiceMixComponent
Returns:
Returns the name of the component

getLogger

public Log getLogger()
Specified by:
getLogger in interface ServiceMixComponent
Returns:
Returns the logger.

getRegistry

public Registry getRegistry()
Specified by:
getRegistry in interface ServiceMixComponent
Returns:
Returns the registry.

getExecutor

public org.apache.servicemix.executors.Executor getExecutor()
Shortcut to retrieve this component's executor.

Specified by:
getExecutor in interface ServiceMixComponent
Returns:
the executor for this component

sendConsumerExchange

public void sendConsumerExchange(javax.jbi.messaging.MessageExchange exchange,
                                 Endpoint endpoint)
                          throws javax.jbi.messaging.MessagingException
Description copied from interface: ServiceMixComponent
Sends a consumer exchange from the given endpoint.

Specified by:
sendConsumerExchange in interface ServiceMixComponent
Parameters:
exchange - the exchange to send
endpoint - the endpoint sending the exchange
Throws:
javax.jbi.messaging.MessagingException

prepareConsumerExchange

public void prepareConsumerExchange(javax.jbi.messaging.MessageExchange exchange,
                                    Endpoint endpoint)
                             throws javax.jbi.messaging.MessagingException
Description copied from interface: ServiceMixComponent
Prepare a consumer exchange from the given endpoint. The caller need to send / sendSync the exchange.

Specified by:
prepareConsumerExchange in interface ServiceMixComponent
Parameters:
exchange - the exchange to send
endpoint - the endpoint sending the exchange
Throws:
javax.jbi.messaging.MessagingException

getEPRElementName

public QName getEPRElementName()
Specified by:
getEPRElementName in interface ServiceMixComponent
Returns:
the QName of the element used in EPR


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