private SyntheticBean<?> camelContextBean(BeanManager manager, Class<?> beanClass, Annotation... qualifiers) { SyntheticAnnotated annotated = new SyntheticAnnotated(DefaultCamelContext.class, manager.createAnnotatedType(DefaultCamelContext.class).getTypeClosure(), beanClass, qualifiers); return new SyntheticBean<>(manager, annotated, DefaultCamelContext.class, environment.camelContextInjectionTarget( new SyntheticInjectionTarget<>(DefaultCamelContext::new), annotated, manager, this), bean -> "Default Camel context bean with qualifiers " + bean.getQualifiers()); }
private SyntheticBean<?> routesDefinitionBean(RoutesDefinition definition, URL url) { return new SyntheticBean<>(manager, // TODO: should be @Named if the id is set new SyntheticAnnotated(RoutesDefinition.class, manager.createAnnotatedType(RoutesDefinition.class).getTypeClosure(), ANY, DEFAULT), RoutesDefinition.class, new SyntheticInjectionTarget<>(() -> definition), bean -> "imported routes definition " + (hasId(definition) ? "[" + definition.getId() + "] " : "") + "from resource [" + url + "]"); }
private SyntheticBean<?> restContextBean(RestContextDefinition definition, URL url) { requireNonNull(definition.getId(), () -> format("Missing [%s] attribute for imported bean [%s] from resource [%s]", "id", "restContext", url)); return new SyntheticBean<>(manager, new SyntheticAnnotated(List.class, Stream.of(List.class, new ListParameterizedType(RestDefinition.class)) .collect(toSet()), ANY, NamedLiteral.of(definition.getId())), List.class, new SyntheticInjectionTarget<>(definition::getRests), bean -> "imported rest context with " + "id [" + definition.getId() + "] " + "from resource [" + url + "] " + "with qualifiers " + bean.getQualifiers()); }
private SyntheticBean<?> routeContextBean(RouteContextDefinition definition, URL url) { requireNonNull(definition.getId(), () -> format("Missing [%s] attribute for imported bean [%s] from resource [%s]", "id", "routeContext", url)); return new SyntheticBean<>(manager, new SyntheticAnnotated(List.class, Stream.of(List.class, new ListParameterizedType(RouteDefinition.class)) .collect(toSet()), ANY, NamedLiteral.of(definition.getId())), List.class, new SyntheticInjectionTarget<>(definition::getRoutes), bean -> "imported route context with " + "id [" + definition.getId() + "] " + "from resource [" + url + "] " + "with qualifiers " + bean.getQualifiers()); }
new SyntheticInjectionTarget<>(() -> { DefaultCamelContext context = createCamelContextWithTCCL(DefaultCamelContext::new, annotated); factory.setContext(context);