Search in sources :

Example 11 with Scope

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

the class JavaScriptLanguageAutoConfiguration method configureJavaScriptLanguage.

@Bean(name = "javaScript-language")
@Scope("prototype")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(JavaScriptLanguage.class)
public JavaScriptLanguage configureJavaScriptLanguage(CamelContext camelContext, JavaScriptLanguageConfiguration configuration) throws Exception {
    JavaScriptLanguage language = new JavaScriptLanguage();
    if (CamelContextAware.class.isAssignableFrom(JavaScriptLanguage.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 : JavaScriptLanguage(org.apache.camel.builder.script.JavaScriptLanguage) 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 12 with Scope

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

the class PythonLanguageAutoConfiguration method configurePythonLanguage.

@Bean(name = "python-language")
@Scope("prototype")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(PythonLanguage.class)
public PythonLanguage configurePythonLanguage(CamelContext camelContext, PythonLanguageConfiguration configuration) throws Exception {
    PythonLanguage language = new PythonLanguage();
    if (CamelContextAware.class.isAssignableFrom(PythonLanguage.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) PythonLanguage(org.apache.camel.builder.script.PythonLanguage) 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 13 with Scope

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

the class ConstantLanguageAutoConfiguration method configureConstantLanguage.

@Bean(name = "constant-language")
@Scope("prototype")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(ConstantLanguage.class)
public ConstantLanguage configureConstantLanguage(CamelContext camelContext, ConstantLanguageConfiguration configuration) 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);
    IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), language, parameters);
    return language;
}
Also used : ConstantLanguage(org.apache.camel.language.constant.ConstantLanguage) 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 14 with Scope

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

the class HeaderLanguageAutoConfiguration method configureHeaderLanguage.

@Bean(name = "header-language")
@Scope("prototype")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(HeaderLanguage.class)
public HeaderLanguage configureHeaderLanguage(CamelContext camelContext, HeaderLanguageConfiguration configuration) 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);
    IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), language, parameters);
    return language;
}
Also used : HeaderLanguage(org.apache.camel.language.header.HeaderLanguage) 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 15 with Scope

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

the class RefLanguageAutoConfiguration method configureRefLanguage.

@Bean(name = "ref-language")
@Scope("prototype")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(RefLanguage.class)
public RefLanguage configureRefLanguage(CamelContext camelContext, RefLanguageConfiguration configuration) 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);
    IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), language, parameters);
    return language;
}
Also used : CamelContextAware(org.apache.camel.CamelContextAware) HashMap(java.util.HashMap) RefLanguage(org.apache.camel.language.ref.RefLanguage) 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