Search in sources :

Example 1 with ComponentNode

use of org.iobserve.analysis.data.graph.ComponentNode 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)

Example 2 with ComponentNode

use of org.iobserve.analysis.data.graph.ComponentNode in project iobserve-analysis by research-iobserve.

the class ResourceContainerActionFactory method createReplicateAction.

/**
 * Create replicate action.
 *
 * @param runtimeServer
 *            source server
 * @param reDeploymentServer
 *            target server
 * @return the action
 */
public static ReplicateAction createReplicateAction(final DeploymentNode runtimeServer, final DeploymentNode reDeploymentServer) {
    final SystemadaptationFactory factory = SystemadaptationFactory.eINSTANCE;
    final ReplicateAction action = factory.createReplicateAction();
    ResourceContainerActionFactory.setSourceResourceContainer(action, runtimeServer.getResourceContainerID());
    final Allocation runtimeAllocModel = ActionFactory.getRuntimeModels().getAllocationModel();
    for (final ComponentNode component : runtimeServer.getContainingComponents()) {
        final AllocationContext oldAllocationContext = ActionFactory.getAllocationContext(component.getAllocationContextID(), runtimeAllocModel);
        action.getSourceAllocationContext().add(oldAllocationContext);
    }
    final Allocation reDeplAllocModel = ActionFactory.getRedeploymentModels().getAllocationModel();
    for (final ComponentNode component : reDeploymentServer.getContainingComponents()) {
        final AllocationContext newAllocationContext = ActionFactory.getAllocationContext(component.getAllocationContextID(), reDeplAllocModel);
        action.getSourceAllocationContext().add(newAllocationContext);
    }
    final ResourceEnvironment resEnvModel = ActionFactory.getRedeploymentModels().getResourceEnvironmentModel();
    final ResourceContainer newResourceContainer = ActionFactory.getResourceContainer(reDeploymentServer.getResourceContainerID(), resEnvModel);
    action.setNewResourceContainer(newResourceContainer);
    return action;
}
Also used : AllocationContext(org.palladiosimulator.pcm.allocation.AllocationContext) ResourceEnvironment(org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment) Allocation(org.palladiosimulator.pcm.allocation.Allocation) SystemadaptationFactory(org.iobserve.planning.systemadaptation.SystemadaptationFactory) ComponentNode(org.iobserve.analysis.data.graph.ComponentNode) ReplicateAction(org.iobserve.planning.systemadaptation.ReplicateAction) ResourceContainer(org.palladiosimulator.pcm.resourceenvironment.ResourceContainer)

Aggregations

ComponentNode (org.iobserve.analysis.data.graph.ComponentNode)2 AssemblyContextAction (org.iobserve.planning.systemadaptation.AssemblyContextAction)1 ReplicateAction (org.iobserve.planning.systemadaptation.ReplicateAction)1 SystemadaptationFactory (org.iobserve.planning.systemadaptation.SystemadaptationFactory)1 Allocation (org.palladiosimulator.pcm.allocation.Allocation)1 AllocationContext (org.palladiosimulator.pcm.allocation.AllocationContext)1 ResourceContainer (org.palladiosimulator.pcm.resourceenvironment.ResourceContainer)1 ResourceEnvironment (org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment)1