use of org.mule.runtime.config.api.dsl.processor.xml.XmlApplicationParser in project mule by mulesoft.
the class DefaultXmlArtifactDeclarationLoader method loadArtifactConfig.
private ConfigLine loadArtifactConfig(String name, InputStream resource) {
checkArgument(resource != null, "The given application was not found as resource");
Document document = noValidationDocumentLoader().loadDocument(context.getExtensions(), name, resource);
return new XmlApplicationParser(new XmlApplicationServiceRegistry(new SpiServiceRegistry(), context), resolveContextArtifactPluginClassLoaders()).parse(document.getDocumentElement()).orElseThrow(() -> new MuleRuntimeException(createStaticMessage("Could not load load a Configuration from the given resource")));
}
use of org.mule.runtime.config.api.dsl.processor.xml.XmlApplicationParser in project mule by mulesoft.
the class XmlExtensionLoaderDelegate method getModuleComponentModel.
private ComponentModel getModuleComponentModel(URL resource, Document moduleDocument) {
XmlApplicationParser xmlApplicationParser = new XmlApplicationParser(new SpiServiceRegistry(), singletonList(currentThread().getContextClassLoader()));
Optional<ConfigLine> parseModule = xmlApplicationParser.parse(moduleDocument.getDocumentElement());
if (!parseModule.isPresent()) {
// This happens in org.mule.runtime.config.dsl.processor.xml.XmlApplicationParser.configLineFromElement()
throw new IllegalArgumentException(format("There was an issue trying to read the stream of '%s'", resource.getFile()));
}
ComponentModelReader componentModelReader = new ComponentModelReader(new DefaultConfigurationPropertiesResolver(empty(), new EnvironmentPropertiesConfigurationProvider()));
return componentModelReader.extractComponentDefinitionModel(parseModule.get(), modulePath);
}
use of org.mule.runtime.config.api.dsl.processor.xml.XmlApplicationParser in project mule by mulesoft.
the class MuleArtifactContext method createApplicationParser.
private XmlApplicationParser createApplicationParser(List<ClassLoader> pluginsClassLoaders) {
ExtensionManager extensionManager = muleContext.getExtensionManager();
ServiceRegistry customRegistry = extensionManager != null ? new XmlApplicationServiceRegistry(serviceRegistry, DslResolvingContext.getDefault(extensionManager.getExtensions())) : serviceRegistry;
return new XmlApplicationParser(customRegistry, pluginsClassLoaders);
}
Aggregations