use of org.apache.camel.dataformat.bindy.kvp.BindyKeyValuePairDataFormat in project camel by apache.
the class BindyComplexKeyValuePairStandaloneTest method init.
@Before
public void init() throws Exception {
// Set factory
BindyKeyValuePairDataFormat dataFormat = new BindyKeyValuePairDataFormat(org.apache.camel.dataformat.bindy.model.fix.complex.onetomany.Order.class);
factory = dataFormat.getFactory();
// Set model class
models.add(org.apache.camel.dataformat.bindy.model.fix.complex.onetomany.Order.class);
models.add(org.apache.camel.dataformat.bindy.model.fix.complex.onetomany.Header.class);
// f.models.add(org.apache.camel.dataformat.bindy.model.fix.complex.onetomany.Security.class);
models.add(org.apache.camel.dataformat.bindy.model.fix.complex.onetomany.Trailer.class);
// Init model
model.put("org.apache.camel.dataformat.bindy.model.fix.complex.onetomany.Order", new Order());
model.put("org.apache.camel.dataformat.bindy.model.fix.complex.onetomany.Header", new Header());
model.put("org.apache.camel.dataformat.bindy.model.fix.complex.onetomany.Trailer", new Trailer());
// set counter = 1
counter = 1;
}
use of org.apache.camel.dataformat.bindy.kvp.BindyKeyValuePairDataFormat in project camel by apache.
the class BindyKeyValuePairDataFormatAutoConfiguration method configureBindyKeyValuePairDataFormatFactory.
@Bean(name = "bindy-kvp-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(BindyKeyValuePairDataFormat.class)
public DataFormatFactory configureBindyKeyValuePairDataFormatFactory(final CamelContext camelContext, final BindyKeyValuePairDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
BindyKeyValuePairDataFormat dataformat = new BindyKeyValuePairDataFormat();
if (CamelContextAware.class.isAssignableFrom(BindyKeyValuePairDataFormat.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