use of org.apache.camel.CamelContextAware in project camel by apache.
the class TokenizeLanguageAutoConfiguration method configureTokenizeLanguage.
@Bean(name = "tokenize-language")
@Scope("prototype")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(TokenizeLanguage.class)
public TokenizeLanguage configureTokenizeLanguage(CamelContext camelContext, TokenizeLanguageConfiguration configuration) 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);
IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), language, parameters);
return language;
}
use of org.apache.camel.CamelContextAware in project camel by apache.
the class XPathLanguageAutoConfiguration method configureXPathLanguage.
@Bean(name = "xpath-language")
@Scope("prototype")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(XPathLanguage.class)
public XPathLanguage configureXPathLanguage(CamelContext camelContext, XPathLanguageConfiguration configuration) 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);
IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), language, parameters);
return language;
}
use of org.apache.camel.CamelContextAware in project camel by apache.
the class PGPDataFormatAutoConfiguration method configurePGPDataFormatFactory.
@Bean(name = "pgp-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(PGPDataFormat.class)
public DataFormatFactory configurePGPDataFormatFactory(final CamelContext camelContext, final PGPDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
PGPDataFormat dataformat = new PGPDataFormat();
if (CamelContextAware.class.isAssignableFrom(PGPDataFormat.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);
IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), dataformat, parameters);
} catch (Exception e) {
throw new RuntimeCamelException(e);
}
return dataformat;
}
};
}
use of org.apache.camel.CamelContextAware in project camel by apache.
the class JXPathLanguageAutoConfiguration method configureJXPathLanguage.
@Bean(name = "jxpath-language")
@Scope("prototype")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(JXPathLanguage.class)
public JXPathLanguage configureJXPathLanguage(CamelContext camelContext, JXPathLanguageConfiguration configuration) throws Exception {
JXPathLanguage language = new JXPathLanguage();
if (CamelContextAware.class.isAssignableFrom(JXPathLanguage.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;
}
use of org.apache.camel.CamelContextAware in project camel by apache.
the class GroovyLanguageAutoConfiguration method configureGroovyLanguage.
@Bean(name = "groovy-language")
@Scope("prototype")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(GroovyLanguage.class)
public GroovyLanguage configureGroovyLanguage(CamelContext camelContext, GroovyLanguageConfiguration configuration) 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);
IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), language, parameters);
return language;
}
Aggregations