use of org.apache.camel.spi.DataFormatFactory in project camel by apache.
the class HessianDataFormatAutoConfiguration method configureHessianDataFormatFactory.
@Bean(name = "hessian-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(HessianDataFormat.class)
public DataFormatFactory configureHessianDataFormatFactory(final CamelContext camelContext, final HessianDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
HessianDataFormat dataformat = new HessianDataFormat();
if (CamelContextAware.class.isAssignableFrom(HessianDataFormat.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 HL7DataFormatAutoConfiguration method configureHL7DataFormatFactory.
@Bean(name = "hl7-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(HL7DataFormat.class)
public DataFormatFactory configureHL7DataFormatFactory(final CamelContext camelContext, final HL7DataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
HL7DataFormat dataformat = new HL7DataFormat();
if (CamelContextAware.class.isAssignableFrom(HL7DataFormat.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 JaxbDataFormatAutoConfiguration method configureJaxbDataFormatFactory.
@Bean(name = "jaxb-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(JaxbDataFormat.class)
public DataFormatFactory configureJaxbDataFormatFactory(final CamelContext camelContext, final JaxbDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
JaxbDataFormat dataformat = new JaxbDataFormat();
if (CamelContextAware.class.isAssignableFrom(JaxbDataFormat.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 MimeMultipartDataFormatAutoConfiguration method configureMimeMultipartDataFormatFactory.
@Bean(name = "mime-multipart-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(MimeMultipartDataFormat.class)
public DataFormatFactory configureMimeMultipartDataFormatFactory(final CamelContext camelContext, final MimeMultipartDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
MimeMultipartDataFormat dataformat = new MimeMultipartDataFormat();
if (CamelContextAware.class.isAssignableFrom(MimeMultipartDataFormat.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 JohnzonDataFormatAutoConfiguration method configureJohnzonDataFormatFactory.
@Bean(name = "json-johnzon-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(JohnzonDataFormat.class)
public DataFormatFactory configureJohnzonDataFormatFactory(final CamelContext camelContext, final JohnzonDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
JohnzonDataFormat dataformat = new JohnzonDataFormat();
if (CamelContextAware.class.isAssignableFrom(JohnzonDataFormat.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