Search in sources :

Example 1 with OsgiEventAdminNotifier

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

the class CamelContextFactoryBean method afterPropertiesSet.

@Override
public void afterPropertiesSet() throws Exception {
    super.afterPropertiesSet();
    getContext().getManagementStrategy().addEventNotifier(new OsgiCamelContextPublisher(bundleContext));
    try {
        getClass().getClassLoader().loadClass("org.osgi.service.event.EventAdmin");
        getContext().getManagementStrategy().addEventNotifier(new OsgiEventAdminNotifier(bundleContext));
    } catch (Throwable t) {
        // Ignore, if the EventAdmin package is not available, just don't use it
        LOG.debug("EventAdmin package is not available, just don't use it");
    }
}
Also used : OsgiEventAdminNotifier(org.apache.camel.core.osgi.OsgiEventAdminNotifier) OsgiCamelContextPublisher(org.apache.camel.core.osgi.OsgiCamelContextPublisher)

Example 2 with OsgiEventAdminNotifier

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

the class CamelContextFactoryBean method afterPropertiesSet.

@Override
public void afterPropertiesSet() throws Exception {
    super.afterPropertiesSet();
    // setup the application context classloader with the bundle delegating classloader
    ClassLoader cl = new BundleDelegatingClassLoader(bundleContext.getBundle());
    LOG.debug("Set the application context classloader to: {}", cl);
    getContext().setApplicationContextClassLoader(cl);
    osgiCamelContextPublisher = new OsgiCamelContextPublisher(bundleContext);
    osgiCamelContextPublisher.start();
    getContext().getManagementStrategy().addEventNotifier(osgiCamelContextPublisher);
    try {
        getClass().getClassLoader().loadClass("org.osgi.service.event.EventAdmin");
        getContext().getManagementStrategy().addEventNotifier(new OsgiEventAdminNotifier(bundleContext));
    } catch (Throwable t) {
        // Ignore, if the EventAdmin package is not available, just don't use it
        LOG.debug("EventAdmin package is not available, just don't use it");
    }
    // ensure routes is setup
    setupRoutes();
}
Also used : OsgiEventAdminNotifier(org.apache.camel.core.osgi.OsgiEventAdminNotifier) OsgiCamelContextPublisher(org.apache.camel.core.osgi.OsgiCamelContextPublisher) BundleDelegatingClassLoader(org.apache.camel.core.osgi.utils.BundleDelegatingClassLoader) BundleDelegatingClassLoader(org.apache.camel.core.osgi.utils.BundleDelegatingClassLoader)

Example 3 with OsgiEventAdminNotifier

use of org.apache.camel.core.osgi.OsgiEventAdminNotifier in project aries by apache.

the class CamelContextFactoryBean method afterPropertiesSet.

@Override
public void afterPropertiesSet() throws Exception {
    super.afterPropertiesSet();
    BundleContext bundleContext = getBundleContext();
    getContext().getManagementStrategy().addEventNotifier(new OsgiCamelContextPublisher(bundleContext));
    try {
        getClass().getClassLoader().loadClass("org.osgi.service.event.EventAdmin");
        getContext().getManagementStrategy().addEventNotifier(new OsgiEventAdminNotifier(bundleContext));
    } catch (Throwable t) {
        // Ignore, if the EventAdmin package is not available, just don't use it
        LOG.debug("EventAdmin package is not available, just don't use it");
    }
}
Also used : OsgiEventAdminNotifier(org.apache.camel.core.osgi.OsgiEventAdminNotifier) OsgiCamelContextPublisher(org.apache.camel.core.osgi.OsgiCamelContextPublisher) BundleContext(org.osgi.framework.BundleContext)

Aggregations

OsgiCamelContextPublisher (org.apache.camel.core.osgi.OsgiCamelContextPublisher)3 OsgiEventAdminNotifier (org.apache.camel.core.osgi.OsgiEventAdminNotifier)3 BundleDelegatingClassLoader (org.apache.camel.core.osgi.utils.BundleDelegatingClassLoader)1 BundleContext (org.osgi.framework.BundleContext)1