use of org.apache.camel.RuntimeCamelException in project camel by apache.
the class XmlBeansDataFormatAutoConfiguration method configureXmlBeansDataFormatFactory.
@Bean(name = "xmlBeans-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(XmlBeansDataFormat.class)
public DataFormatFactory configureXmlBeansDataFormatFactory(final CamelContext camelContext, final XmlBeansDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
XmlBeansDataFormat dataformat = new XmlBeansDataFormat();
if (CamelContextAware.class.isAssignableFrom(XmlBeansDataFormat.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 SnakeYAMLDataFormatAutoConfiguration method configureSnakeYAMLDataFormatFactory.
@Bean(name = "yaml-snakeyaml-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(SnakeYAMLDataFormat.class)
public DataFormatFactory configureSnakeYAMLDataFormatFactory(final CamelContext camelContext, final SnakeYAMLDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
SnakeYAMLDataFormat dataformat = new SnakeYAMLDataFormat();
if (CamelContextAware.class.isAssignableFrom(SnakeYAMLDataFormat.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 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;
}
};
}
use of org.apache.camel.RuntimeCamelException 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;
}
};
}
use of org.apache.camel.RuntimeCamelException 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;
}
};
}
Aggregations