org.apache.servicemix.camel.osgi
Class OsgiCamelJbiComponent

java.lang.Object
  extended by org.apache.servicemix.common.AsyncBaseLifeCycle
      extended by org.apache.servicemix.common.DefaultComponent
          extended by org.apache.servicemix.camel.CamelJbiComponent
              extended by org.apache.servicemix.camel.osgi.OsgiCamelJbiComponent
All Implemented Interfaces:
javax.jbi.component.Component, javax.jbi.component.ComponentLifeCycle, CamelComponent, ServiceMixComponent

public class OsgiCamelJbiComponent
extends CamelJbiComponent

When deploying a JBI packaged SU to camel component, camel-spring and camel-osgi can not be found by Spring/XBean, thus leading to an exception about the spring and osgi namespaces not being found. We need to hack the classloader for SUs to force a reference to camel-spring, camel-osgi and camel-cxf in the SU classloader parents. We also need to inject the bundleContext into the CamelContextFactoryBean to make sure the CamelContextFactoryBean will replace the regular ResolverUtils with OSGi ResolverUtils


Nested Class Summary
 class OsgiCamelJbiComponent.OsgiCamelSpringDeployer
           
 class OsgiCamelJbiComponent.OsgiClassLoaderXmlPreprocessor
           
 
Field Summary
 
Fields inherited from class org.apache.servicemix.camel.CamelJbiComponent
deployer
 
Fields inherited from class org.apache.servicemix.common.DefaultComponent
lifeCycle, registry, serviceUnit, serviceUnitManager
 
Fields inherited from class org.apache.servicemix.common.AsyncBaseLifeCycle
channel, component, consumerExecutor, container, context, correlationId, currentState, executorFactory, INITIALIZED, knownExchanges, mbeanName, poller, polling, providerExecutor, running, transactionManager, workManagerCreated
 
Constructor Summary
OsgiCamelJbiComponent()
           
 
Method Summary
 BaseServiceUnitManager createServiceUnitManager()
           
 org.osgi.framework.BundleContext getBundleContext()
           
 long getShutdownTimeout()
           
 void prepareShutdown(Endpoint endpoint)
           
 void setBundleContext(org.osgi.framework.BundleContext bundleContext)
           
 void setShutdownTimeout(long shutdownTimeout)
           
 
Methods inherited from class org.apache.servicemix.camel.CamelJbiComponent
activateJbiEndpoint, addJbiComponent, createEndpoint, deactivateJbiEndpoint, getConfiguredEndpoints, getEndpointClasses, getEPRProtocols, getJbiComponent, getResolvedEPR, isEndpointExposedOnNmr, removeJbiComponent
 
Methods inherited from class org.apache.servicemix.common.DefaultComponent
addEndpoint, asList, createRegistry, doInit, doShutDown, doStart, doStop, getComponentContext, getComponentName, getEPRElementName, getEPRServiceName, getLifeCycle, getLogger, getRegistry, getServiceDescription, getServiceUnit, getServiceUnitManager, isExchangeWithConsumerOkay, isExchangeWithProviderOkay, isKnownEndpoint, removeEndpoint, resolveEndpointReference, validateEndpoint
 
Methods inherited from class org.apache.servicemix.common.AsyncBaseLifeCycle
createExecutorFactory, createExtensionMBeanName, exceptionShouldRollbackTx, findExecutorFactory, getContainer, getContext, getCurrentState, getExecutor, getExecutorFactory, getExtensionMBean, getExtensionMBeanName, getKnownExchanges, getSmx3Container, handleExchange, init, isInitialized, isShutDown, isStarted, isStopped, isUnknown, onMessageExchange, pollDeliveryChannel, prepareExchange, prepareShutdown, processExchange, processExchangeInTx, setComponent, setCurrentState, setExecutor, setExecutorFactory, shutDown, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.servicemix.camel.CamelComponent
addEndpoint, getServiceUnit, removeEndpoint
 
Methods inherited from interface org.apache.servicemix.common.ServiceMixComponent
getComponentContext, getComponentName, getContainer, getEPRElementName, getExecutor, getLogger, getRegistry, getSmx3Container, handleExchange, prepareExchange
 
Methods inherited from interface javax.jbi.component.Component
getLifeCycle, getServiceDescription, getServiceUnitManager, isExchangeWithConsumerOkay, isExchangeWithProviderOkay, resolveEndpointReference
 

Constructor Detail

OsgiCamelJbiComponent

public OsgiCamelJbiComponent()
Method Detail

setBundleContext

public void setBundleContext(org.osgi.framework.BundleContext bundleContext)

getBundleContext

public org.osgi.framework.BundleContext getBundleContext()

createServiceUnitManager

public BaseServiceUnitManager createServiceUnitManager()
Overrides:
createServiceUnitManager in class CamelJbiComponent

prepareShutdown

public void prepareShutdown(Endpoint endpoint)
                     throws java.lang.InterruptedException
Specified by:
prepareShutdown in interface ServiceMixComponent
Overrides:
prepareShutdown in class AsyncBaseLifeCycle
Throws:
java.lang.InterruptedException

getShutdownTimeout

public long getShutdownTimeout()

setShutdownTimeout

public void setShutdownTimeout(long shutdownTimeout)


Copyright © 2005-2011 FuseSource. All Rights Reserved.