Examples of RuntimeModule


Examples of org.impalaframework.module.RuntimeModule

            String directoryName = (String) GlobalCommandState.getInstance().getValue(
                    CommandStateConstants.DIRECTORY_NAME);
           
            ClassLoader parent = null;

            RuntimeModule runtimeModule = null;
           
            try {              
                if (directoryName != null && !InteractiveCommandUtils.isRootProject(directoryName)) {
                    runtimeModule = Impala.getRuntimeModule(directoryName);
                }
                else {
                    runtimeModule = Impala.getRootRuntimeModule();
                }
            }
            catch (NoServiceException e) {
                //we're not terribly interested in this situation - simply means that the module context has not been loaded
            }
           
            if (runtimeModule != null) {
                parent = runtimeModule.getClassLoader();
            } else {
                parent = ClassUtils.getDefaultClassLoader();
            }

            c = Class.forName(testClassName, false, parent);
View Full Code Here

Examples of org.impalaframework.module.RuntimeModule

    public static ConfigurableApplicationContext getRootSpringContext(ModuleStateHolder moduleStateHolder) {

        Assert.notNull(moduleStateHolder);
       
        final RuntimeModule runtimeModule = moduleStateHolder.getExternalRootModule();
        return getModuleSpringContext(runtimeModule);
    }
View Full Code Here

Examples of org.impalaframework.module.RuntimeModule

        if (session == null) {
            return null;
        }
        ModuleManagementFacade moduleManagementFacade = WebServletUtils.getModuleManagementFacade(servletContext);
        if (moduleManagementFacade != null) {
            RuntimeModule currentModuleContext = moduleManagementFacade.getModuleStateHolder().getModule(moduleName);
           
            if (currentModuleContext != null) {
                return new ModuleAwareWrapperHttpSession(session, currentModuleContext.getClassLoader());
            } else {
                logger.warn("No module application context associated with module: " + moduleName + ". Using unwrapped session");
                return session;
            }
        }
View Full Code Here

Examples of org.impalaframework.module.RuntimeModule

    public static ConfigurableApplicationContext getModuleSpringContext(ModuleStateHolder moduleStateHolder, String moduleName) {

        Assert.notNull(moduleStateHolder);
        Assert.notNull(moduleName);
       
        final RuntimeModule runtimeModule = moduleStateHolder.getModule(moduleName);
        return getModuleSpringContext(runtimeModule);
    }
View Full Code Here

Examples of org.impalaframework.module.RuntimeModule

    protected abstract String getMethodName(CommandState commandState, Class<?> testClass);

    private ClassLoader getTestClassLoader(String testClassName) {
        String currentDirectoryName = getCurrentDirectoryName(true);

        RuntimeModule runtimeModule = null;

        try {
            if (currentDirectoryName != null && !InteractiveCommandUtils.isRootProject(currentDirectoryName)) {
                runtimeModule = Impala.getRuntimeModule(currentDirectoryName);
            }
            else {
                runtimeModule = Impala.getRootRuntimeModule();
            }
        }
        catch (RuntimeException e) {
            System.out.println("No module loaded for current directory: " + currentDirectoryName);
            runtimeModule = Impala.getRootRuntimeModule();
        }

        ClassLoader parentClassLoader = null;

        if (runtimeModule != null)
            parentClassLoader = runtimeModule.getClassLoader();
        else
            parentClassLoader = ClassUtils.getDefaultClassLoader();
       
        ClassLoader testClassLoader = getTestClassLoader(parentClassLoader, testClassName);
        return testClassLoader;
View Full Code Here

Examples of org.impalaframework.module.RuntimeModule

        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);
                }
            }
           
            return runtimeModule;
View Full Code Here

Examples of org.impalaframework.module.RuntimeModule

        if (moduleStateHolder.getModule(moduleName) == null) {

            ModuleRuntime moduleRuntime = getModuleRuntime(currentDefinition);
           
            try {
                RuntimeModule runtimeModule = moduleRuntime.loadRuntimeModule(application, currentDefinition);
                moduleStateHolder.putModule(moduleName, runtimeModule);
            }
            catch (Throwable e) {
               
                try {
View Full Code Here

Examples of org.impalaframework.module.RuntimeModule

        boolean success = true;

        final ModuleStateHolder moduleStateHolder = application.getModuleStateHolder();
       
        RuntimeModule runtimeModule = moduleStateHolder.removeModule(moduleDefinition);
        if (runtimeModule != null) {
            try {
                ModuleRuntime moduleRuntime = getModuleRuntime(currentDefinition);
                moduleRuntime.closeModule(application, runtimeModule);
            }
View Full Code Here

Examples of org.impalaframework.module.RuntimeModule

        final List<ApplicationContext> applicationContexts = new ArrayList<ApplicationContext>();
       
        for (ModuleDefinition moduleDefinition : dependencies) {
           
            final String currentName = moduleDefinition.getName();
            final RuntimeModule runtimeModule = graphModuleStateHolder.getModule(currentName);
            if (runtimeModule instanceof SpringRuntimeModule) {
                SpringRuntimeModule spr = (SpringRuntimeModule) runtimeModule;
                applicationContexts.add(spr.getApplicationContext());
            }
        }
View Full Code Here

Examples of org.impalaframework.module.RuntimeModule

    public final RuntimeModule loadRuntimeModule(ModuleDefinition definition) {
       
        try {
            beforeModuleLoads(definition);
           
            RuntimeModule runtimeModule;
            try {
                runtimeModule = doLoadModule(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);
                }
            }
           
            return runtimeModule;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.