Search in sources :

Example 1 with OsgiDefaultCamelContext

use of org.apache.camel.core.osgi.OsgiDefaultCamelContext in project camel by apache.

the class AbstractCamelRunner method createCamelContext.

protected void createCamelContext(final BundleContext bundleContext, final Map<String, String> props) {
    if (bundleContext != null) {
        context = new OsgiDefaultCamelContext(bundleContext, createRegistry(bundleContext));
        // Setup the application context classloader with the bundle classloader
        context.setApplicationContextClassLoader(new BundleDelegatingClassLoader(bundleContext.getBundle()));
        // and make sure the TCCL is our classloader
        Thread.currentThread().setContextClassLoader(context.getApplicationContextClassLoader());
    } else {
        context = new DefaultCamelContext(createRegistry());
    }
    setupPropertiesComponent(context, props, log);
}
Also used : OsgiDefaultCamelContext(org.apache.camel.core.osgi.OsgiDefaultCamelContext) BundleDelegatingClassLoader(org.apache.camel.core.osgi.utils.BundleDelegatingClassLoader) OsgiDefaultCamelContext(org.apache.camel.core.osgi.OsgiDefaultCamelContext) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext)

Aggregations

OsgiDefaultCamelContext (org.apache.camel.core.osgi.OsgiDefaultCamelContext)1 BundleDelegatingClassLoader (org.apache.camel.core.osgi.utils.BundleDelegatingClassLoader)1 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)1