Package org.impalaframework.module

Examples of org.impalaframework.module.RuntimeModule


        expect(classLoaderRegistry.getClassLoader("parent")).andReturn(parentClassLoader);
        expect(classLoaderFactory.newClassLoader(application, parentClassLoader, definition)).andReturn(ClassUtils.getDefaultClassLoader());
       
        replay(classLoaderFactory, classLoaderRegistry);
       
        final RuntimeModule module = runtime.doLoadModule(application, definition);
        assertTrue(module instanceof SimpleRuntimeModule);
       
        verify(classLoaderFactory, classLoaderRegistry);
    }
View Full Code Here


        expect(definition1.getParentDefinition()).andReturn(null);
        expect(definition1.getName()).andReturn("myName");
       
        replay(definition1, monitor, moduleLocationResolver);
       
        final RuntimeModule runtimeModule = moduleRuntime.loadRuntimeModule(application, definition1);
        assertTrue(runtimeModule instanceof SimpleRuntimeModule);
        assertEquals(definition1, runtimeModule.getModuleDefinition());
        assertEquals(ClassUtils.getDefaultClassLoader(), classLoaderRegistry.getClassLoader("myName"));
       
        verify(definition1, monitor, moduleLocationResolver);
    }
View Full Code Here

        System.setProperty("graph.bean.visibility.type", "graphOrdered");
        Impala.init();
        Impala.init(new ModuleDefinitionWithParent());

        executeBean("sample-module4", "bean2");   
        RuntimeModule runtimeModule = Impala.getRuntimeModule("sample-module6");
        SpringRuntimeModule mod = (SpringRuntimeModule) runtimeModule;
        final ParentFactoryBean bean = (ParentFactoryBean) mod.getApplicationContext().getBean("&bean4");
        assertSame(bean.getObject(), Impala.getModuleBean("sample-module4", "bean4", Object.class));
    }
View Full Code Here

        } catch (NoSuchBeanDefinitionException e) {
        }
    }

    private void executeBean(String moduleName, String beanName) {
        RuntimeModule runtimeModule = Impala.getRuntimeModule(moduleName);
        FileMonitor bean = (FileMonitor) runtimeModule.getBean(beanName);
        bean.lastModified(new File("./"));
    }
View Full Code Here

            System.out.println(applicationContext.getDisplayName());
        }
    }

    private ApplicationContext getApplicationContext(ModuleStateHolder moduleStateHolder, final ModuleDefinition parentDefinition) {
        RuntimeModule parentModule = null;
        if (parentDefinition != null) parentModule = moduleStateHolder.getModule(parentDefinition.getName());
       
        return SpringModuleUtils.getModuleSpringContext(parentModule);
    }
View Full Code Here

           
            final String parentName = parentDefinition.getName();
           
            final ModuleStateHolder moduleStateHolder = application.getModuleStateHolder();
           
            final RuntimeModule parentModule = moduleStateHolder.getModule(parentName);
            if (parentModule instanceof SpringRuntimeModule) {
                SpringRuntimeModule springRuntimeModule = (SpringRuntimeModule) parentModule;
                parentContext = springRuntimeModule.getApplicationContext();
                break;
            }
View Full Code Here

    public static ConfigurableApplicationContext getRootSpringContext(ModuleStateHolder moduleStateHolder) {

        Assert.notNull(moduleStateHolder);
       
        final RuntimeModule runtimeModule = moduleStateHolder.getExternalRootModule();
        return getModuleSpringContext(runtimeModule);
    }
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

        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

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

  public final RuntimeModule loadRuntimeModule(ModuleDefinition definition) {
   
    try {
      final RuntimeModule runtimeModule = doLoadModule(definition);
      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());
      }
     
      return runtimeModule;
    } finally {
      afterModuleLoaded(definition);
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.