use of org.apache.camel.CamelContextAware in project camel by apache.
the class Base64DataFormatAutoConfiguration method configureBase64DataFormatFactory.
@Bean(name = "base64-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(Base64DataFormat.class)
public DataFormatFactory configureBase64DataFormatFactory(final CamelContext camelContext, final Base64DataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
Base64DataFormat dataformat = new Base64DataFormat();
if (CamelContextAware.class.isAssignableFrom(Base64DataFormat.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.CamelContextAware in project camel by apache.
the class BindyCsvDataFormatAutoConfiguration method configureBindyCsvDataFormatFactory.
@Bean(name = "bindy-csv-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(BindyCsvDataFormat.class)
public DataFormatFactory configureBindyCsvDataFormatFactory(final CamelContext camelContext, final BindyCsvDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
BindyCsvDataFormat dataformat = new BindyCsvDataFormat();
if (CamelContextAware.class.isAssignableFrom(BindyCsvDataFormat.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.CamelContextAware in project camel by apache.
the class BindyFixedLengthDataFormatAutoConfiguration method configureBindyFixedLengthDataFormatFactory.
@Bean(name = "bindy-fixed-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(BindyFixedLengthDataFormat.class)
public DataFormatFactory configureBindyFixedLengthDataFormatFactory(final CamelContext camelContext, final BindyFixedLengthDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
BindyFixedLengthDataFormat dataformat = new BindyFixedLengthDataFormat();
if (CamelContextAware.class.isAssignableFrom(BindyFixedLengthDataFormat.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.CamelContextAware in project camel by apache.
the class BindyKeyValuePairDataFormatAutoConfiguration method configureBindyKeyValuePairDataFormatFactory.
@Bean(name = "bindy-kvp-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(BindyKeyValuePairDataFormat.class)
public DataFormatFactory configureBindyKeyValuePairDataFormatFactory(final CamelContext camelContext, final BindyKeyValuePairDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
BindyKeyValuePairDataFormat dataformat = new BindyKeyValuePairDataFormat();
if (CamelContextAware.class.isAssignableFrom(BindyKeyValuePairDataFormat.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.CamelContextAware in project camel by apache.
the class BoonDataFormatAutoConfiguration method configureBoonDataFormatFactory.
@Bean(name = "boon-dataformat-factory")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean(BoonDataFormat.class)
public DataFormatFactory configureBoonDataFormatFactory(final CamelContext camelContext, final BoonDataFormatConfiguration configuration) {
return new DataFormatFactory() {
public DataFormat newInstance() {
BoonDataFormat dataformat = new BoonDataFormat();
if (CamelContextAware.class.isAssignableFrom(BoonDataFormat.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