use of org.mule.runtime.app.declaration.api.fluent.ConnectionElementDeclarer in project mule by mulesoft.
the class DefaultXmlArtifactDeclarationLoader method declareAsConnectionProvider.
private boolean declareAsConnectionProvider(ExtensionModel ownerExtension, ConfigurationModel model, ConfigurationElementDeclarer configurationDeclarer, ConfigLine config, ElementDeclarer extensionElementsDeclarer) {
final DslSyntaxResolver dsl = resolvers.get(getNamespace(config));
Optional<ConnectionProviderModel> connectionProvider = model.getConnectionProviders().stream().filter(cp -> dsl.resolve(cp).getElementName().equals(config.getIdentifier())).findFirst();
if (!connectionProvider.isPresent()) {
connectionProvider = ownerExtension.getConnectionProviders().stream().filter(cp -> dsl.resolve(cp).getElementName().equals(config.getIdentifier())).findFirst();
}
if (!connectionProvider.isPresent()) {
return true;
}
ConnectionProviderModel providerModel = connectionProvider.get();
ConnectionElementDeclarer connectionDeclarer = extensionElementsDeclarer.newConnection(providerModel.getName());
declareParameterizedComponent(providerModel, dsl.resolve(providerModel), connectionDeclarer, config.getConfigAttributes(), config.getChildren());
configurationDeclarer.withConnection(connectionDeclarer.getDeclaration());
return false;
}
Aggregations