Package org.impalaframework.module.spi

Examples of org.impalaframework.module.spi.ClassLoaderRegistry


           
        Assert.notNull(classLoaderRegistryFactory, "classLoaderRegistryFactory cannot be null");
        Assert.notNull(moduleStateHolderFactory, "moduleStateHolderFactory cannot be null");
        Assert.notNull(serviceRegistryFactory, "serviceRegistryFactory cannot be null");
       
        ClassLoaderRegistry classLoaderRegistry = classLoaderRegistryFactory.newClassLoaderRegistry();
        ModuleStateHolder moduleStateHolder = moduleStateHolderFactory.newModuleStateHolder();
        ServiceRegistry serviceRegistry = serviceRegistryFactory.newServiceRegistry();
        Application application = new ImpalaApplication(classLoaderRegistry, moduleStateHolder, serviceRegistry, id);
   
        return application;
View Full Code Here


   
    /* ********************* ModuleRuntime method implementation ********************* */

    public final RuntimeModule loadRuntimeModule(Application application, ModuleDefinition definition) {
       
        final ClassLoaderRegistry classLoaderRegistry = application.getClassLoaderRegistry();
       
        try {
            beforeModuleLoads(definition);
           
            RuntimeModule runtimeModule;
            try {
                runtimeModule = doLoadModule(application, definition);
            }
            catch (RuntimeException e) {
                classLoaderRegistry.removeClassLoader(definition.getName());
                throw e;
            }
           
            Assert.notNull(classLoaderRegistry);
           
            final String moduleName = definition.getName();
            //note that GraphClassLoaderFactory will also populate the ClassLoaderRegistry, hence, this check
            if (!classLoaderRegistry.hasClassLoaderFor(moduleName)) {
                classLoaderRegistry.addClassLoader(moduleName, runtimeModule.getClassLoader());
               
                if (logger.isDebugEnabled()) {
                    logger.debug("Added new class loader " + ObjectUtils.identityToString(runtimeModule.getClassLoader())
                            + " to class loader registry for module: " + moduleName);
                }
View Full Code Here

        }
    }
   
    public final void closeModule(Application application, RuntimeModule runtimeModule) {

        final ClassLoaderRegistry classLoaderRegistry = application.getClassLoaderRegistry();
       
        final ModuleDefinition moduleDefinition = runtimeModule.getModuleDefinition();
        classLoaderRegistry.removeClassLoader(moduleDefinition.getName());
        doCloseModule(application.getId(), runtimeModule);
    }
View Full Code Here

            moduleRuntimeMonitor.afterModuleLoaded(definition);
        }
    }
   
    protected RuntimeModule doLoadModule(Application application, ModuleDefinition definition) {
        final ClassLoaderRegistry classLoaderRegistry = application.getClassLoaderRegistry();
       
        ClassLoader parentClassLoader = null;
        final ModuleDefinition parentDefinition = definition.getParentDefinition();

        if (parentDefinition != null) {
            parentClassLoader = classLoaderRegistry.getClassLoader(parentDefinition.getName());
        }
       
        if (parentClassLoader == null) {
            parentClassLoader = ClassUtils.getDefaultClassLoader();
        }
View Full Code Here

public class ClassLoaderRegistryFactoryTest extends TestCase {

    public void testNewModuleClassLoaderRegistry() {
        SimpleClassLoaderRegistryFactory factory = new SimpleClassLoaderRegistryFactory();
        ClassLoaderRegistry classLoaderRegistry = factory.newClassLoaderRegistry();
        assertTrue(classLoaderRegistry instanceof ModuleClassLoaderRegistry);
    }
View Full Code Here

        assertTrue(classLoaderRegistry instanceof ModuleClassLoaderRegistry);
    }
   
    public void testNewGraphClassLoaderRegistry() {
        GraphClassLoaderRegistryFactory factory = new GraphClassLoaderRegistryFactory();
        ClassLoaderRegistry classLoaderRegistry = factory.newClassLoaderRegistry();
        assertTrue(classLoaderRegistry instanceof GraphClassLoaderRegistry);
    }
View Full Code Here

   
    /* ********************* ModuleRuntime method implementation ********************* */

    public final RuntimeModule loadRuntimeModule(Application application, ModuleDefinition definition) {
       
        final ClassLoaderRegistry classLoaderRegistry = application.getClassLoaderRegistry();
       
        try {
            beforeModuleLoads(definition);
           
            RuntimeModule runtimeModule;
            try {
                runtimeModule = doLoadModule(application, definition);
            }
            catch (RuntimeException e) {
                classLoaderRegistry.removeClassLoader(definition.getName());
                throw e;
            }
           
            Assert.notNull(classLoaderRegistry);
           
            final String moduleName = definition.getName();
            //note that GraphClassLoaderFactory will also populate the ClassLoaderRegistry, hence, this check
            if (!classLoaderRegistry.hasClassLoaderFor(moduleName)) {
                classLoaderRegistry.addClassLoader(moduleName, runtimeModule.getClassLoader());
               
                if (logger.isDebugEnabled()) {
                    logger.debug("Added new class loader " + ObjectUtils.identityToString(runtimeModule.getClassLoader())
                            + " to class loader registry for module: " + moduleName);
                }
View Full Code Here

        }
    }
   
    public final void closeModule(Application application, RuntimeModule runtimeModule) {

        final ClassLoaderRegistry classLoaderRegistry = application.getClassLoaderRegistry();
       
        final ModuleDefinition moduleDefinition = runtimeModule.getModuleDefinition();
        classLoaderRegistry.removeClassLoader(moduleDefinition.getName());
        doCloseModule(application.getId(), runtimeModule);
    }
View Full Code Here

            moduleRuntimeMonitor.afterModuleLoaded(definition);
        }
    }
   
    protected RuntimeModule doLoadModule(Application application, ModuleDefinition definition) {
        final ClassLoaderRegistry classLoaderRegistry = application.getClassLoaderRegistry();
       
        ClassLoader parentClassLoader = null;
        final ModuleDefinition parentDefinition = definition.getParentDefinition();

        if (parentDefinition != null) {
            parentClassLoader = classLoaderRegistry.getClassLoader(parentDefinition.getName());
        }
       
        if (parentClassLoader == null) {
            parentClassLoader = ClassUtils.getDefaultClassLoader();
        }
View Full Code Here

           
        Assert.notNull(classLoaderRegistryFactory, "classLoaderRegistryFactory cannot be null");
        Assert.notNull(moduleStateHolderFactory, "moduleStateHolderFactory cannot be null");
        Assert.notNull(serviceRegistryFactory, "serviceRegistryFactory cannot be null");
       
        ClassLoaderRegistry classLoaderRegistry = classLoaderRegistryFactory.newClassLoaderRegistry();
        ModuleStateHolder moduleStateHolder = moduleStateHolderFactory.newModuleStateHolder();
        ServiceRegistry serviceRegistry = serviceRegistryFactory.newServiceRegistry();
        Application application = new ImpalaApplication(classLoaderRegistry, moduleStateHolder, serviceRegistry, id);
   
        return application;
View Full Code Here

TOP

Related Classes of org.impalaframework.module.spi.ClassLoaderRegistry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.