org.apache.camel.CamelContextAware Java Examples
The following examples show how to use
org.apache.camel.CamelContextAware.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KnativeComponent.java From camel-k-runtime with Apache License 2.0 | 6 votes |
@Override protected void doInit() throws Exception { super.doInit(); if (transport == null) { this.transport = getCamelContext().getRegistry().lookupByNameAndType(protocol.name(), KnativeTransport.class); if (this.transport == null) { this.transport = getCamelContext() .adapt(ExtendedCamelContext.class) .getFactoryFinder(Knative.KNATIVE_TRANSPORT_RESOURCE_PATH) .newInstance(protocol.name(), KnativeTransport.class) .orElseThrow(() -> new RuntimeException("Error creating knative transport for protocol: " + protocol.name())); } } if (this.transport instanceof CamelContextAware) { CamelContextAware camelContextAware = (CamelContextAware)this.transport; if (camelContextAware.getCamelContext() == null) { camelContextAware.setCamelContext(getCamelContext()); } } LOGGER.info("found knative transport: {} for protocol: {}", transport, protocol.name()); }
Example #2
Source File: HandlerCustomizer.java From syndesis with Apache License 2.0 | 5 votes |
public static void customizeComponent(final CamelContext context, final Connector connector, final ConnectorDescriptor descriptor, final Component component, final Map<String, Object> properties) { final List<String> customizers = CollectionsUtils.aggregate(ArrayList::new, connector.getConnectorCustomizers(), descriptor.getConnectorCustomizers()); // Set input/output data shape if the component proxy implements // Input/OutputDataShapeAware descriptor.getInputDataShape().ifPresent(ds -> trySetInputDataShape(component, ds)); descriptor.getOutputDataShape().ifPresent(ds -> trySetOutputDataShape(component, ds)); for (final String customizerType : customizers) { final ComponentCustomizer<Component> customizer = resolveCustomizer(context, customizerType); // Set the camel context if the customizer implements // the CamelContextAware interface. CamelContextAware.trySetCamelContext(customizer, context); // Set input/output data shape if the customizer implements // Input/OutputDataShapeAware descriptor.getInputDataShape().ifPresent(ds -> trySetInputDataShape(customizer, ds)); descriptor.getOutputDataShape().ifPresent(ds -> trySetOutputDataShape(customizer, ds)); // Try to set properties to the component setProperties(context, customizer, properties); // Invoke the customizer customizer.customize(component, properties); } }
Example #3
Source File: XPathLanguageAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "xpath-language") @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @ConditionalOnMissingBean(XPathLanguage.class) public XPathLanguage configureXPathLanguage() throws Exception { XPathLanguage language = new XPathLanguage(); if (CamelContextAware.class.isAssignableFrom(XPathLanguage.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(language); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, language, parameters, false); if (ObjectHelper.isNotEmpty(customizers)) { for (LanguageCustomizer<XPathLanguage> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.xpath.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.xpath.customizer"); if (useCustomizer) { LOGGER.debug("Configure language {}, with customizer {}", language, customizer); customizer.customize(language); } } } return language; }
Example #4
Source File: MvelLanguageAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "mvel-language") @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @ConditionalOnMissingBean(MvelLanguage.class) public MvelLanguage configureMvelLanguage() throws Exception { MvelLanguage language = new MvelLanguage(); if (CamelContextAware.class.isAssignableFrom(MvelLanguage.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(language); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, language, parameters, false); if (ObjectHelper.isNotEmpty(customizers)) { for (LanguageCustomizer<MvelLanguage> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.mvel.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.mvel.customizer"); if (useCustomizer) { LOGGER.debug("Configure language {}, with customizer {}", language, customizer); customizer.customize(language); } } } return language; }
Example #5
Source File: GroovyLanguageAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "groovy-language") @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @ConditionalOnMissingBean(GroovyLanguage.class) public GroovyLanguage configureGroovyLanguage() throws Exception { GroovyLanguage language = new GroovyLanguage(); if (CamelContextAware.class.isAssignableFrom(GroovyLanguage.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(language); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, language, parameters, false); if (ObjectHelper.isNotEmpty(customizers)) { for (LanguageCustomizer<GroovyLanguage> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.groovy.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.groovy.customizer"); if (useCustomizer) { LOGGER.debug("Configure language {}, with customizer {}", language, customizer); customizer.customize(language); } } } return language; }
Example #6
Source File: CoreResource.java From camel-quarkus with Apache License 2.0 | 5 votes |
@Path("/registry/camel-context-aware/initialized") @GET @Produces(MediaType.TEXT_PLAIN) public boolean camelContextAwareBeansHaveContextSet() { return registry.findByType(CamelContextAware.class).stream() .filter(camelContextAware -> camelContextAware.getCamelContext() == null) .collect(Collectors.toList()) .isEmpty(); }
Example #7
Source File: XMLTokenizeLanguageAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "xtokenize-language") @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @ConditionalOnMissingBean(XMLTokenizeLanguage.class) public XMLTokenizeLanguage configureXMLTokenizeLanguage() throws Exception { XMLTokenizeLanguage language = new XMLTokenizeLanguage(); if (CamelContextAware.class.isAssignableFrom(XMLTokenizeLanguage.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(language); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, language, parameters, false); if (ObjectHelper.isNotEmpty(customizers)) { for (LanguageCustomizer<XMLTokenizeLanguage> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.xtokenize.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.xtokenize.customizer"); if (useCustomizer) { LOGGER.debug("Configure language {}, with customizer {}", language, customizer); customizer.customize(language); } } } return language; }
Example #8
Source File: SpelLanguageAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "spel-language") @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @ConditionalOnMissingBean(SpelLanguage.class) public SpelLanguage configureSpelLanguage() throws Exception { SpelLanguage language = new SpelLanguage(); if (CamelContextAware.class.isAssignableFrom(SpelLanguage.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(language); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, language, parameters, false); if (ObjectHelper.isNotEmpty(customizers)) { for (LanguageCustomizer<SpelLanguage> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.spel.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.spel.customizer"); if (useCustomizer) { LOGGER.debug("Configure language {}, with customizer {}", language, customizer); customizer.customize(language); } } } return language; }
Example #9
Source File: CamelMainSupport.java From camel-kafka-connector with Apache License 2.0 | 5 votes |
private DataFormat lookupAndInstantiateDataformat(String dataformatName) { DataFormat df = camel.resolveDataFormat(dataformatName); if (df == null) { df = camel.createDataFormat(dataformatName); final String prefix = CAMEL_DATAFORMAT_PROPERTIES_PREFIX + dataformatName + "."; final Properties props = camel.getPropertiesComponent().loadProperties(k -> k.startsWith(prefix)); CamelContextAware.trySetCamelContext(df, camel); if (!props.isEmpty()) { PropertyBindingSupport.build() .withCamelContext(camel) .withOptionPrefix(prefix) .withRemoveParameters(false) .withProperties((Map) props) .withTarget(df) .bind(); } } //TODO: move it to the caller? if (df == null) { throw new UnsupportedOperationException("No DataFormat found with name " + dataformatName); } return df; }
Example #10
Source File: BeanLanguageAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "bean-language") @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @ConditionalOnMissingBean(BeanLanguage.class) public BeanLanguage configureBeanLanguage() throws Exception { BeanLanguage language = new BeanLanguage(); if (CamelContextAware.class.isAssignableFrom(BeanLanguage.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(language); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, language, parameters, false); if (ObjectHelper.isNotEmpty(customizers)) { for (LanguageCustomizer<BeanLanguage> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.bean.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.bean.customizer"); if (useCustomizer) { LOGGER.debug("Configure language {}, with customizer {}", language, customizer); customizer.customize(language); } } } return language; }
Example #11
Source File: XQueryLanguageAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "xquery-language") @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @ConditionalOnMissingBean(XQueryLanguage.class) public XQueryLanguage configureXQueryLanguage() throws Exception { XQueryLanguage language = new XQueryLanguage(); if (CamelContextAware.class.isAssignableFrom(XQueryLanguage.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(language); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, language, parameters, false); if (ObjectHelper.isNotEmpty(customizers)) { for (LanguageCustomizer<XQueryLanguage> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.xquery.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.xquery.customizer"); if (useCustomizer) { LOGGER.debug("Configure language {}, with customizer {}", language, customizer); customizer.customize(language); } } } return language; }
Example #12
Source File: OgnlLanguageAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "ognl-language") @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @ConditionalOnMissingBean(OgnlLanguage.class) public OgnlLanguage configureOgnlLanguage() throws Exception { OgnlLanguage language = new OgnlLanguage(); if (CamelContextAware.class.isAssignableFrom(OgnlLanguage.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(language); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, language, parameters, false); if (ObjectHelper.isNotEmpty(customizers)) { for (LanguageCustomizer<OgnlLanguage> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.ognl.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.ognl.customizer"); if (useCustomizer) { LOGGER.debug("Configure language {}, with customizer {}", language, customizer); customizer.customize(language); } } } return language; }
Example #13
Source File: ConstantLanguageAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "constant-language") @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @ConditionalOnMissingBean(ConstantLanguage.class) public ConstantLanguage configureConstantLanguage() throws Exception { ConstantLanguage language = new ConstantLanguage(); if (CamelContextAware.class.isAssignableFrom(ConstantLanguage.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(language); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, language, parameters, false); if (ObjectHelper.isNotEmpty(customizers)) { for (LanguageCustomizer<ConstantLanguage> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.constant.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.constant.customizer"); if (useCustomizer) { LOGGER.debug("Configure language {}, with customizer {}", language, customizer); customizer.customize(language); } } } return language; }
Example #14
Source File: ExchangePropertyLanguageAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "exchangeProperty-language") @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @ConditionalOnMissingBean(ExchangePropertyLanguage.class) public ExchangePropertyLanguage configureExchangePropertyLanguage() throws Exception { ExchangePropertyLanguage language = new ExchangePropertyLanguage(); if (CamelContextAware.class.isAssignableFrom(ExchangePropertyLanguage.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(language); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, language, parameters, false); if (ObjectHelper.isNotEmpty(customizers)) { for (LanguageCustomizer<ExchangePropertyLanguage> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.exchangeproperty.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.exchangeproperty.customizer"); if (useCustomizer) { LOGGER.debug("Configure language {}, with customizer {}", language, customizer); customizer.customize(language); } } } return language; }
Example #15
Source File: RefLanguageAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "ref-language") @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @ConditionalOnMissingBean(RefLanguage.class) public RefLanguage configureRefLanguage() throws Exception { RefLanguage language = new RefLanguage(); if (CamelContextAware.class.isAssignableFrom(RefLanguage.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(language); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, language, parameters, false); if (ObjectHelper.isNotEmpty(customizers)) { for (LanguageCustomizer<RefLanguage> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.ref.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.ref.customizer"); if (useCustomizer) { LOGGER.debug("Configure language {}, with customizer {}", language, customizer); customizer.customize(language); } } } return language; }
Example #16
Source File: FileLanguageAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "file-language") @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @ConditionalOnMissingBean(FileLanguage.class) public FileLanguage configureFileLanguage() throws Exception { FileLanguage language = new FileLanguage(); if (CamelContextAware.class.isAssignableFrom(FileLanguage.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(language); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, language, parameters, false); if (ObjectHelper.isNotEmpty(customizers)) { for (LanguageCustomizer<FileLanguage> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.file.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.file.customizer"); if (useCustomizer) { LOGGER.debug("Configure language {}, with customizer {}", language, customizer); customizer.customize(language); } } } return language; }
Example #17
Source File: SimpleLanguageAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "simple-language") @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @ConditionalOnMissingBean(SimpleLanguage.class) public SimpleLanguage configureSimpleLanguage() throws Exception { SimpleLanguage language = new SimpleLanguage(); if (CamelContextAware.class.isAssignableFrom(SimpleLanguage.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(language); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, language, parameters, false); if (ObjectHelper.isNotEmpty(customizers)) { for (LanguageCustomizer<SimpleLanguage> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.simple.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.simple.customizer"); if (useCustomizer) { LOGGER.debug("Configure language {}, with customizer {}", language, customizer); customizer.customize(language); } } } return language; }
Example #18
Source File: HeaderLanguageAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "header-language") @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @ConditionalOnMissingBean(HeaderLanguage.class) public HeaderLanguage configureHeaderLanguage() throws Exception { HeaderLanguage language = new HeaderLanguage(); if (CamelContextAware.class.isAssignableFrom(HeaderLanguage.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(language); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, language, parameters, false); if (ObjectHelper.isNotEmpty(customizers)) { for (LanguageCustomizer<HeaderLanguage> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.header.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.header.customizer"); if (useCustomizer) { LOGGER.debug("Configure language {}, with customizer {}", language, customizer); customizer.customize(language); } } } return language; }
Example #19
Source File: TokenizeLanguageAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "tokenize-language") @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @ConditionalOnMissingBean(TokenizeLanguage.class) public TokenizeLanguage configureTokenizeLanguage() throws Exception { TokenizeLanguage language = new TokenizeLanguage(); if (CamelContextAware.class.isAssignableFrom(TokenizeLanguage.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(language); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, language, parameters, false); if (ObjectHelper.isNotEmpty(customizers)) { for (LanguageCustomizer<TokenizeLanguage> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.tokenize.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.tokenize.customizer"); if (useCustomizer) { LOGGER.debug("Configure language {}, with customizer {}", language, customizer); customizer.customize(language); } } } return language; }
Example #20
Source File: ComponentProxyComponent.java From syndesis with Apache License 2.0 | 5 votes |
@Override protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) { // merge parameters final Map<String, Object> options = new HashMap<>(); doAddOptions(options, this.remainingOptions); doAddOptions(options, parameters); // create the uri of the base component, DO NOT log the computed delegate final Map<String, String> endpointOptions = buildEndpointOptions(remaining, options); final String endpointScheme = componentSchemeAlias.orElse(componentScheme); ComponentDefinition definition = getDefinition(); final Endpoint delegate = createDelegateEndpoint(definition, endpointScheme, endpointOptions); LOGGER.info("Connector resolved: {} -> {}", URISupport.sanitizeUri(uri), URISupport.sanitizeUri(delegate.getEndpointUri())); // remove options already set on the endpoint options.keySet().removeIf(endpointOptions::containsKey); // Configure the delegated endpoint configureDelegateEndpoint(definition, delegate, options); final ComponentProxyEndpoint answer = new ComponentProxyEndpoint(uri, this, delegate); answer.setBeforeProducer(CamelContextAware.trySetCamelContext(getBeforeProducer(), getCamelContext())); answer.setAfterProducer(CamelContextAware.trySetCamelContext(getAfterProducer(), getCamelContext())); answer.setBeforeConsumer(CamelContextAware.trySetCamelContext(getBeforeConsumer(), getCamelContext())); answer.setAfterConsumer(CamelContextAware.trySetCamelContext(getAfterConsumer(), getCamelContext())); // clean-up parameters so that validation won't fail later on // in DefaultConnectorComponent.validateParameters() parameters.clear(); // remove temporary options this.remainingOptions.clear(); return answer; }
Example #21
Source File: Hl7TerserLanguageAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "hl7terser-language") @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @ConditionalOnMissingBean(Hl7TerserLanguage.class) public Hl7TerserLanguage configureHl7TerserLanguage() throws Exception { Hl7TerserLanguage language = new Hl7TerserLanguage(); if (CamelContextAware.class.isAssignableFrom(Hl7TerserLanguage.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(language); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, language, parameters, false); if (ObjectHelper.isNotEmpty(customizers)) { for (LanguageCustomizer<Hl7TerserLanguage> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.hl7terser.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.hl7terser.customizer"); if (useCustomizer) { LOGGER.debug("Configure language {}, with customizer {}", language, customizer); customizer.customize(language); } } } return language; }
Example #22
Source File: JsonPathLanguageAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 5 votes |
@Bean(name = "jsonpath-language") @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) @ConditionalOnMissingBean(JsonPathLanguage.class) public JsonPathLanguage configureJsonPathLanguage() throws Exception { JsonPathLanguage language = new JsonPathLanguage(); if (CamelContextAware.class.isAssignableFrom(JsonPathLanguage.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(language); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, language, parameters, false); if (ObjectHelper.isNotEmpty(customizers)) { for (LanguageCustomizer<JsonPathLanguage> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.jsonpath.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.language.customizer", "camel.language.jsonpath.customizer"); if (useCustomizer) { LOGGER.debug("Configure language {}, with customizer {}", language, customizer); customizer.customize(language); } } } return language; }
Example #23
Source File: CBORDataFormatAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 4 votes |
@Bean(name = "cbor-dataformat-factory") @ConditionalOnMissingBean(CBORDataFormat.class) public DataFormatFactory configureCBORDataFormatFactory() throws Exception { return new DataFormatFactory() { @Override public DataFormat newInstance() { CBORDataFormat dataformat = new CBORDataFormat(); if (CamelContextAware.class .isAssignableFrom(CBORDataFormat.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(dataformat); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } try { Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, dataformat, parameters, false); } catch (Exception e) { throw new RuntimeCamelException(e); } if (ObjectHelper.isNotEmpty(customizers)) { for (DataFormatCustomizer<CBORDataFormat> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.dataformat.customizer", "camel.dataformat.cbor.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.dataformat.customizer", "camel.dataformat.cbor.customizer"); if (useCustomizer) { LOGGER.debug( "Configure dataformat {}, with customizer {}", dataformat, customizer); customizer.customize(dataformat); } } } return dataformat; } }; }
Example #24
Source File: JacksonXMLDataFormatAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 4 votes |
@Bean(name = "jacksonxml-dataformat-factory") @ConditionalOnMissingBean(JacksonXMLDataFormat.class) public DataFormatFactory configureJacksonXMLDataFormatFactory() throws Exception { return new DataFormatFactory() { @Override public DataFormat newInstance() { JacksonXMLDataFormat dataformat = new JacksonXMLDataFormat(); if (CamelContextAware.class .isAssignableFrom(JacksonXMLDataFormat.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(dataformat); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } try { Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, dataformat, parameters, false); } catch (Exception e) { throw new RuntimeCamelException(e); } if (ObjectHelper.isNotEmpty(customizers)) { for (DataFormatCustomizer<JacksonXMLDataFormat> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.dataformat.customizer", "camel.dataformat.jacksonxml.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.dataformat.customizer", "camel.dataformat.jacksonxml.customizer"); if (useCustomizer) { LOGGER.debug( "Configure dataformat {}, with customizer {}", dataformat, customizer); customizer.customize(dataformat); } } } return dataformat; } }; }
Example #25
Source File: BindyKeyValuePairDataFormatAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 4 votes |
@Bean(name = "bindy-kvp-dataformat-factory") @ConditionalOnMissingBean(BindyKeyValuePairDataFormat.class) public DataFormatFactory configureBindyKeyValuePairDataFormatFactory() throws Exception { return new DataFormatFactory() { @Override public DataFormat newInstance() { BindyKeyValuePairDataFormat dataformat = new BindyKeyValuePairDataFormat(); if (CamelContextAware.class .isAssignableFrom(BindyKeyValuePairDataFormat.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(dataformat); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } try { Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, dataformat, parameters, false); } catch (Exception e) { throw new RuntimeCamelException(e); } if (ObjectHelper.isNotEmpty(customizers)) { for (DataFormatCustomizer<BindyKeyValuePairDataFormat> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.dataformat.customizer", "camel.dataformat.bindy-kvp.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.dataformat.customizer", "camel.dataformat.bindy-kvp.customizer"); if (useCustomizer) { LOGGER.debug( "Configure dataformat {}, with customizer {}", dataformat, customizer); customizer.customize(dataformat); } } } return dataformat; } }; }
Example #26
Source File: BindyCsvDataFormatAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 4 votes |
@Bean(name = "bindy-csv-dataformat-factory") @ConditionalOnMissingBean(BindyCsvDataFormat.class) public DataFormatFactory configureBindyCsvDataFormatFactory() throws Exception { return new DataFormatFactory() { @Override public DataFormat newInstance() { BindyCsvDataFormat dataformat = new BindyCsvDataFormat(); if (CamelContextAware.class .isAssignableFrom(BindyCsvDataFormat.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(dataformat); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } try { Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, dataformat, parameters, false); } catch (Exception e) { throw new RuntimeCamelException(e); } if (ObjectHelper.isNotEmpty(customizers)) { for (DataFormatCustomizer<BindyCsvDataFormat> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.dataformat.customizer", "camel.dataformat.bindy-csv.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.dataformat.customizer", "camel.dataformat.bindy-csv.customizer"); if (useCustomizer) { LOGGER.debug( "Configure dataformat {}, with customizer {}", dataformat, customizer); customizer.customize(dataformat); } } } return dataformat; } }; }
Example #27
Source File: LZFDataFormatAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 4 votes |
@Bean(name = "lzf-dataformat-factory") @ConditionalOnMissingBean(LZFDataFormat.class) public DataFormatFactory configureLZFDataFormatFactory() throws Exception { return new DataFormatFactory() { @Override public DataFormat newInstance() { LZFDataFormat dataformat = new LZFDataFormat(); if (CamelContextAware.class .isAssignableFrom(LZFDataFormat.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(dataformat); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } try { Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, dataformat, parameters, false); } catch (Exception e) { throw new RuntimeCamelException(e); } if (ObjectHelper.isNotEmpty(customizers)) { for (DataFormatCustomizer<LZFDataFormat> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.dataformat.customizer", "camel.dataformat.lzf.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.dataformat.customizer", "camel.dataformat.lzf.customizer"); if (useCustomizer) { LOGGER.debug( "Configure dataformat {}, with customizer {}", dataformat, customizer); customizer.customize(dataformat); } } } return dataformat; } }; }
Example #28
Source File: BeanIODataFormatAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 4 votes |
@Bean(name = "beanio-dataformat-factory") @ConditionalOnMissingBean(BeanIODataFormat.class) public DataFormatFactory configureBeanIODataFormatFactory() throws Exception { return new DataFormatFactory() { @Override public DataFormat newInstance() { BeanIODataFormat dataformat = new BeanIODataFormat(); if (CamelContextAware.class .isAssignableFrom(BeanIODataFormat.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(dataformat); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } try { Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, dataformat, parameters, false); } catch (Exception e) { throw new RuntimeCamelException(e); } if (ObjectHelper.isNotEmpty(customizers)) { for (DataFormatCustomizer<BeanIODataFormat> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.dataformat.customizer", "camel.dataformat.beanio.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.dataformat.customizer", "camel.dataformat.beanio.customizer"); if (useCustomizer) { LOGGER.debug( "Configure dataformat {}, with customizer {}", dataformat, customizer); customizer.customize(dataformat); } } } return dataformat; } }; }
Example #29
Source File: TidyMarkupDataFormatAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 4 votes |
@Bean(name = "tidyMarkup-dataformat-factory") @ConditionalOnMissingBean(TidyMarkupDataFormat.class) public DataFormatFactory configureTidyMarkupDataFormatFactory() throws Exception { return new DataFormatFactory() { @Override public DataFormat newInstance() { TidyMarkupDataFormat dataformat = new TidyMarkupDataFormat(); if (CamelContextAware.class .isAssignableFrom(TidyMarkupDataFormat.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(dataformat); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } try { Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, dataformat, parameters, false); } catch (Exception e) { throw new RuntimeCamelException(e); } if (ObjectHelper.isNotEmpty(customizers)) { for (DataFormatCustomizer<TidyMarkupDataFormat> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.dataformat.customizer", "camel.dataformat.tidymarkup.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.dataformat.customizer", "camel.dataformat.tidymarkup.customizer"); if (useCustomizer) { LOGGER.debug( "Configure dataformat {}, with customizer {}", dataformat, customizer); customizer.customize(dataformat); } } } return dataformat; } }; }
Example #30
Source File: ThriftDataFormatAutoConfiguration.java From camel-spring-boot with Apache License 2.0 | 4 votes |
@Bean(name = "thrift-dataformat-factory") @ConditionalOnMissingBean(ThriftDataFormat.class) public DataFormatFactory configureThriftDataFormatFactory() throws Exception { return new DataFormatFactory() { @Override public DataFormat newInstance() { ThriftDataFormat dataformat = new ThriftDataFormat(); if (CamelContextAware.class .isAssignableFrom(ThriftDataFormat.class)) { CamelContextAware contextAware = CamelContextAware.class .cast(dataformat); if (contextAware != null) { contextAware.setCamelContext(camelContext); } } try { Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null, false); CamelPropertiesHelper.setCamelProperties(camelContext, dataformat, parameters, false); } catch (Exception e) { throw new RuntimeCamelException(e); } if (ObjectHelper.isNotEmpty(customizers)) { for (DataFormatCustomizer<ThriftDataFormat> customizer : customizers) { boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.dataformat.customizer", "camel.dataformat.thrift.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate( applicationContext.getEnvironment(), "camel.dataformat.customizer", "camel.dataformat.thrift.customizer"); if (useCustomizer) { LOGGER.debug( "Configure dataformat {}, with customizer {}", dataformat, customizer); customizer.customize(dataformat); } } } return dataformat; } }; }