Package org.impalaframework.module.spi

Examples of org.impalaframework.module.spi.TransitionResultSet


            ModificationExtractor calculator, String moduleToRemove) {
       
        RootModuleDefinition oldRootDefinition = moduleStateHolder.getRootModuleDefinition();
       
        if (oldRootDefinition == null) {
            return new TransitionResultSet();
        }
       
        RootModuleDefinition newRootDefinition = moduleStateHolder.cloneRootModuleDefinition();
        ModuleDefinition definitionToRemove = newRootDefinition.findChildDefinition(moduleToRemove, true);

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

                    TransitionSet transitions = calculator.getTransitions(application, oldRootDefinition, newRootDefinition);
                    TransitionResultSet transitionResultSet = getTransitionManager().processTransitions(moduleStateHolder, application, transitions);
                    return transitionResultSet;
                }
                else {
                    throw new InvalidStateException("Module to remove does not have a parent module. "
                            + "This is unexpected state and may indicate a bug");
                }
            }
        }
        return new TransitionResultSet();
    }
View Full Code Here


        if (childDefinition != null) {
            childDefinition.setState(ModuleState.STALE);

            TransitionSet transitions = calculator.getTransitions(application, oldRootDefinition, newRootDefinition);
            TransitionResultSet transitionResultSet = getTransitionManager().processTransitions(moduleStateHolder, application, transitions);

            boolean result = !transitions.getModuleTransitions().isEmpty();
            return result ? new ModuleOperationResult(transitionResultSet) : ModuleOperationResult.EMPTY;
        }
       
View Full Code Here

        super();
    }

    public TransitionResultSet processTransitions(ModuleStateHolder moduleStateHolder, Application application, TransitionSet transitions) {

        TransitionResultSet resultSet = new TransitionResultSet();
       
        try {
            Assert.notNull(transitionProcessorRegistry, TransitionProcessorRegistry.class.getSimpleName() + " cannot be null");

            Collection<? extends ModuleStateChange> changes = transitions.getModuleTransitions();

            for (ModuleStateChange change : changes) {
               
                if (logger.isDebugEnabled()) {
                    logger.debug("Processing module state change: " + change);
                }
               
                String transition = change.getTransition();
                ModuleDefinition currentModuleDefinition = change.getModuleDefinition();

                TransitionProcessor transitionProcessor = transitionProcessorRegistry.getTransitionProcessor(transition);
               
                TransitionResult result;
     
                try {
                    transitionProcessor.process(application, transitions.getNewRootModuleDefinition(), currentModuleDefinition);
                    result = new TransitionResult(change);
                }
                catch (Throwable error) {
                    result = new TransitionResult(change, error);
                }
               
                resultSet.addResult(result);
           
                if (result.getError() == null && moduleStateChangeNotifier != null) {
                    moduleStateChangeNotifier.notify(moduleStateHolder, result);
                }
            }
View Full Code Here

        RootModuleDefinition rootModuleDefinition = moduleStateHolder.getRootModuleDefinition();
       
        if (rootModuleDefinition != null) {
            logger.info("Shutting down application context");
            TransitionSet transitions = calculator.getTransitions(application, rootModuleDefinition, null);
            TransitionResultSet transitionResultSet = getTransitionManager().processTransitions(moduleStateHolder, application, transitions);
            return new ModuleOperationResult(transitionResultSet);
        }
        else {
            return new ModuleOperationResult(new TransitionResultSet());
        }
    }
View Full Code Here

            Assert.notNull(moduleOperationRegistry, "moduleOperationRegistry cannot be null");
           
            ModuleOperation operation = moduleOperationRegistry.getOperation(
                    ModuleOperationConstants.ReloadNamedModuleOperation);
            ModuleOperationResult execute = operation.execute(application, new ModuleOperationInput(null, null, foundModuleName));
            TransitionResultSet transitionResultSet = execute.getTransitionResultSet();

            Map<String, Object> resultMap = new HashMap<String, Object>();
            resultMap.put("moduleName", foundModuleName);
            return new ModuleOperationResult(transitionResultSet, resultMap);
        }
View Full Code Here

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

        ModuleDefinition moduleToAdd = moduleOperationInput.getModuleDefinition();
        Assert.notNull(moduleToAdd, "moduleName is required as it specifies the name of the module to add in " + this.getClass().getName());
       
        ModificationExtractor calculator = getModificationExtractorRegistry().getModificationExtractor(ModificationExtractorType.STICKY);
       
        TransitionResultSet transitionResultSet = addModule(application, calculator, moduleToAdd);
        return new ModuleOperationResult(transitionResultSet);
    }
View Full Code Here

        if (childDefinition != null) {
            childDefinition.setState(ModuleState.STALE);

            TransitionSet transitions = calculator.getTransitions(application, oldRootDefinition, newRootDefinition);
            TransitionResultSet transitionResultSet = getTransitionManager().processTransitions(moduleStateHolder, application, transitions);

            boolean result = !transitions.getModuleTransitions().isEmpty();
            return result ? new ModuleOperationResult(transitionResultSet) : ModuleOperationResult.EMPTY;
        }
       
View Full Code Here

            Assert.notNull(moduleOperationRegistry, "moduleOperationRegistry cannot be null");
           
            ModuleOperation operation = moduleOperationRegistry.getOperation(
                    ModuleOperationConstants.ReloadNamedModuleOperation);
            ModuleOperationResult execute = operation.execute(application, new ModuleOperationInput(null, null, foundModuleName));
            TransitionResultSet transitionResultSet = execute.getTransitionResultSet();

            Map<String, Object> resultMap = new HashMap<String, Object>();
            resultMap.put("moduleName", foundModuleName);
            return new ModuleOperationResult(transitionResultSet, resultMap);
        }
View Full Code Here

        }

        super.isReloadPermitted(oldModuleDefinition);
       
        TransitionSet transitions = calculator.getTransitions(application, oldModuleDefinition, newModuleDefinition);
        TransitionResultSet transitionResultSet = getTransitionManager().processTransitions(moduleStateHolder, application, transitions);
        return new ModuleOperationResult(transitionResultSet);
    }
View Full Code Here

TOP

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

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.