Search in sources :

Example 41 with DataFormatFactory

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;
        }
    };
}
Also used : DataFormatFactory(org.apache.camel.spi.DataFormatFactory) XStreamDataFormat(org.apache.camel.dataformat.xstream.XStreamDataFormat) 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 42 with DataFormatFactory

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;
        }
    };
}
Also used : DataFormatFactory(org.apache.camel.spi.DataFormatFactory) CamelContextAware(org.apache.camel.CamelContextAware) SyslogDataFormat(org.apache.camel.component.syslog.SyslogDataFormat) 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 43 with DataFormatFactory

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;
        }
    };
}
Also used : DataFormatFactory(org.apache.camel.spi.DataFormatFactory) CamelContextAware(org.apache.camel.CamelContextAware) HashMap(java.util.HashMap) TidyMarkupDataFormat(org.apache.camel.dataformat.tagsoup.TidyMarkupDataFormat) 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 44 with DataFormatFactory

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;
        }
    };
}
Also used : DataFormatFactory(org.apache.camel.spi.DataFormatFactory) TarFileDataFormat(org.apache.camel.dataformat.tarfile.TarFileDataFormat) 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 45 with DataFormatFactory

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;
        }
    };
}
Also used : DataFormatFactory(org.apache.camel.spi.DataFormatFactory) UniVocityCsvDataFormat(org.apache.camel.dataformat.univocity.UniVocityCsvDataFormat) 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)

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