Package org.impalaframework.module.spi

Examples of org.impalaframework.module.spi.ModificationExtractor


public class ModificationExtractorRegistry {

    private Map<ModificationExtractorType, ModificationExtractor> modificationExtractors = new HashMap<ModificationExtractorType, ModificationExtractor>();

    public ModificationExtractor getModificationExtractor(ModificationExtractorType type) {
        ModificationExtractor calculator = modificationExtractors.get(type);

        if (calculator == null) {
            throw new NoServiceException("No " + ModificationExtractor.class.getSimpleName()
                    + " available for modification type " + type);
        }
View Full Code Here


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

    Assert.notNull(moduleOperationInput, "moduleOperationInput cannot be null");
    String moduleToRemove = moduleOperationInput.getModuleName();
    Assert.notNull(moduleToRemove, "moduleName is required as it specifies the name of the module to remove in " + this.getClass().getName());
   
    ModuleStateHolder moduleStateHolder = getModuleStateHolder();
    ModificationExtractor calculator = getModificationExtractorRegistry().getModificationExtractor(ModificationExtractorType.STRICT);
    boolean result = removeModule(moduleStateHolder, calculator, moduleToRemove);
    return result ? ModuleOperationResult.TRUE : ModuleOperationResult.FALSE;
  }
View Full Code Here

public class ModificationExtractorRegistry {

    private Map<ModificationExtractorType, ModificationExtractor> modificationExtractors = new HashMap<ModificationExtractorType, ModificationExtractor>();

    public ModificationExtractor getModificationExtractor(ModificationExtractorType type) {
        ModificationExtractor calculator = modificationExtractors.get(type);

        if (calculator == null) {
            throw new NoServiceException("No " + ModificationExtractor.class.getSimpleName()
                    + " available for modification type " + type);
        }
View Full Code Here

        ModuleStateHolder moduleStateHolder = getModuleStateHolder();
        RootModuleDefinition oldRootDefinition = moduleStateHolder.cloneRootModuleDefinition();
        RootModuleDefinition newRootDefinition = moduleStateHolder.cloneRootModuleDefinition();

        ModificationExtractorRegistry modificationExtractor = getModificationExtractorRegistry();
        ModificationExtractor calculator = modificationExtractor
                .getModificationExtractor(ModificationExtractorType.STRICT);

        ModuleDefinition childDefinition = newRootDefinition.findChildDefinition(moduleToReload, true);

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

            TransitionSet transitions = calculator.getTransitions(oldRootDefinition, newRootDefinition);
            moduleStateHolder.processTransitions(transitions);

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

    public ModuleOperationResult doExecute(ModuleOperationInput moduleOperationInput) {
       
        ModuleStateHolder moduleStateHolder = getModuleStateHolder();
        ModificationExtractorRegistry modificationExtractorRegistry = getModificationExtractorRegistry();
        ModificationExtractor calculator = modificationExtractorRegistry
                .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

        RootModuleDefinition oldModuleDefinition = getExistingModuleDefinitionSource();
       
        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

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

        Assert.notNull(moduleOperationInput, "moduleOperationInput cannot be null");
        String moduleToRemove = moduleOperationInput.getModuleName();
        Assert.notNull(moduleToRemove, "moduleName is required as it specifies the name of the module to remove in " + this.getClass().getName());
       
        ModuleStateHolder moduleStateHolder = getModuleStateHolder();
        ModificationExtractor calculator = getModificationExtractorRegistry().getModificationExtractor(ModificationExtractorType.STRICT);
        boolean result = removeModule(moduleStateHolder, calculator, moduleToRemove);
        return result ? ModuleOperationResult.TRUE : ModuleOperationResult.FALSE;
    }
View Full Code Here

        ApplicationManager applicationManager = TestApplicationManager.newApplicationManager(new ModuleClassLoaderRegistry(), moduleStateHolder, new DelegatingServiceRegistry());
        Application application = applicationManager.getCurrentApplication();
       
        RootModuleDefinition test1Definition = newTest1().getModuleDefinition();
        ModificationExtractor calculator = new StrictModificationExtractor();
        TransitionSet transitions = calculator.getTransitions(application, null, test1Definition);
       
        transitionManager.processTransitions(moduleStateHolder, application, transitions);

        ConfigurableApplicationContext context = SpringModuleUtils.getRootSpringContext(moduleStateHolder);
        service((FileMonitor) context.getBean("bean1"));
        noService((FileMonitor) context.getBean("bean3"));

        RootModuleDefinition test2Definition = newTest2().getModuleDefinition();
        transitions = calculator.getTransitions(application, test1Definition, test2Definition);
        transitionManager.processTransitions(moduleStateHolder, application, transitions);

        context = SpringModuleUtils.getRootSpringContext(moduleStateHolder);
        service((FileMonitor) context.getBean("bean1"));
        //now we got bean3
View Full Code Here

TOP

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

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.