Search in sources :

Example 1 with ExtensionManager

use of org.mule.runtime.core.api.extension.ExtensionManager in project mule by mulesoft.

the class CompositeArtifactExtensionManagerFactory method create.

@Override
public ExtensionManager create(MuleContext muleContext) {
    ExtensionManager parentExtensionManager = parentArtifact.getRegistry().<ExtensionManager>lookupByName(OBJECT_EXTENSION_MANAGER).get();
    ExtensionManager extensionManager = super.create(muleContext, parentExtensionManager.getExtensions());
    return new CompositeArtifactExtensionManager(parentExtensionManager, extensionManager);
}
Also used : CompositeArtifactExtensionManager(org.mule.runtime.module.deployment.impl.internal.policy.CompositeArtifactExtensionManager) ExtensionManager(org.mule.runtime.core.api.extension.ExtensionManager) CompositeArtifactExtensionManager(org.mule.runtime.module.deployment.impl.internal.policy.CompositeArtifactExtensionManager)

Example 2 with ExtensionManager

use of org.mule.runtime.core.api.extension.ExtensionManager in project mule by mulesoft.

the class ArtifactExtensionManagerConfigurationBuilder method doConfigure.

@Override
protected void doConfigure(MuleContext muleContext) throws Exception {
    ExtensionManager extensionManager = extensionManagerFactory.create(muleContext);
    muleContext.setExtensionManager(extensionManager);
}
Also used : ExtensionManager(org.mule.runtime.core.api.extension.ExtensionManager)

Example 3 with ExtensionManager

use of org.mule.runtime.core.api.extension.ExtensionManager in project mule by mulesoft.

the class ApplicationDeploymentTestCase method extensionManagerPresent.

@Test
public void extensionManagerPresent() throws Exception {
    addPackedAppFromBuilder(emptyAppFileBuilder);
    startDeployment();
    assertApplicationDeploymentSuccess(applicationDeploymentListener, emptyAppFileBuilder.getId());
    final Application app = findApp(emptyAppFileBuilder.getId(), 1);
    assertThat(app.getRegistry().<ExtensionManager>lookupByName(MuleProperties.OBJECT_EXTENSION_MANAGER).get(), is(notNullValue()));
}
Also used : ExtensionManager(org.mule.runtime.core.api.extension.ExtensionManager) Application(org.mule.runtime.deployment.model.api.application.Application) Test(org.junit.Test)

Example 4 with ExtensionManager

use of org.mule.runtime.core.api.extension.ExtensionManager in project mule by mulesoft.

the class ArtifactExtensionManagerFactory method create.

protected ExtensionManager create(MuleContext muleContext, Set<ExtensionModel> parentArtifactExtensions) {
    final ExtensionManager extensionManager = extensionManagerFactory.create(muleContext);
    final Set<ExtensionModel> extensions = new HashSet<>();
    extensionModelDiscoverer.discoverRuntimeExtensionModels().forEach(extensionManager::registerExtension);
    extensions.addAll(extensionModelDiscoverer.discoverPluginsExtensionModels(extensionModelLoaderRepository, artifactPlugins, parentArtifactExtensions).stream().map(Pair::getSecond).collect(toSet()));
    extensions.forEach(extensionManager::registerExtension);
    return extensionManager;
}
Also used : ExtensionManager(org.mule.runtime.core.api.extension.ExtensionManager) ExtensionModel(org.mule.runtime.api.meta.model.ExtensionModel) HashSet(java.util.HashSet) Pair(org.mule.runtime.api.util.Pair)

Example 5 with ExtensionManager

use of org.mule.runtime.core.api.extension.ExtensionManager in project mule by mulesoft.

the class AbstractXmlExtensionMuleArtifactFunctionalTestCase method addBuilders.

