Search in sources :

Example 1 with ExchangePropertyLanguage

use of org.apache.camel.language.property.ExchangePropertyLanguage 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 2 with ExchangePropertyLanguage

use of org.apache.camel.language.property.ExchangePropertyLanguage in project camel by apache.

the class PropertyTest method testSingleton.

public void testSingleton() {
    ExchangePropertyLanguage prop = new ExchangePropertyLanguage();
    assertTrue(prop.isSingleton());
}
Also used : ExchangePropertyLanguage(org.apache.camel.language.property.ExchangePropertyLanguage)

Aggregations

ExchangePropertyLanguage (org.apache.camel.language.property.ExchangePropertyLanguage)2 HashMap (java.util.HashMap)1 CamelContextAware (org.apache.camel.CamelContextAware)1 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)1 ConditionalOnClass (org.springframework.boot.autoconfigure.condition.ConditionalOnClass)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 Bean (org.springframework.context.annotation.Bean)1 Scope (org.springframework.context.annotation.Scope)1