use of org.apache.camel.spi.DataFormatFactory in project camel by apache.
the class BeanIODataFormatAutoConfiguration method configureBeanIODataFormatFactory.
@Bean(name = "beanio-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(BeanIODataFormat.class)
public DataFormatFactory configureBeanIODataFormatFactory(final CamelContext camelContext, final BeanIODataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
BeanIODataFormat dataformat = new BeanIODataFormat();
if (CamelContextAware.class.isAssignableFrom(BeanIODataFormat.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.spi.DataFormatFactory in project camel by apache.
the class AvroDataFormatAutoConfiguration method configureAvroDataFormatFactory.
@Bean(name = "avro-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(AvroDataFormat.class)
public DataFormatFactory configureAvroDataFormatFactory(final CamelContext camelContext, final AvroDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
AvroDataFormat dataformat = new AvroDataFormat();
if (CamelContextAware.class.isAssignableFrom(AvroDataFormat.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.spi.DataFormatFactory 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;
}
};
}
use of org.apache.camel.spi.DataFormatFactory in project camel by apache.
the class XmlJsonDataFormatAutoConfiguration method configureXmlJsonDataFormatFactory.
@Bean(name = "xmljson-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(XmlJsonDataFormat.class)
public DataFormatFactory configureXmlJsonDataFormatFactory(final CamelContext camelContext, final XmlJsonDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
XmlJsonDataFormat dataformat = new XmlJsonDataFormat();
if (CamelContextAware.class.isAssignableFrom(XmlJsonDataFormat.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.spi.DataFormatFactory 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;
}
};
}
Aggregations