Search in sources :

Example 1 with Scope

use of org.springframework.context.annotation.Scope in project camel by apache.

the class XMLTokenizeLanguageAutoConfiguration method configureXMLTokenizeLanguage.

@Bean(name = "xtokenize-language")
@Scope("prototype")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(XMLTokenizeLanguage.class)
public XMLTokenizeLanguage configureXMLTokenizeLanguage(CamelContext camelContext, XMLTokenizeLanguageConfiguration configuration) 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);
    IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), language, parameters);
    return language;
}
Also used : CamelContextAware(org.apache.camel.CamelContextAware) HashMap(java.util.HashMap) XMLTokenizeLanguage(org.apache.camel.language.tokenizer.XMLTokenizeLanguage) Scope(org.springframework.context.annotation.Scope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnClass(org.springframework.boot.autoconfigure.condition.ConditionalOnClass) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with Scope

use of org.springframework.context.annotation.Scope in project camel by apache.

the class BeanLanguageAutoConfiguration method configureBeanLanguage.

@Bean(name = "bean-language")
@Scope("prototype")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(BeanLanguage.class)
public BeanLanguage configureBeanLanguage(CamelContext camelContext, BeanLanguageConfiguration configuration) 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);
    IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), language, parameters);
    return language;
}
Also used : CamelContextAware(org.apache.camel.CamelContextAware) HashMap(java.util.HashMap) BeanLanguage(org.apache.camel.language.bean.BeanLanguage) Scope(org.springframework.context.annotation.Scope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnClass(org.springframework.boot.autoconfigure.condition.ConditionalOnClass) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 3 with Scope

use of org.springframework.context.annotation.Scope in project camel by apache.

the class ExchangePropertyLanguageAutoConfiguration method configureExchangePropertyLanguage.

@Bean(name = "exchangeProperty-language")
@Scope("prototype")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(ExchangePropertyLanguage.class)
public ExchangePropertyLanguage configureExchangePropertyLanguage(CamelContext camelContext, ExchangePropertyLanguageConfiguration configuration) 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);
    IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), language, parameters);
    return language;
}
Also used : CamelContextAware(org.apache.camel.CamelContextAware) HashMap(java.util.HashMap) ExchangePropertyLanguage(org.apache.camel.language.property.ExchangePropertyLanguage) Scope(org.springframework.context.annotation.Scope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnClass(org.springframework.boot.autoconfigure.condition.ConditionalOnClass) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 4 with Scope

use of org.springframework.context.annotation.Scope in project camel by apache.

the class SpelLanguageAutoConfiguration method configureSpelLanguage.

@Bean(name = "spel-language")
@Scope("prototype")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(SpelLanguage.class)
public SpelLanguage configureSpelLanguage(CamelContext camelContext, SpelLanguageConfiguration configuration) 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);
    IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), language, parameters);
    return language;
}
Also used : SpelLanguage(org.apache.camel.language.spel.SpelLanguage) CamelContextAware(org.apache.camel.CamelContextAware) HashMap(java.util.HashMap) Scope(org.springframework.context.annotation.Scope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnClass(org.springframework.boot.autoconfigure.condition.ConditionalOnClass) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 5 with Scope

use of org.springframework.context.annotation.Scope in project camel by apache.

the class OgnlLanguageAutoConfiguration method configureOgnlLanguage.

@Bean(name = "ognl-language")
@Scope("prototype")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(OgnlLanguage.class)
public OgnlLanguage configureOgnlLanguage(CamelContext camelContext, OgnlLanguageConfiguration configuration) 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);
    IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), language, parameters);
    return language;
}
Also used : CamelContextAware(org.apache.camel.CamelContextAware) HashMap(java.util.HashMap) OgnlLanguage(org.apache.camel.language.ognl.OgnlLanguage) Scope(org.springframework.context.annotation.Scope) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnClass(org.springframework.boot.autoconfigure.condition.ConditionalOnClass) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

Bean (org.springframework.context.annotation.Bean)27 Scope (org.springframework.context.annotation.Scope)27 HashMap (java.util.HashMap)24 CamelContextAware (org.apache.camel.CamelContextAware)24 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)24 ConditionalOnClass (org.springframework.boot.autoconfigure.condition.ConditionalOnClass)24 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)24 JavaScriptLanguage (org.apache.camel.builder.script.JavaScriptLanguage)1 PhpLanguage (org.apache.camel.builder.script.PhpLanguage)1 PythonLanguage (org.apache.camel.builder.script.PythonLanguage)1 RubyLanguage (org.apache.camel.builder.script.RubyLanguage)1 TerserLanguage (org.apache.camel.component.hl7.TerserLanguage)1 JsonPathLanguage (org.apache.camel.jsonpath.JsonPathLanguage)1 BeanLanguage (org.apache.camel.language.bean.BeanLanguage)1 ConstantLanguage (org.apache.camel.language.constant.ConstantLanguage)1 GroovyLanguage (org.apache.camel.language.groovy.GroovyLanguage)1 HeaderLanguage (org.apache.camel.language.header.HeaderLanguage)1 JuelLanguage (org.apache.camel.language.juel.JuelLanguage)1 JXPathLanguage (org.apache.camel.language.jxpath.JXPathLanguage)1 MvelLanguage (org.apache.camel.language.mvel.MvelLanguage)1