use of org.apache.camel.impl.CompositeRegistry in project camel by apache.
the class OsgiCamelContextHelper method wrapRegistry.
public static Registry wrapRegistry(CamelContext camelContext, Registry registry, BundleContext bundleContext) {
ObjectHelper.notNull(bundleContext, "BundleContext");
LOG.debug("Setting up OSGi ServiceRegistry");
OsgiServiceRegistry osgiServiceRegistry = new OsgiServiceRegistry(bundleContext);
// Need to clean up the OSGi service when camel context is closed.
camelContext.addLifecycleStrategy(osgiServiceRegistry);
CompositeRegistry compositeRegistry = new CompositeRegistry();
compositeRegistry.addRegistry(osgiServiceRegistry);
compositeRegistry.addRegistry(registry);
return compositeRegistry;
}
use of org.apache.camel.impl.CompositeRegistry in project camel by apache.
the class Main method getCamelContextMap.
protected Map<String, CamelContext> getCamelContextMap() {
Map<String, CamelContext> answer = new HashMap<String, CamelContext>();
CamelContext camelContext = createContext();
if (registry.size() > 0) {
// set the registry through which we've already bound some beans
if (DefaultCamelContext.class.isAssignableFrom(camelContext.getClass())) {
CompositeRegistry compositeRegistry = new CompositeRegistry();
// make sure camel look up the Object from the registry first
compositeRegistry.addRegistry(registry);
// use the camel old registry as a fallback
compositeRegistry.addRegistry(((DefaultCamelContext) camelContext).getRegistry());
((DefaultCamelContext) camelContext).setRegistry(compositeRegistry);
}
}
answer.put("camel-1", camelContext);
return answer;
}
Aggregations