Search in sources :

Example 1 with BindyFixedLengthDataFormat

use of org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat in project camel by apache.

the class BindyFixedLengthDataFormatAutoConfiguration method configureBindyFixedLengthDataFormatFactory.

@Bean(name = "bindy-fixed-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(BindyFixedLengthDataFormat.class)
public DataFormatFactory configureBindyFixedLengthDataFormatFactory(final CamelContext camelContext, final BindyFixedLengthDataFormatConfiguration configuration) {
    return new DataFormatFactory() {

        public DataFormat newInstance() {
            BindyFixedLengthDataFormat dataformat = new BindyFixedLengthDataFormat();
            if (CamelContextAware.class.isAssignableFrom(BindyFixedLengthDataFormat.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;
        }
    };
}
Also used : DataFormatFactory(org.apache.camel.spi.DataFormatFactory) CamelContextAware(org.apache.camel.CamelContextAware) HashMap(java.util.HashMap) BindyFixedLengthDataFormat(org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat) RuntimeCamelException(org.apache.camel.RuntimeCamelException) RuntimeCamelException(org.apache.camel.RuntimeCamelException) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnClass(org.springframework.boot.autoconfigure.condition.ConditionalOnClass) ConditionalOnBean(org.springframework.boot.autoconfigure.condition.ConditionalOnBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 2 with BindyFixedLengthDataFormat

use of org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat in project camel by apache.

the class BindySimpleFixedLengthMarshallWithClipAndTrimTest method createRouteBuilder.

@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            BindyFixedLengthDataFormat bindy = new BindyFixedLengthDataFormat(Order.class);
            bindy.setLocale("en");
            from("direct:start").marshal(bindy).to("mock:result");
        }
    };
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) BindyFixedLengthDataFormat(org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat)

Example 3 with BindyFixedLengthDataFormat

use of org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat in project camel by apache.

the class BindySimpleFixedLengthMarshallWithClipTest method createRouteBuilder.

@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            BindyFixedLengthDataFormat bindy = new BindyFixedLengthDataFormat(Order.class);
            bindy.setLocale("en");
            from("direct:start").marshal(bindy).to("mock:result");
        }
    };
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) BindyFixedLengthDataFormat(org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat)

Example 4 with BindyFixedLengthDataFormat

use of org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat in project camel by apache.

the class BindySimpleFixedLengthMarshallWithNoClipTest method createRouteBuilder.

@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {

        @Override
        public void configure() throws Exception {
            BindyFixedLengthDataFormat bindy = new BindyFixedLengthDataFormat(Order.class);
            from("direct:start").marshal(bindy).to("mock:result");
        }
    };
}
Also used : RouteBuilder(org.apache.camel.builder.RouteBuilder) BindyFixedLengthDataFormat(org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat)

Aggregations

BindyFixedLengthDataFormat (org.apache.camel.dataformat.bindy.fixed.BindyFixedLengthDataFormat)4 RouteBuilder (org.apache.camel.builder.RouteBuilder)3 HashMap (java.util.HashMap)1 CamelContextAware (org.apache.camel.CamelContextAware)1 RuntimeCamelException (org.apache.camel.RuntimeCamelException)1 DataFormatFactory (org.apache.camel.spi.DataFormatFactory)1 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)1 ConditionalOnClass (org.springframework.boot.autoconfigure.condition.ConditionalOnClass)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 Bean (org.springframework.context.annotation.Bean)1