use of org.apache.camel.spi.DataFormatFactory 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.spi.DataFormatFactory 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.spi.DataFormatFactory 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;
}
};
}
use of org.apache.camel.spi.DataFormatFactory in project camel by apache.
the class TarFileDataFormatAutoConfiguration method configureTarFileDataFormatFactory.
@Bean(name = "tarfile-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(TarFileDataFormat.class)
public DataFormatFactory configureTarFileDataFormatFactory(final CamelContext camelContext, final TarFileDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
TarFileDataFormat dataformat = new TarFileDataFormat();
if (CamelContextAware.class.isAssignableFrom(TarFileDataFormat.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 UniVocityCsvDataFormatAutoConfiguration method configureUniVocityCsvDataFormatFactory.
@Bean(name = "univocity-csv-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(UniVocityCsvDataFormat.class)
public DataFormatFactory configureUniVocityCsvDataFormatFactory(final CamelContext camelContext, final UniVocityCsvDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
UniVocityCsvDataFormat dataformat = new UniVocityCsvDataFormat();
if (CamelContextAware.class.isAssignableFrom(UniVocityCsvDataFormat.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