Examples of ModuleStateHolder


Examples of org.impalaframework.module.spi.ModuleStateHolder

        final String moduleDefinition = currentDefinition.getName();
        logger.info("Unloading module " + moduleDefinition);

        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.spi.ModuleStateHolder

    final ServletContext servletContext = servlet.getServletContext();
    ModuleManagementFacade facade = ImpalaServletUtils.getModuleManagementFacade(servletContext);

    final String servletName = servlet.getServletName();
    Application application = facade.getApplicationManager().getCurrentApplication();
        ModuleStateHolder moduleStateHolder = application.getModuleStateHolder();
   
    if (!initialized) {
     
      ModuleStateChangeNotifier moduleStateChangeNotifier = facade.getModuleStateChangeNotifier();
      ModuleStateChangeListener listener = newModuleStateChangeListener(servletName);
View Full Code Here

Examples of org.impalaframework.module.spi.ModuleStateHolder

        Impala.init();
        System.out.println(getModuleDefinition());
       
        Impala.init(this);
        Application application = Impala.getCurrentApplication();
        ModuleStateHolder moduleStateHolder = application.getModuleStateHolder();
       
        BaseBeanGraphInheritanceStrategy strategy = new ParentFirstBeanGraphInheritanceStrategy();
        assertTrue(strategy.getDelegateGetBeanCallsToParent());

        checkExpected(moduleStateHolder, strategy, "sample-module4", 0);
        checkExpected(moduleStateHolder, strategy, "sample-module6", 3);
        checkExpected(moduleStateHolder, strategy, "sample-module5", 0);
        checkExpected(moduleStateHolder, strategy, "sample-module2", 0);
        checkExpected(moduleStateHolder, strategy, "impala-core", 0);
       
        strategy = new GraphOrderedBeanInheritanceStrategy();
        assertFalse(strategy.getDelegateGetBeanCallsToParent());

        checkExpected(moduleStateHolder, strategy, "sample-module4", 2);
        checkExpected(moduleStateHolder, strategy, "sample-module6", 4);
        checkExpected(moduleStateHolder, strategy, "sample-module5", 0);
        checkExpected(moduleStateHolder, strategy, "sample-module2", 1);
        checkExpected(moduleStateHolder, strategy, "impala-core", 0);
       
        executeBean("sample-module6", "bean4");
       
        //check that the ordering can be swapped

        ModuleDefinition definition = moduleStateHolder.getModuleDefinition().findChildDefinition("sample-module4", true);
        final List<ModuleDefinition> dList = strategy.getDependencyList(definition, (GraphModuleStateHolder)moduleStateHolder);
        assertTrue(dList.size() > 0);
       
        final List<ModuleDefinition> dependencyList = new ArrayList<ModuleDefinition>(dList);
        assertEquals(0, strategy.getRootModuleDefinitionIndex(dependencyList));
View Full Code Here

Examples of org.impalaframework.module.spi.ModuleStateHolder

    }
   
    private ApplicationContext getApplicationContext(String moduleName) {

        Application application = Impala.getCurrentApplication();
        ModuleStateHolder moduleStateHolder = application.getModuleStateHolder();
        ModuleDefinition definition = moduleStateHolder.getModuleDefinition().findChildDefinition(moduleName, true);

        ApplicationContext parent = getApplicationContext(moduleStateHolder,
                definition);
       
        return parent;
View Full Code Here

Examples of org.impalaframework.module.spi.ModuleStateHolder

       
        RootModuleDefinition definition = new Provider().getModuleDefinition();
        TransitionSet transitions = calculatorRegistry.getModificationExtractor(ModificationExtractorType.STRICT).getTransitions(application, null, definition);
        TransitionManager transitionManager = (TransitionManager) context.getBean("transitionManager");
       
        ModuleStateHolder moduleStateHolder = application.getModuleStateHolder();
        transitionManager.processTransitions(moduleStateHolder, application, transitions);

        ConfigurableApplicationContext parentContext = SpringModuleUtils.getRootSpringContext(moduleStateHolder);
        FileMonitor bean = (FileMonitor) parentContext.getBean("bean1");
        bean.lastModified((File) null);
View Full Code Here

Examples of org.impalaframework.module.spi.ModuleStateHolder

    public void testGraph() throws Exception {
   
        Impala.init(this);
        Application application = Impala.getCurrentApplication();
        ModuleStateHolder moduleStateHolder = application.getModuleStateHolder();
        Map<String, RuntimeModule> moduleContexts = moduleStateHolder.getRuntimeModules();
        System.out.println(moduleContexts);
        assertEquals(5, moduleContexts.size());
        assertNotNull(moduleContexts.get("impala-core"));
        assertNotNull(moduleContexts.get("sample-module2"));
        assertNotNull(moduleContexts.get("sample-module4"));
View Full Code Here

Examples of org.impalaframework.module.spi.ModuleStateHolder

        frameworkLockHolder.writeLock();
        frameworkLockHolder.writeUnlock();
       
        replay(frameworkLockHolder);
       
        ModuleStateHolder moduleStateHolder = createMock(ModuleStateHolder.class);
        Application application = TestApplicationManager.newApplicationManager(null, moduleStateHolder, null).getCurrentApplication();
        operation.execute(application, null);
       
        verify(frameworkLockHolder);
    }
View Full Code Here

Examples of org.impalaframework.module.spi.ModuleStateHolder

public class ModuleStateHolderFactoryTest extends TestCase {

    public void testNewModuleStateHolder() {
        SimpleModuleStateHolderFactory factory = new SimpleModuleStateHolderFactory();
        factory.setExternalRootModuleName("rootModule");
        ModuleStateHolder moduleStateHolder = factory.newModuleStateHolder();
        assertTrue(moduleStateHolder instanceof DefaultModuleStateHolder);
       
        assertEquals("rootModule",  ReflectionUtils.getFieldValue(moduleStateHolder, "externalRootModuleName", String.class));
    }
View Full Code Here

Examples of org.impalaframework.module.spi.ModuleStateHolder

    }
   
    public void testNewGraphModuleStateHolder() {
        SimpleModuleStateHolderFactory factory = new GraphModuleStateHolderFactory();
        factory.setExternalRootModuleName("rootModule");
        ModuleStateHolder moduleStateHolder = factory.newModuleStateHolder();
        assertTrue(moduleStateHolder instanceof GraphModuleStateHolder);
       
        assertEquals("rootModule",  ReflectionUtils.getFieldValue(moduleStateHolder, "externalRootModuleName", String.class));
    }
View Full Code Here

Examples of org.impalaframework.module.spi.ModuleStateHolder

       
        while (parentDefinition != null) {
           
            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
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.