use of io.syndesis.connector.rest.swagger.SwaggerConnectorComponent in project syndesis by syndesisio.
the class SwaggerConnectorConnectorAutoConfiguration method postConstructSwaggerConnectorComponent.
@PostConstruct
public void postConstructSwaggerConnectorComponent() {
Map<String, Object> parameters = new HashMap<>();
for (Map.Entry<String, SwaggerConnectorConnectorConfigurationCommon> entry : configuration.getConfigurations().entrySet()) {
parameters.clear();
SwaggerConnectorComponent connector = new SwaggerConnectorComponent(entry.getKey());
connector.setCamelContext(camelContext);
try {
IntrospectionSupport.getProperties(entry.getValue(), parameters, null, false);
CamelPropertiesHelper.setCamelProperties(camelContext, connector, parameters, false);
connector.setOptions(parameters);
if (ObjectHelper.isNotEmpty(customizers)) {
for (ConnectorCustomizer<SwaggerConnectorComponent> customizer : customizers) {
boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate(applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.swagger-operation." + entry.getKey() + ".customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate(applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.swagger-operation." + entry.getKey() + ".customizer");
if (useCustomizer) {
LOGGER.debug("Configure connector {}, with customizer {}", connector, customizer);
customizer.customize(connector);
}
}
}
camelContext.addComponent(entry.getKey(), connector);
} catch (Exception e) {
throw new BeanCreationException(entry.getKey(), e.getMessage(), e);
}
}
}
use of io.syndesis.connector.rest.swagger.SwaggerConnectorComponent in project syndesis by syndesisio.
the class SwaggerConnectorConnectorAutoConfiguration method configureSwaggerConnectorComponent.
@Lazy
@Bean(name = "swagger-operation-component")
@ConditionalOnClass(CamelContext.class)
@ConditionalOnMissingBean
public SwaggerConnectorComponent configureSwaggerConnectorComponent() throws Exception {
SwaggerConnectorComponent connector = new SwaggerConnectorComponent();
connector.setCamelContext(camelContext);
Map<String, Object> parameters = new HashMap<>();
IntrospectionSupport.getProperties(configuration, parameters, null, false);
CamelPropertiesHelper.setCamelProperties(camelContext, connector, parameters, false);
connector.setOptions(parameters);
if (ObjectHelper.isNotEmpty(customizers)) {
for (ConnectorCustomizer<SwaggerConnectorComponent> customizer : customizers) {
boolean useCustomizer = (customizer instanceof HasId) ? HierarchicalPropertiesEvaluator.evaluate(applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.swagger-operation.customizer", ((HasId) customizer).getId()) : HierarchicalPropertiesEvaluator.evaluate(applicationContext.getEnvironment(), "camel.connector.customizer", "camel.connector.swagger-operation.customizer");
if (useCustomizer) {
LOGGER.debug("Configure connector {}, with customizer {}", connector, customizer);
customizer.customize(connector);
}
}
}
return connector;
}
Aggregations