Search in sources :

Example 6 with DataFormatFactory

use of org.apache.camel.spi.DataFormatFactory in project camel by apache.

the class CastorDataFormatAutoConfiguration method configureCastorDataFormatFactory.

@Bean(name = "castor-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(CastorDataFormat.class)
public DataFormatFactory configureCastorDataFormatFactory(final CamelContext camelContext, final CastorDataFormatConfiguration configuration) {
    return new DataFormatFactory() {

        public DataFormat newInstance() {
            CastorDataFormat dataformat = new CastorDataFormat();
            if (CamelContextAware.class.isAssignableFrom(CastorDataFormat.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) RuntimeCamelException(org.apache.camel.RuntimeCamelException) CastorDataFormat(org.apache.camel.dataformat.castor.CastorDataFormat) 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 7 with DataFormatFactory

use of org.apache.camel.spi.DataFormatFactory in project camel by apache.

the class BarcodeDataFormatAutoConfiguration method configureBarcodeDataFormatFactory.

@Bean(name = "barcode-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(BarcodeDataFormat.class)
public DataFormatFactory configureBarcodeDataFormatFactory(final CamelContext camelContext, final BarcodeDataFormatConfiguration configuration) {
    return new DataFormatFactory() {

        public DataFormat newInstance() {
            BarcodeDataFormat dataformat = new BarcodeDataFormat();
            if (CamelContextAware.class.isAssignableFrom(BarcodeDataFormat.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) BarcodeDataFormat(org.apache.camel.dataformat.barcode.BarcodeDataFormat) CamelContextAware(org.apache.camel.CamelContextAware) HashMap(java.util.HashMap) 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 8 with DataFormatFactory

use of org.apache.camel.spi.DataFormatFactory in project camel by apache.

the class ICalDataFormatAutoConfiguration method configureICalDataFormatFactory.

@Bean(name = "ical-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(ICalDataFormat.class)
public DataFormatFactory configureICalDataFormatFactory(final CamelContext camelContext, final ICalDataFormatConfiguration configuration) {
    return new DataFormatFactory() {

        public DataFormat newInstance() {
            ICalDataFormat dataformat = new ICalDataFormat();
            if (CamelContextAware.class.isAssignableFrom(ICalDataFormat.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) ICalDataFormat(org.apache.camel.component.ical.ICalDataFormat) 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 9 with DataFormatFactory

use of org.apache.camel.spi.DataFormatFactory in project camel by apache.

the class JacksonDataFormatAutoConfiguration method configureJacksonDataFormatFactory.

@Bean(name = "json-jackson-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(JacksonDataFormat.class)
public DataFormatFactory configureJacksonDataFormatFactory(final CamelContext camelContext, final JacksonDataFormatConfiguration configuration) {
    return new DataFormatFactory() {

        public DataFormat newInstance() {
            JacksonDataFormat dataformat = new JacksonDataFormat();
            if (CamelContextAware.class.isAssignableFrom(JacksonDataFormat.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) JacksonDataFormat(org.apache.camel.component.jackson.JacksonDataFormat) 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 10 with DataFormatFactory

use of org.apache.camel.spi.DataFormatFactory in project camel by apache.

the class JacksonXMLDataFormatAutoConfiguration method configureJacksonXMLDataFormatFactory.

@Bean(name = "jacksonxml-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(JacksonXMLDataFormat.class)
public DataFormatFactory configureJacksonXMLDataFormatFactory(final CamelContext camelContext, final JacksonXMLDataFormatConfiguration configuration) {
    return new DataFormatFactory() {

        public DataFormat newInstance() {
            JacksonXMLDataFormat dataformat = new JacksonXMLDataFormat();
            if (CamelContextAware.class.isAssignableFrom(JacksonXMLDataFormat.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) JacksonXMLDataFormat(org.apache.camel.component.jacksonxml.JacksonXMLDataFormat) 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)

Aggregations

DataFormatFactory (org.apache.camel.spi.DataFormatFactory)47 HashMap (java.util.HashMap)45 CamelContextAware (org.apache.camel.CamelContextAware)45 RuntimeCamelException (org.apache.camel.RuntimeCamelException)45 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)45 ConditionalOnClass (org.springframework.boot.autoconfigure.condition.ConditionalOnClass)45 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)45 Bean (org.springframework.context.annotation.Bean)45 DataFormat (org.apache.camel.spi.DataFormat)2 BoonDataFormat (org.apache.camel.component.boon.BoonDataFormat)1 GsonDataFormat (org.apache.camel.component.gson.GsonDataFormat)1 HL7DataFormat (org.apache.camel.component.hl7.HL7DataFormat)1 ICalDataFormat (org.apache.camel.component.ical.ICalDataFormat)1 JacksonDataFormat (org.apache.camel.component.jackson.JacksonDataFormat)1 JacksonXMLDataFormat (org.apache.camel.component.jacksonxml.JacksonXMLDataFormat)1 JohnzonDataFormat (org.apache.camel.component.johnzon.JohnzonDataFormat)1 SnakeYAMLDataFormat (org.apache.camel.component.snakeyaml.SnakeYAMLDataFormat)1 SyslogDataFormat (org.apache.camel.component.syslog.SyslogDataFormat)1 CryptoDataFormat (org.apache.camel.converter.crypto.CryptoDataFormat)1 PGPDataFormat (org.apache.camel.converter.crypto.PGPDataFormat)1