protected void setupSecurity(CamelContext camelContext) { SimpleRegistry simpleRegistry = new SimpleRegistry(); simpleRegistry.put(settings.getSslContextParametersBeanName(), CamelUtils.createSslContextParameters(settings.getSslConfiguration())); // TODO Handle many invocations of this method that cause growing of the registry list. ((DefaultCamelContext) camelContext).setRegistry(new CompositeRegistry(Arrays.asList(simpleRegistry, camelContext.getRegistry()))); }
protected void setupSecurity(CamelContext camelContext) { SimpleRegistry simpleRegistry = new SimpleRegistry(); simpleRegistry.put(settings.getSslContextParametersBeanName(), CamelUtils.createSslContextParameters(settings.getSslConfiguration())); // TODO Handle many invocations of this method resulting in a growing registry list. ((DefaultCamelContext) camelContext).setRegistry(new CompositeRegistry(Arrays.asList(simpleRegistry, camelContext.getRegistry()))); }
adapted.setRegistry(new CdiCamelRegistry(manager)); adapted.setInjector(new CdiCamelInjector(context.getInjector(), manager)); } else {
/** * Constructor, creates a new Camel context. * * @param bundleContext Bundle context to use. */ public CamelWrapper(final BundleContext bundleContext) { final DefaultCamelContext ctx = new OsgiDefaultCamelContext(bundleContext); OSGiRegistry osgiRegistry = new OSGiRegistry(bundleContext); ctx.setRegistry(osgiRegistry); // for compatibility with previous registry only, routes beginning // with registry: should be associate with Camel's RefComponent ctx.addComponent("registry", new RefComponent()); // set context name with bundle symbolic name ctx.setName(bundleContext.getBundle().getSymbolicName()); // create the wrapper this.registryWrapper = new RegistryWrapper(); // Create the registry and assign the context to it. this.registryWrapper.createRegistryAndAssignToContext(ctx); this.camel = ctx; }
@Override public T produce(CreationalContext<T> ctx) { T context = super.produce(ctx); // Register the context in the OSGi registry BundleContext bundle = BundleContextUtils.getBundleContext(getClass()); context.getManagementStrategy().addEventNotifier(new OsgiCamelContextPublisher(bundle)); if (!(context instanceof DefaultCamelContext)) { // Fail fast for the time being to avoid side effects by some methods get declared on the CamelContext interface throw new InjectionException("Camel CDI requires Camel context [" + context.getName() + "] to be a subtype of DefaultCamelContext"); } DefaultCamelContext adapted = context.adapt(DefaultCamelContext.class); adapted.setRegistry(OsgiCamelContextHelper.wrapRegistry(context, context.getRegistry(), bundle)); CamelContextNameStrategy strategy = context.getNameStrategy(); OsgiCamelContextHelper.osgiUpdate(adapted, bundle); // FIXME: the above call should not override explicit strategies provided by the end user or should decorate them instead of overriding them completely if (!(strategy instanceof DefaultCamelContextNameStrategy)) { context.setNameStrategy(strategy); } return context; } }
OrderComparator.sort(registries); final Registry registry = new CompositeRegistry(registries); defaultContext.setRegistry(registry);