Package org.impalaframework.module

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


        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

    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

    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

        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

        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

        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

        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

    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

    protected abstract RuntimeModule doLoadModule(ModuleDefinition definition);

    public RuntimeModule getRootRuntimeModule() {
        Assert.notNull(moduleStateHolder);
       
        final RuntimeModule runtimeModule = moduleStateHolder.getRootModule();
        return runtimeModule;
    }
View Full Code Here

TOP

Related Classes of org.impalaframework.module.RuntimeModule

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.