Package org.impalaframework.module

Examples of org.impalaframework.module.RootModuleDefinition


    public RootModuleDefinition getRootModuleDefinition() {
        return rootModuleDefinition;
    }

    public RootModuleDefinition cloneRootModuleDefinition() {
        RootModuleDefinition newDefinition = ModuleDefinitionUtils.cloneAndUnfreeze(rootModuleDefinition);
        return newDefinition;
    }
View Full Code Here


   
    public static RootModuleDefinition cloneAndUnfreeze(RootModuleDefinition definition) {
        if (definition == null) {
            return null;
        }
        RootModuleDefinition newDefinition = (RootModuleDefinition) SerializationUtils.clone(definition);
        unfreeze(newDefinition);
        return newDefinition;
    }
View Full Code Here

    }
   
    protected void addModule(ModuleStateHolder moduleStateHolder, ModificationExtractor calculator,
            ModuleDefinition moduleDefinition) {

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

        ModuleDefinition parent = moduleDefinition.getParentDefinition();
       
        if (moduleDefinition instanceof RootModuleDefinition) {
            newRootDefinition = (RootModuleDefinition) moduleDefinition;
        }
        else {

            ModuleDefinition newParent = null;

            if (parent == null) {
                newParent = newRootDefinition;
            }
            else {
                String parentName = parent.getName();
                newParent = newRootDefinition.findChildDefinition(parentName, true);

                if (newParent == null) {
                    throw new InvalidStateException("Unable to find parent module '" + parentName + "' in " + newRootDefinition);
                }
            }
View Full Code Here

    }
   
    protected boolean removeModule(ModuleStateHolder moduleStateHolder, ModificationExtractor calculator,
            String moduleToRemove) {
       
        RootModuleDefinition oldRootDefinition = moduleStateHolder.getRootModuleDefinition();
       
        if (oldRootDefinition == null) {
            return false;
        }
       
        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(oldRootDefinition, null);
View Full Code Here

    public RootModuleDefinition getRootModuleDefinition() {
        return rootModuleDefinition;
    }

    public RootModuleDefinition cloneRootModuleDefinition() {
        RootModuleDefinition newDefinition = ModuleDefinitionUtils.cloneAndUnfreeze(rootModuleDefinition);
        return newDefinition;
    }
View Full Code Here

    }

    public RootModuleDefinition getModuleDefinition() {
        Properties rootModuleProperties = getPropertiesForModule(rootModuleName);
        TypeReader typeReader = getTypeReadeRegistry().getTypeReader(ModuleTypes.ROOT);
        RootModuleDefinition rootModuleDefinition = readRootModuleDefinition(rootModuleProperties, typeReader);
       
        //recursively build child definitions
        buildChildDefinitions(rootModuleDefinition, rootModuleName);
       
        for (String sibling : siblings) {
            ModuleDefinition siblingDefinition = buildModuleDefinition(null, sibling);
            buildChildDefinitions(siblingDefinition, siblingDefinition.getName());
            rootModuleDefinition.addSibling(siblingDefinition);
        }
        return rootModuleDefinition;
    }
View Full Code Here

            TypeReader typeReader) {
        ModuleDefinition moduleDefinition = typeReader.readModuleDefinition(null, rootModuleName, rootModuleProperties);
        if (!(moduleDefinition instanceof RootModuleDefinition)) {
            throw new IllegalStateException("Type reader " + typeReader + " produced " + ModuleDefinition.class.getSimpleName() + " which is not an instance of " + RootModuleDefinition.class.getName());
        }
        RootModuleDefinition rootDefinition = (RootModuleDefinition) moduleDefinition;
        return rootDefinition;
    }
View Full Code Here

public class RepairCommand implements TextParsingCommand {
   
    public boolean execute(CommandState commandState) {
       
        final RootModuleDefinition rootModuleDefinition = Impala.getRootModuleDefinition();
        if (rootModuleDefinition == null) {
            System.out.println("Cannot reload, as no module definition has been loaded.");
            return false;
        }
        return reload(commandState);
View Full Code Here

        StopWatch watch = new StopWatch();
        watch.start();
        Impala.repairModules();
        watch.stop();
        InteractiveCommandUtils.printExecutionInfo(watch);
        final RootModuleDefinition rootModuleDefinition = Impala.getRootModuleDefinition();
       
        System.out.println("Current module state:");
        System.out.println(rootModuleDefinition.toString());
       
        return true;
    }
View Full Code Here

        }
        return like;
    }

    public void reloadRootModule() {
        RootModuleDefinition rootModuleDefinition = getModuleStateHolder().getRootModuleDefinition();
        ModuleOperation operation = facade.getModuleOperationRegistry().getOperation(
                ModuleOperationConstants.CloseRootModuleOperation);
        operation.execute(null);
        ConstructedModuleDefinitionSource newModuleDefinitionSource = new ConstructedModuleDefinitionSource(
                rootModuleDefinition);
View Full Code Here

TOP

Related Classes of org.impalaframework.module.RootModuleDefinition

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.