Search in sources :

Example 21 with DataFormatFactory

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

the class SoapJaxbDataFormatAutoConfiguration method configureSoapJaxbDataFormatFactory.

@Bean(name = "soapjaxb-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(SoapJaxbDataFormat.class)
public DataFormatFactory configureSoapJaxbDataFormatFactory(final CamelContext camelContext, final SoapJaxbDataFormatConfiguration configuration) {
    return new DataFormatFactory() {

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

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

the class XmlRpcDataFormatAutoConfiguration method configureXmlRpcDataFormatFactory.

@Bean(name = "xmlrpc-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(XmlRpcDataFormat.class)
public DataFormatFactory configureXmlRpcDataFormatFactory(final CamelContext camelContext, final XmlRpcDataFormatConfiguration configuration) {
    return new DataFormatFactory() {

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

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

the class JsonDataFormatAutoConfiguration method configureJsonDataFormatFactory.

@Bean(name = "json-xstream-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(JsonDataFormat.class)
public DataFormatFactory configureJsonDataFormatFactory(final CamelContext camelContext, final JsonDataFormatConfiguration configuration) {
    return new DataFormatFactory() {

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

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

the class ZipFileDataFormatAutoConfiguration method configureZipFileDataFormatFactory.

@Bean(name = "zipfile-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(ZipFileDataFormat.class)
public DataFormatFactory configureZipFileDataFormatFactory(final CamelContext camelContext, final ZipFileDataFormatConfiguration configuration) {
    return new DataFormatFactory() {

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

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

the class LZFDataFormatAutoConfiguration method configureLZFDataFormatFactory.

@Bean(name = "lzf-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(LZFDataFormat.class)
public DataFormatFactory configureLZFDataFormatFactory(final CamelContext camelContext, final LZFDataFormatConfiguration configuration) {
    return new DataFormatFactory() {

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