Java 类org.apache.camel.impl.CompositeRegistry 实例源码

项目:Camel    文件:Main.java   
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;
}
项目:switchyard    文件:SwitchYardCamelContextImpl.java   
protected CompositeRegistry createRegistry() {
    final ServiceLoader<Registry> registriesLoaders = ServiceLoader.load(Registry.class, getClass().getClassLoader());

    final List<Registry> registries = new ArrayList<Registry>();
    registries.add(new JndiRegistry());
    if (isEnableCdiIntegration()) {
        registries.add(new CdiBeanRegistry());
    }
    registries.add(_writeableRegistry);

    for (Registry registry : registriesLoaders) {
        registries.add(registry);
    }

    return new CompositeRegistry(registries);
}
项目:Camel    文件:OsgiCamelContextHelper.java   
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;
}
项目:microservice-bundle    文件:RegistryModule.java   
@Provides
@Singleton
public CompositeRegistry getRegistry(Injector injector) {
  CompositeRegistry compositeRegistry = new CompositeRegistry();

  compositeRegistry.addRegistry(new GuiceRegistry(injector));

  Injector parentInjector = injector.getParent();
  if (parentInjector != null) {
    GuiceRegistry parentRegistry = parentInjector.getInstance(GuiceRegistry.class);
    compositeRegistry.addRegistry(parentRegistry);
  }

  return compositeRegistry;
}
项目:microservice-bundle    文件:RegistryModule.java   
@Override
protected void configure() {
  bind(Registry.class).to(CompositeRegistry.class);
}
项目:switchyard    文件:OsgiSwitchYardCamelContextImpl.java   
@Override
protected CompositeRegistry createRegistry() {
    return (CompositeRegistry) OsgiCamelContextHelper.wrapRegistry(this, super.createRegistry(), _bundleContext);
}