use of org.apache.camel.dataformat.rss.RssDataFormat in project camel by apache.
the class RssDataFormatAutoConfiguration method configureRssDataFormatFactory.
@Bean(name = "rss-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(RssDataFormat.class)
public DataFormatFactory configureRssDataFormatFactory(final CamelContext camelContext, final RssDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
RssDataFormat dataformat = new RssDataFormat();
if (CamelContextAware.class.isAssignableFrom(RssDataFormat.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