use of org.mule.runtime.api.meta.model.config.ConfigurationModel in project mule by mulesoft.
the class MacroExpansionModuleModel method getModuleGlobalElements.
private List<ComponentModel> getModuleGlobalElements() {
List<ComponentModel> moduleGlobalElements = new ArrayList<>();
Optional<ConfigurationModel> config = getConfigurationModel();
if (config.isPresent() && config.get().getModelProperty(GlobalElementComponentModelModelProperty.class).isPresent()) {
GlobalElementComponentModelModelProperty globalElementComponentModelModelProperty = config.get().getModelProperty(GlobalElementComponentModelModelProperty.class).get();
moduleGlobalElements = globalElementComponentModelModelProperty.getGlobalElements();
}
return moduleGlobalElements;
}
use of org.mule.runtime.api.meta.model.config.ConfigurationModel in project mule by mulesoft.
the class ConfigurationBasedElementModelFactory method addConnectionProvider.
private DslElementModel.Builder<ConfigurationModel> addConnectionProvider(ConfigurationModel model, DslSyntaxResolver dsl, DslElementModel.Builder<ConfigurationModel> element, ComponentConfiguration configuration) {
concat(model.getConnectionProviders().stream(), currentExtension.getConnectionProviders().stream()).map(provider -> {
DslElementSyntax providerDsl = dsl.resolve(provider);
ComponentIdentifier identifier = getIdentifier(providerDsl).orElse(null);
return configuration.getNestedComponents().stream().filter(c -> c.getIdentifier().equals(identifier)).findFirst().map(providerConfig -> element.containing(createElementModel(provider, providerDsl, providerConfig).build())).orElse(null);
}).filter(Objects::nonNull).findFirst();
return element;
}
use of org.mule.runtime.api.meta.model.config.ConfigurationModel in project mule by mulesoft.
the class DeclarationBasedElementModelFactory method createConfigurationElement.
private DslElementModel<ConfigurationModel> createConfigurationElement(ConfigurationModel model, ConfigurationElementDeclaration configDeclaration) {
DslElementSyntax configDsl = dsl.resolve(model);
InternalComponentConfiguration.Builder configuration = InternalComponentConfiguration.builder().withIdentifier(asIdentifier(configDsl)).withParameter(NAME_ATTRIBUTE_NAME, configDeclaration.getRefName());
DslElementModel.Builder<ConfigurationModel> element = createParameterizedElementModel(model, configDsl, configDeclaration, configuration);
configDeclaration.getConnection().ifPresent(connection -> addConnectionProvider(connection, model, configuration, element));
return element.withConfig(configuration.build()).build();
}
use of org.mule.runtime.api.meta.model.config.ConfigurationModel in project mule by mulesoft.
the class DefaultExtensionManager method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
public Optional<ConfigurationInstance> getConfiguration(ExtensionModel extensionModel, ComponentModel componentModel, CoreEvent muleEvent) {
ConfigurationInstance instance = getConfigurationProvider(extensionModel, componentModel).map(p -> p.get(muleEvent)).orElse(null);
if (instance != null) {
return of(instance);
}
Optional<ConfigurationModel> configurationModel = getConfigurationModelForExtension(extensionModel, getConfigurationForComponent(extensionModel, componentModel));
if (configurationModel.isPresent()) {
createImplicitConfiguration(extensionModel, configurationModel.get(), muleEvent);
return of(getConfiguration(getImplicitConfigurationProviderName(extensionModel, configurationModel.get()), muleEvent));
}
return empty();
}
use of org.mule.runtime.api.meta.model.config.ConfigurationModel in project mule by mulesoft.
the class NameClashModelValidatorTestCase method differentNamesClashWhenHyphenized.
@Test
public void differentNamesClashWhenHyphenized() {
exception.expect(IllegalModelDefinitionException.class);
exception.expectMessage("contains 2 components 'config-name");
ConfigurationModel configuration = mock(ConfigurationModel.class);
mockModelProperties(configuration);
when(configuration.getName()).thenReturn("config-name");
when(configurationModel.getName()).thenReturn("ConfigName");
when(configuration.getAllParameterModels()).thenReturn(asList(simpleConfigParam, topLevelConfigParam));
when(configuration.getOperationModels()).thenReturn(ImmutableList.of());
when(configuration.getConnectionProviders()).thenReturn(ImmutableList.of());
when(extensionModel.getConfigurationModels()).thenReturn(asList(configurationModel, configuration));
validate();
}
Aggregations