use of org.mule.runtime.config.api.dsl.processor.ConfigLine in project mule by mulesoft.
the class DefaultXmlArtifactDeclarationLoader method declareComposableModel.
private void declareComposableModel(ComposableModel model, DslElementSyntax elementDsl, ConfigLine containerConfig, HasNestedComponentDeclarer declarer) {
containerConfig.getChildren().forEach((ConfigLine child) -> {
ExtensionModel extensionModel = getExtensionModel(child);
ElementDeclarer extensionElementsDeclarer = forExtension(extensionModel.getName());
Reference<Boolean> componentFound = new Reference<>(false);
getComponentDeclaringWalker(declaration -> {
declarer.withComponent(declaration);
componentFound.set(true);
}, child, extensionElementsDeclarer).walk(extensionModel);
if (!componentFound.get()) {
declareRoute(model, elementDsl, child, extensionElementsDeclarer).ifPresent(declarer::withComponent);
}
});
}
use of org.mule.runtime.config.api.dsl.processor.ConfigLine in project mule by mulesoft.
the class ComponentModelReader method extractComponentDefinitionModel.
public ComponentModel extractComponentDefinitionModel(ConfigLine configLine, String configFileName) {
String namespace = configLine.getNamespace() == null ? CORE_PREFIX : configLine.getNamespace();
ComponentModel.Builder builder = new ComponentModel.Builder().setIdentifier(builder().namespace(namespace).name(configLine.getIdentifier()).build()).setTextContent(resolveValueIfIsPlaceHolder(configLine.getTextContent())).setConfigFileName(configFileName).setLineNumber(configLine.getLineNumber());
to(builder).addNode(from(configLine).getNode());
for (SimpleConfigAttribute simpleConfigAttribute : configLine.getConfigAttributes().values()) {
builder.addParameter(simpleConfigAttribute.getName(), resolveValueIfIsPlaceHolder(simpleConfigAttribute.getValue()), simpleConfigAttribute.isValueFromSchema());
}
List<ComponentModel> componentModels = configLine.getChildren().stream().map(childConfigLine -> extractComponentDefinitionModel(childConfigLine, configFileName)).collect(Collectors.toList());
componentModels.stream().forEach(componentDefinitionModel -> builder.addChildComponentModel(componentDefinitionModel));
ConfigLine parent = configLine.getParent();
if (parent != null && isConfigurationTopComponent(parent)) {
builder.markAsRootComponent();
}
ComponentModel componentModel = builder.build();
for (ComponentModel innerComponentModel : componentModel.getInnerComponents()) {
innerComponentModel.setParent(componentModel);
}
return componentModel;
}
Aggregations