use of org.apache.camel.CamelContextAware in project camel by apache.
the class XMLSecurityDataFormatAutoConfiguration method configureXMLSecurityDataFormatFactory.
@Bean(name = "secureXML-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(XMLSecurityDataFormat.class)
public DataFormatFactory configureXMLSecurityDataFormatFactory(final CamelContext camelContext, final XMLSecurityDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
XMLSecurityDataFormat dataformat = new XMLSecurityDataFormat();
if (CamelContextAware.class.isAssignableFrom(XMLSecurityDataFormat.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 XStreamDataFormatAutoConfiguration method configureXStreamDataFormatFactory.
@Bean(name = "xstream-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(XStreamDataFormat.class)
public DataFormatFactory configureXStreamDataFormatFactory(final CamelContext camelContext, final XStreamDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
XStreamDataFormat dataformat = new XStreamDataFormat();
if (CamelContextAware.class.isAssignableFrom(XStreamDataFormat.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 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;
}
use of org.apache.camel.CamelContextAware in project camel by apache.
the class SyslogDataFormatAutoConfiguration method configureSyslogDataFormatFactory.
@Bean(name = "syslog-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(SyslogDataFormat.class)
public DataFormatFactory configureSyslogDataFormatFactory(final CamelContext camelContext, final SyslogDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
SyslogDataFormat dataformat = new SyslogDataFormat();
if (CamelContextAware.class.isAssignableFrom(SyslogDataFormat.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 TidyMarkupDataFormatAutoConfiguration method configureTidyMarkupDataFormatFactory.
@Bean(name = "tidyMarkup-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(TidyMarkupDataFormat.class)
public DataFormatFactory configureTidyMarkupDataFormatFactory(final CamelContext camelContext, final TidyMarkupDataFormatConfiguration configuration) {
return new DataFormatFactory() {
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);
IntrospectionSupport.setProperties(camelContext, camelContext.getTypeConverter(), dataformat, parameters);
} catch (Exception e) {
throw new RuntimeCamelException(e);
}
return dataformat;
}
};
}
Aggregations