Package org.impalaframework.module.spi

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


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

    }
   
    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

       
        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

        Assert.notNull(moduleOperationInput, "moduleOperationInput cannot be null");
        String moduleToReload = moduleOperationInput.getModuleName();
        Assert.notNull(moduleToReload, "moduleName is required as it specifies the name of the module to reload in "
                + this.getClass().getName());

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

        ModificationExtractorRegistry modificationExtractor = getModificationExtractorRegistry();
        ModificationExtractor calculator = modificationExtractor
                .getModificationExtractor(ModificationExtractorType.STRICT);
View Full Code Here

        super();
    }

    public ModuleOperationResult doExecute(Application application, ModuleOperationInput moduleOperationInput) {
       
        ModuleStateHolder moduleStateHolder = application.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(application, rootModuleDefinition, null);
            TransitionResultSet transitionResultSet = getTransitionManager().processTransitions(moduleStateHolder, application, transitions);
View Full Code Here

        String moduleToReload = moduleOperationInput.getModuleName();
        Assert.notNull(moduleToReload,
                "moduleName is required as it specifies the name used to match the module to reload in "
                        + this.getClass().getName());
       
        ModuleStateHolder moduleStateHolder = application.getModuleStateHolder();
        RootModuleDefinition newDefinition = moduleStateHolder.cloneRootModuleDefinition();

        ModuleDefinition found = newDefinition.findChildDefinition(moduleToReload, false);

        if (found != null) {
View Full Code Here

    }

    public ModuleOperationResult doExecute(Application application, ModuleOperationInput moduleOperationInput) {

        Assert.notNull(moduleOperationInput, "moduleOperationInput cannot be null");
        ModuleStateHolder moduleStateHolder = application.getModuleStateHolder();
       
        //note that the module definition source is externally supplied
        ModuleDefinitionSource newModuleDefinitionSource = moduleOperationInput.getModuleDefinitionSource();
        Assert.notNull(newModuleDefinitionSource, "moduleDefinitionSource is required as it specifies the new module definition to apply in " + this.getClass().getName());
       
View Full Code Here

    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

       
        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 = application.getModuleStateHolder();
        ModificationExtractor calculator = getModificationExtractorRegistry().getModificationExtractor(ModificationExtractorType.STRICT);
        TransitionResultSet transitionResultSet = removeModule(moduleStateHolder, application, calculator, moduleToRemove);
       
        boolean hasResults = transitionResultSet.hasResults();
        return hasResults ? new ModuleOperationResult(transitionResultSet) : ModuleOperationResult.EMPTY;
View Full Code Here

TOP

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

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.