Package org.impalaframework.module.spi

Examples of org.impalaframework.module.spi.TransitionSet


    public final TransitionSet getTransitions(
            RootModuleDefinition originalDefinition,
            RootModuleDefinition newDefinition) {
       
        GraphAwareModificationExtractor delegate = newDelegate();
        TransitionSet transitions = delegate.getTransitions(originalDefinition, newDefinition);
       
        //method marked as final means this will be called
        moduleStateHolder.setDependencyManager(delegate.getNewDependencyManager());    
        return transitions;
    }
View Full Code Here


                .getModificationExtractor(ModificationExtractorType.STRICT);
        RootModuleDefinition rootModuleDefinition = moduleStateHolder.getRootModuleDefinition();
       
        if (rootModuleDefinition != null) {
            logger.info("Shutting down application context");
            TransitionSet transitions = calculator.getTransitions(rootModuleDefinition, null);
            moduleStateHolder.processTransitions(transitions);
            return ModuleOperationResult.TRUE;
        }
        else {
            return ModuleOperationResult.FALSE;
View Full Code Here

        transitions = sortTransitions(transitions, originalDefinition, newDefinition);
       
        if (newDefinition != null) {
            ModuleDefinitionUtils.freeze(newDefinition);
        }
        return new TransitionSet(transitions, newDefinition);
    }
View Full Code Here

        ModificationExtractorType modificationExtractorType = getModificationExtractorType();
       
        // figure out the modules to reload
        ModificationExtractor calculator = getModificationExtractorRegistry().getModificationExtractor(modificationExtractorType);
       
        TransitionSet transitions = calculator.getTransitions(oldModuleDefinition, newModuleDefinition);
        moduleStateHolder.processTransitions(transitions);
        return ModuleOperationResult.TRUE;
    }
View Full Code Here

            newParent.addChildModuleDefinition(moduleDefinition);
           
            moduleDefinition.setParentDefinition(newParent);
        }

        TransitionSet transitions = calculator.getTransitions(oldRootDefinition, newRootDefinition);
        moduleStateHolder.processTransitions(transitions);
    }  
View Full Code Here

        ModuleDefinition definitionToRemove = newRootDefinition.findChildDefinition(moduleToRemove, true);

        if (definitionToRemove != null) {
            if (definitionToRemove instanceof RootModuleDefinition) {
                //we're removing the rootModuleDefinition
                TransitionSet transitions = calculator.getTransitions(oldRootDefinition, null);
                moduleStateHolder.processTransitions(transitions);
                return true;
            }
            else {
                ModuleDefinition parent = definitionToRemove.getParentDefinition();
                if (parent != null) {
                    parent.removeChildModuleDefinition(moduleToRemove);
                   
                    definitionToRemove.setParentDefinition(null);

                    TransitionSet transitions = calculator.getTransitions(oldRootDefinition, newRootDefinition);
                    moduleStateHolder.processTransitions(transitions);
                    return true;
                }
                else {
                    throw new InvalidStateException("Module to remove does not have a parent module. "
View Full Code Here

    public void testReloadSame() {
        RootModuleDefinition parentSpec1 = ModificationTestUtils.spec("app-context1.xml", "plugin1, plugin2");
        RootModuleDefinition parentSpec2 = ModificationTestUtils.spec("app-context1.xml", "plugin1, plugin2");
        parentSpec2.findChildDefinition("plugin1", true).setState(ModuleState.STALE);

        TransitionSet transitions = calculator.getTransitions(application, parentSpec1, parentSpec2);
        assertEquals(parentSpec2, transitions.getNewRootModuleDefinition());

        Collection<? extends ModuleStateChange> moduleTransitions = transitions.getModuleTransitions();
        assertEquals(2, moduleTransitions.size());

        Iterator<? extends ModuleStateChange> iterator = moduleTransitions.iterator();
        ModuleStateChange change1 = iterator.next();
        ModuleStateChange change2 = iterator.next();
View Full Code Here

    public void testReloadChanged() {
        RootModuleDefinition parentSpec1 = ModificationTestUtils.spec("app-context1.xml", "plugin1, plugin2, plugin3");
        RootModuleDefinition parentSpec2 = ModificationTestUtils.spec("app-context1.xml", "plugin1, plugin2");
        parentSpec2.findChildDefinition("plugin1", true).setState(ModuleState.STALE);

        TransitionSet transitions = calculator.getTransitions(application, parentSpec1, parentSpec2);
        assertEquals(parentSpec2, transitions.getNewRootModuleDefinition());

        Collection<? extends ModuleStateChange> moduleTransitions = transitions.getModuleTransitions();
        assertEquals(3, moduleTransitions.size());

        Iterator<? extends ModuleStateChange> iterator = moduleTransitions.iterator();
        ModuleStateChange change1 = iterator.next();
        ModuleStateChange change2 = iterator.next();
View Full Code Here

    public void testAddedChild() {
        RootModuleDefinition parentSpec1 = ModificationTestUtils.spec("app-context1.xml", "plugin1, plugin2");
        RootModuleDefinition parentSpec2 = ModificationTestUtils.spec("app-context1.xml", "plugin1, plugin3, plugin2, plugin4");

        TransitionSet transitions = calculator.getTransitions(application, parentSpec1, parentSpec2);
        assertEquals(parentSpec2, transitions.getNewRootModuleDefinition());

        Collection<? extends ModuleStateChange> pluginTransitions = transitions.getModuleTransitions();
        assertEquals(2, pluginTransitions.size());

        Iterator<? extends ModuleStateChange> iterator = pluginTransitions.iterator();

        ModuleStateChange change1 = iterator.next();
View Full Code Here

        RootModuleDefinition parentSpec2 = ModificationTestUtils.spec("app-context1.xml", "plugin1, plugin2");

        ModuleDefinition plugin2 = parentSpec2.findChildDefinition("plugin2", true);
        new SimpleModuleDefinition(plugin2, "plugin4");

        TransitionSet transitions = calculator.getTransitions(application, parentSpec1, parentSpec2);
        assertEquals(parentSpec2, transitions.getNewRootModuleDefinition());

        Collection<? extends ModuleStateChange> pluginTransitions = transitions.getModuleTransitions();
        assertEquals(2, pluginTransitions.size());

        Iterator<? extends ModuleStateChange> iterator = pluginTransitions.iterator();

        ModuleStateChange change1 = iterator.next();
View Full Code Here

TOP

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

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.