use of org.apache.camel.spi.DataFormatFactory in project camel by apache.
the class ZipDataFormatAutoConfiguration method configureZipDataFormatFactory.
@Bean(name = "zip-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(ZipDataFormat.class)
public DataFormatFactory configureZipDataFormatFactory(final CamelContext camelContext, final ZipDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
ZipDataFormat dataformat = new ZipDataFormat();
if (CamelContextAware.class.isAssignableFrom(ZipDataFormat.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 JibxDataFormatAutoConfiguration method configureJibxDataFormatFactory.
@Bean(name = "jibx-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(JibxDataFormat.class)
public DataFormatFactory configureJibxDataFormatFactory(final CamelContext camelContext, final JibxDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
JibxDataFormat dataformat = new JibxDataFormat();
if (CamelContextAware.class.isAssignableFrom(JibxDataFormat.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 UniVocityTsvDataFormatAutoConfiguration method configureUniVocityTsvDataFormatFactory.
@Bean(name = "univocity-tsv-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(UniVocityTsvDataFormat.class)
public DataFormatFactory configureUniVocityTsvDataFormatFactory(final CamelContext camelContext, final UniVocityTsvDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
UniVocityTsvDataFormat dataformat = new UniVocityTsvDataFormat();
if (CamelContextAware.class.isAssignableFrom(UniVocityTsvDataFormat.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 XmlBeansDataFormatAutoConfiguration method configureXmlBeansDataFormatFactory.
@Bean(name = "xmlBeans-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(XmlBeansDataFormat.class)
public DataFormatFactory configureXmlBeansDataFormatFactory(final CamelContext camelContext, final XmlBeansDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
XmlBeansDataFormat dataformat = new XmlBeansDataFormat();
if (CamelContextAware.class.isAssignableFrom(XmlBeansDataFormat.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 SnakeYAMLDataFormatAutoConfiguration method configureSnakeYAMLDataFormatFactory.
@Bean(name = "yaml-snakeyaml-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(SnakeYAMLDataFormat.class)
public DataFormatFactory configureSnakeYAMLDataFormatFactory(final CamelContext camelContext, final SnakeYAMLDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
SnakeYAMLDataFormat dataformat = new SnakeYAMLDataFormat();
if (CamelContextAware.class.isAssignableFrom(SnakeYAMLDataFormat.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