@Override
protected void addBuilders(List<ConfigurationBuilder> builders) {
    super.addBuilders(builders);
    builders.add(new AbstractConfigurationBuilder() {

        @Override
        protected void doConfigure(MuleContext muleContext) throws Exception {
            ExtensionManager extensionManager;
            if (muleContext.getExtensionManager() == null) {
                extensionManager = createDefaultExtensionManager();
                muleContext.setExtensionManager(extensionManager);
                initialiseIfNeeded(extensionManager, muleContext);
            }
            extensionManager = muleContext.getExtensionManager();
            registerXmlExtensions(extensionManager);
        }

        private void registerXmlExtensions(ExtensionManager extensionManager) {
            // take all the plugins loaded by org.mule.test.runner.api.IsolatedClassLoaderExtensionsManagerConfigurationBuilder in the extension manager
            final Set<ExtensionModel> extensions = new HashSet<>(extensionManager.getExtensions());
            for (String modulePath : getModulePaths()) {
                Map<String, Object> params = new HashMap<>();
                params.put(XmlExtensionModelLoader.RESOURCE_XML, modulePath);
                params.put(XmlExtensionModelLoader.VALIDATE_XML, shouldValidateXml());
                operationsOutputPath().ifPresent(path -> params.put(XmlExtensionModelLoader.RESOURCE_DECLARATION, path));
                final DslResolvingContext dslResolvingContext = getDefault(extensions);
                final ExtensionModel extensionModel = new XmlExtensionModelLoader().loadExtensionModel(getClass().getClassLoader(), dslResolvingContext, params);
                extensions.add(extensionModel);
            }
            for (ExtensionModel extension : extensions) {
                extensionManager.registerExtension(extension);
            }
        }
    });
}
Also used : XmlExtensionModelLoader(org.mule.runtime.extension.api.loader.xml.XmlExtensionModelLoader) AbstractConfigurationBuilder(org.mule.runtime.core.api.config.builders.AbstractConfigurationBuilder) Set(java.util.Set) HashMap(java.util.HashMap) LifecycleUtils.initialiseIfNeeded(org.mule.runtime.core.api.lifecycle.LifecycleUtils.initialiseIfNeeded) MuleExtensionUtils.createDefaultExtensionManager(org.mule.runtime.module.extension.api.util.MuleExtensionUtils.createDefaultExtensionManager) ExtensionModel(org.mule.runtime.api.meta.model.ExtensionModel) XmlExtensionLoaderDelegate(org.mule.runtime.extension.internal.loader.XmlExtensionLoaderDelegate) HashSet(java.util.HashSet) List(java.util.List) MuleContext(org.mule.runtime.core.api.MuleContext) ExtensionManager(org.mule.runtime.core.api.extension.ExtensionManager) Map(java.util.Map) DslResolvingContext(org.mule.runtime.api.dsl.DslResolvingContext) ConfigurationBuilder(org.mule.runtime.core.api.config.ConfigurationBuilder) Optional(java.util.Optional) MuleArtifactFunctionalTestCase(org.mule.functional.junit4.MuleArtifactFunctionalTestCase) ArtifactClassLoaderRunnerConfig(org.mule.test.runner.ArtifactClassLoaderRunnerConfig) DslResolvingContext.getDefault(org.mule.runtime.api.dsl.DslResolvingContext.getDefault) AbstractConfigurationBuilder(org.mule.runtime.core.api.config.builders.AbstractConfigurationBuilder) Set(java.util.Set) HashSet(java.util.HashSet) ExtensionModel(org.mule.runtime.api.meta.model.ExtensionModel) MuleContext(org.mule.runtime.core.api.MuleContext) MuleExtensionUtils.createDefaultExtensionManager(org.mule.runtime.module.extension.api.util.MuleExtensionUtils.createDefaultExtensionManager) ExtensionManager(org.mule.runtime.core.api.extension.ExtensionManager) DslResolvingContext(org.mule.runtime.api.dsl.DslResolvingContext) HashMap(java.util.HashMap) Map(java.util.Map) XmlExtensionModelLoader(org.mule.runtime.extension.api.loader.xml.XmlExtensionModelLoader)

Aggregations

ExtensionManager (org.mule.runtime.core.api.extension.ExtensionManager)11 Test (org.junit.Test)3 HashSet (java.util.HashSet)2 MuleRuntimeException (org.mule.runtime.api.exception.MuleRuntimeException)2 ExtensionModel (org.mule.runtime.api.meta.model.ExtensionModel)2 MuleContext (org.mule.runtime.core.api.MuleContext)2 Application (org.mule.runtime.deployment.model.api.application.Application)2 CompositeArtifactExtensionManager (org.mule.runtime.module.deployment.impl.internal.policy.CompositeArtifactExtensionManager)2 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Set (java.util.Set)1 MuleArtifactFunctionalTestCase (org.mule.functional.junit4.MuleArtifactFunctionalTestCase)1 DslResolvingContext (org.mule.runtime.api.dsl.DslResolvingContext)1 DslResolvingContext.getDefault (org.mule.runtime.api.dsl.DslResolvingContext.getDefault)1 InitialisationException (org.mule.runtime.api.lifecycle.InitialisationException)1 Pair (org.mule.runtime.api.util.Pair)1 XmlApplicationParser (org.mule.runtime.config.api.dsl.processor.xml.XmlApplicationParser)1 XmlApplicationServiceRegistry (org.mule.runtime.config.api.dsl.processor.xml.XmlApplicationServiceRegistry)1