use of org.apache.camel.RuntimeCamelException in project camel by apache.
the class GsonDataFormatAutoConfiguration method configureGsonDataFormatFactory.
@Bean(name = "json-gson-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(GsonDataFormat.class)
public DataFormatFactory configureGsonDataFormatFactory(final CamelContext camelContext, final GsonDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
GsonDataFormat dataformat = new GsonDataFormat();
if (CamelContextAware.class.isAssignableFrom(GsonDataFormat.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;
}
};
}
use of org.apache.camel.RuntimeCamelException in project camel by apache.
the class GzipDataFormatAutoConfiguration method configureGzipDataFormatFactory.
@Bean(name = "gzip-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(GzipDataFormat.class)
public DataFormatFactory configureGzipDataFormatFactory(final CamelContext camelContext, final GzipDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
GzipDataFormat dataformat = new GzipDataFormat();
if (CamelContextAware.class.isAssignableFrom(GzipDataFormat.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;
}
};
}
use of org.apache.camel.RuntimeCamelException in project camel by apache.
the class ZipDataFormatAutoConfiguration method configureZipDataFormatFactory.
@Bean(name = "zip-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(ZipDataFormat.class)
public DataFormatFactory configureZipDataFormatFactory(final CamelContext camelContext, final ZipDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
ZipDataFormat dataformat = new ZipDataFormat();
if (CamelContextAware.class.isAssignableFrom(ZipDataFormat.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;
}
};
}
use of org.apache.camel.RuntimeCamelException in project camel by apache.
the class JibxDataFormatAutoConfiguration method configureJibxDataFormatFactory.
@Bean(name = "jibx-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(JibxDataFormat.class)
public DataFormatFactory configureJibxDataFormatFactory(final CamelContext camelContext, final JibxDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
JibxDataFormat dataformat = new JibxDataFormat();
if (CamelContextAware.class.isAssignableFrom(JibxDataFormat.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;
}
};
}
use of org.apache.camel.RuntimeCamelException in project camel by apache.
the class UniVocityTsvDataFormatAutoConfiguration method configureUniVocityTsvDataFormatFactory.
@Bean(name = "univocity-tsv-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(UniVocityTsvDataFormat.class)
public DataFormatFactory configureUniVocityTsvDataFormatFactory(final CamelContext camelContext, final UniVocityTsvDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
UniVocityTsvDataFormat dataformat = new UniVocityTsvDataFormat();
if (CamelContextAware.class.isAssignableFrom(UniVocityTsvDataFormat.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