Search in sources :

Example 1 with AssemblyContextAction

use of org.iobserve.planning.systemadaptation.AssemblyContextAction in project iobserve-analysis by research-iobserve.

the class AdaptationCalculation method compareComponents.

private void compareComponents(final Set<ComponentNode> components) {
    for (final ComponentNode reDeplComp : components) {
        final ComponentNode runComp = this.runtimeComponentNodes.get(reDeplComp.getAssemblyContextID());
        if (runComp == null) {
            // Replicate, since ID does not yet exits
            final AssemblyContextAction action = AssemblyContextActionFactory.generateReplicateAction(runComp, reDeplComp);
            this.acActions.add(action);
        } else if (!runComp.equals(reDeplComp)) {
            // Components differ, so check what actions need to be done!
            if (!runComp.getRepositoryComponentID().equals(reDeplComp.getRepositoryComponentID())) {
                // AssemblyContexts contain different RepositoryComponents
                final AssemblyContextAction action = AssemblyContextActionFactory.generateChangeRepositoryComponentAction(runComp, reDeplComp);
                this.acActions.add(action);
            }
            if (!runComp.getHostServer().getResourceContainerID().equals(reDeplComp.getHostServer().getResourceContainerID())) {
                // AssemblyContexts are hosted on different Servers
                final AssemblyContextAction action = AssemblyContextActionFactory.generateMigrateAction(runComp, reDeplComp);
                this.acActions.add(action);
            }
        }
        this.runtimeComponentNodes.remove(reDeplComp.getAssemblyContextID(), runComp);
    }
    for (final ComponentNode runComp : this.runtimeComponentNodes.values()) {
        // AssemblyContext does not exist anymore in redeployment model!
        final AssemblyContextAction action = AssemblyContextActionFactory.generateDereplicateAction(runComp);
        this.acActions.add(action);
    }
}
Also used : ComponentNode(org.iobserve.adaptation.data.graph.ComponentNode) AssemblyContextAction(org.iobserve.planning.systemadaptation.AssemblyContextAction)

Example 2 with AssemblyContextAction

use of org.iobserve.planning.systemadaptation.AssemblyContextAction in project iobserve-analysis by research-iobserve.

the class AdaptationCalculation method compareComponents.

private void compareComponents(final Set<ComponentNode> components) {
    for (final ComponentNode reDeplComp : components) {
        final ComponentNode runComp = this.runtimeComponentNodes.get(reDeplComp.getAssemblyContextID());
        if (runComp == null) {
            // Allocate, since ID does not yet exits
            final AssemblyContextAction action = AssemblyContextActionFactory.generateAllocateAction(runComp, reDeplComp);
            this.acActions.add(action);
        } else if (!runComp.equals(reDeplComp)) {
            // Components differ, so check what actions need to be done!
            if (!runComp.getRepositoryComponentID().equals(reDeplComp.getRepositoryComponentID())) {
                // AssemblyContexts contain different RepositoryComponents
                final AssemblyContextAction action = AssemblyContextActionFactory.generateChangeRepositoryComponentAction(runComp, reDeplComp);
                this.acActions.add(action);
            }
            if (!runComp.getHostServer().getResourceContainerID().equals(reDeplComp.getHostServer().getResourceContainerID())) {
                // AssemblyContexts are hosted on different Servers
                final AssemblyContextAction action = AssemblyContextActionFactory.generateMigrateAction(runComp, reDeplComp);
                this.acActions.add(action);
            }
        }
        this.runtimeComponentNodes.remove(reDeplComp.getAssemblyContextID(), runComp);
    }
    for (final ComponentNode runComp : this.runtimeComponentNodes.values()) {
        // AssemblyContext does not exist anymore in redeployment model!
        final AssemblyContextAction action = AssemblyContextActionFactory.generateDeallocateAction(runComp);
        this.acActions.add(action);
    }
}
Also used : ComponentNode(org.iobserve.analysis.data.graph.ComponentNode) AssemblyContextAction(org.iobserve.planning.systemadaptation.AssemblyContextAction)

Aggregations

AssemblyContextAction (org.iobserve.planning.systemadaptation.AssemblyContextAction)2 ComponentNode (org.iobserve.adaptation.data.graph.ComponentNode)1 ComponentNode (org.iobserve.analysis.data.graph.ComponentNode)1