Search in sources :

Example 1 with XmlApplicationParser

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")));
}
Also used : XmlApplicationParser(org.mule.runtime.config.api.dsl.processor.xml.XmlApplicationParser) XmlApplicationServiceRegistry(org.mule.runtime.config.api.dsl.processor.xml.XmlApplicationServiceRegistry) MuleRuntimeException(org.mule.runtime.api.exception.MuleRuntimeException) Document(org.w3c.dom.Document) SpiServiceRegistry(org.mule.runtime.core.api.registry.SpiServiceRegistry)

Example 2 with XmlApplicationParser

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);
}
Also used : EnvironmentPropertiesConfigurationProvider(org.mule.runtime.config.internal.dsl.model.config.EnvironmentPropertiesConfigurationProvider) XmlApplicationParser(org.mule.runtime.config.api.dsl.processor.xml.XmlApplicationParser) ComponentModelReader(org.mule.runtime.config.internal.dsl.model.ComponentModelReader) ConfigLine(org.mule.runtime.config.api.dsl.processor.ConfigLine) DefaultConfigurationPropertiesResolver(org.mule.runtime.config.internal.dsl.model.config.DefaultConfigurationPropertiesResolver) SpiServiceRegistry(org.mule.runtime.core.api.registry.SpiServiceRegistry)

Example 3 with XmlApplicationParser

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);
}
Also used : XmlApplicationParser(org.mule.runtime.config.api.dsl.processor.xml.XmlApplicationParser) ExtensionManager(org.mule.runtime.core.api.extension.ExtensionManager) XmlApplicationServiceRegistry(org.mule.runtime.config.api.dsl.processor.xml.XmlApplicationServiceRegistry) SpiServiceRegistry(org.mule.runtime.core.api.registry.SpiServiceRegistry) ServiceRegistry(org.mule.runtime.core.api.registry.ServiceRegistry) XmlApplicationServiceRegistry(org.mule.runtime.config.api.dsl.processor.xml.XmlApplicationServiceRegistry)

Aggregations

XmlApplicationParser (org.mule.runtime.config.api.dsl.processor.xml.XmlApplicationParser)3 SpiServiceRegistry (org.mule.runtime.core.api.registry.SpiServiceRegistry)3 XmlApplicationServiceRegistry (org.mule.runtime.config.api.dsl.processor.xml.XmlApplicationServiceRegistry)2 MuleRuntimeException (org.mule.runtime.api.exception.MuleRuntimeException)1 ConfigLine (org.mule.runtime.config.api.dsl.processor.ConfigLine)1 ComponentModelReader (org.mule.runtime.config.internal.dsl.model.ComponentModelReader)1 DefaultConfigurationPropertiesResolver (org.mule.runtime.config.internal.dsl.model.config.DefaultConfigurationPropertiesResolver)1 EnvironmentPropertiesConfigurationProvider (org.mule.runtime.config.internal.dsl.model.config.EnvironmentPropertiesConfigurationProvider)1 ExtensionManager (org.mule.runtime.core.api.extension.ExtensionManager)1 ServiceRegistry (org.mule.runtime.core.api.registry.ServiceRegistry)1 Document (org.w3c.dom.Document)1