Search in sources :

Example 1 with DefaultExtensionManager

use of org.mule.runtime.module.extension.internal.manager.DefaultExtensionManager in project mule by mulesoft.

the class ExtensionFunctionalTestCase method createExtensionsManager.

private void createExtensionsManager(MuleContext muleContext) throws Exception {
    extensionManager = new DefaultExtensionManager();
    File generatedResourcesDirectory = getGenerationTargetDirectory();
    muleContext.setExtensionManager(extensionManager);
    initialiseIfNeeded(extensionManager, muleContext);
    ExtensionsTestInfrastructureDiscoverer discoverer = new ExtensionsTestInfrastructureDiscoverer(extensionManager);
    for (Class<?> annotatedClass : getAnnotatedExtensionClasses()) {
        discoverer.discoverExtension(annotatedClass, getExtensionModelLoader());
    }
    generateResourcesAndAddToClasspath(generatedResourcesDirectory, copyOf(discoverer.generateDslResources(generatedResourcesDirectory)));
}
Also used : ExtensionsTestInfrastructureDiscoverer(org.mule.test.runner.infrastructure.ExtensionsTestInfrastructureDiscoverer) File(java.io.File) DefaultExtensionManager(org.mule.runtime.module.extension.internal.manager.DefaultExtensionManager)

Example 2 with DefaultExtensionManager

use of org.mule.runtime.module.extension.internal.manager.DefaultExtensionManager in project mule by mulesoft.

the class ExtensionPluginMetadataGenerator method createExtensionManager.

/**
 * Creates a {@link ExtensionManager} needed for generating the metadata for an extension. It would be later discarded due to
 * the manager would have references to classes loaded with the launcher class loader instead of the hierarchical class loaders
 * created as result of the classification process.
 *
 * @return an {@link ExtensionManager} that would be used to register the extensions.
 */
private ExtensionManager createExtensionManager() {
    DefaultExtensionManager extensionManager = new DefaultExtensionManager();
    extensionManager.setMuleContext(new DefaultMuleContext() {

        private ErrorTypeRepository errorTypeRepository = createDefaultErrorTypeRepository();

        private ErrorTypeLocator errorTypeLocator = createDefaultErrorTypeLocator(errorTypeRepository);

        @Override
        public MuleRegistry getRegistry() {
            return new MuleRegistryHelper(new DefaultRegistryBroker(this, new MuleLifecycleInterceptor()), this);
        }

        @Override
        public ErrorTypeLocator getErrorTypeLocator() {
            return errorTypeLocator;
        }

        @Override
        public ErrorTypeRepository getErrorTypeRepository() {
            return errorTypeRepository;
        }
    });
    try {
        extensionManager.initialise();
    } catch (InitialisationException e) {
        throw new RuntimeException("Error while initialising the extension manager", e);
    }
    return extensionManager;
}
Also used : ErrorTypeRepository(org.mule.runtime.api.exception.ErrorTypeRepository) ErrorTypeRepositoryFactory.createDefaultErrorTypeRepository(org.mule.runtime.core.internal.exception.ErrorTypeRepositoryFactory.createDefaultErrorTypeRepository) MuleRegistryHelper(org.mule.runtime.core.internal.registry.MuleRegistryHelper) DefaultMuleContext(org.mule.runtime.core.internal.context.DefaultMuleContext) DefaultRegistryBroker(org.mule.runtime.core.internal.registry.DefaultRegistryBroker) ErrorTypeLocatorFactory.createDefaultErrorTypeLocator(org.mule.runtime.core.internal.exception.ErrorTypeLocatorFactory.createDefaultErrorTypeLocator) ErrorTypeLocator(org.mule.runtime.core.privileged.exception.ErrorTypeLocator) MuleRegistry(org.mule.runtime.core.internal.registry.MuleRegistry) InitialisationException(org.mule.runtime.api.lifecycle.InitialisationException) MuleLifecycleInterceptor(org.mule.runtime.core.internal.lifecycle.MuleLifecycleInterceptor) DefaultExtensionManager(org.mule.runtime.module.extension.internal.manager.DefaultExtensionManager)

Example 3 with DefaultExtensionManager

use of org.mule.runtime.module.extension.internal.manager.DefaultExtensionManager in project mule by mulesoft.

the class DefaultExtensionManagerFactory method create.

/**
 * {@inheritDoc}
 */
@Override
public ExtensionManager create(MuleContext muleContext) {
    ExtensionManager extensionManager = new DefaultExtensionManager();
    muleContext.setExtensionManager(extensionManager);
    try {
        initialiseIfNeeded(extensionManager, false, muleContext);
    } catch (InitialisationException e) {
        throw new MuleRuntimeException(createStaticMessage("Could not initialise extension manager"), e);
    }
    return extensionManager;
}
Also used : ExtensionManager(org.mule.runtime.core.api.extension.ExtensionManager) DefaultExtensionManager(org.mule.runtime.module.extension.internal.manager.DefaultExtensionManager) MuleRuntimeException(org.mule.runtime.api.exception.MuleRuntimeException) InitialisationException(org.mule.runtime.api.lifecycle.InitialisationException) DefaultExtensionManager(org.mule.runtime.module.extension.internal.manager.DefaultExtensionManager)

Aggregations

DefaultExtensionManager (org.mule.runtime.module.extension.internal.manager.DefaultExtensionManager)3 InitialisationException (org.mule.runtime.api.lifecycle.InitialisationException)2 File (java.io.File)1 ErrorTypeRepository (org.mule.runtime.api.exception.ErrorTypeRepository)1 MuleRuntimeException (org.mule.runtime.api.exception.MuleRuntimeException)1 ExtensionManager (org.mule.runtime.core.api.extension.ExtensionManager)1 DefaultMuleContext (org.mule.runtime.core.internal.context.DefaultMuleContext)1 ErrorTypeLocatorFactory.createDefaultErrorTypeLocator (org.mule.runtime.core.internal.exception.ErrorTypeLocatorFactory.createDefaultErrorTypeLocator)1 ErrorTypeRepositoryFactory.createDefaultErrorTypeRepository (org.mule.runtime.core.internal.exception.ErrorTypeRepositoryFactory.createDefaultErrorTypeRepository)1 MuleLifecycleInterceptor (org.mule.runtime.core.internal.lifecycle.MuleLifecycleInterceptor)1 DefaultRegistryBroker (org.mule.runtime.core.internal.registry.DefaultRegistryBroker)1 MuleRegistry (org.mule.runtime.core.internal.registry.MuleRegistry)1 MuleRegistryHelper (org.mule.runtime.core.internal.registry.MuleRegistryHelper)1 ErrorTypeLocator (org.mule.runtime.core.privileged.exception.ErrorTypeLocator)1 ExtensionsTestInfrastructureDiscoverer (org.mule.test.runner.infrastructure.ExtensionsTestInfrastructureDiscoverer)1