Search in sources :

Example 1 with TerminateAction

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

the class AdaptationCalculation method compareServers.

private void compareServers(final Set<DeploymentNode> servers) {
    for (final DeploymentNode reDeplServer : servers) {
        if (reDeplServer.getContainingComponents().size() == 0) {
            // If the server dosn't contain any components => IGNORE
            continue;
        }
        final DeploymentNode runServer = this.runtimeDeploymentNodes.get(reDeplServer.getResourceContainerID());
        if (runServer == null) {
            // It is an so far unused server!
            final AcquireAction action = ResourceContainerActionFactory.createAcquireAction(reDeplServer);
            this.rcActions.add(action);
        } else {
            // Server was and is still in use
            this.runtimeDeploymentNodes.remove(runServer.getResourceContainerID(), runServer);
        }
    }
    for (final DeploymentNode runServer : this.runtimeDeploymentNodes.values()) {
        // AssemblyContext does not exist anymore in redeployment model!
        final TerminateAction action = ResourceContainerActionFactory.createTerminateAction(runServer);
        this.rcActions.add(action);
    }
}
Also used : AcquireAction(org.iobserve.planning.systemadaptation.AcquireAction) TerminateAction(org.iobserve.planning.systemadaptation.TerminateAction) DeploymentNode(org.iobserve.analysis.data.graph.DeploymentNode)

Example 2 with TerminateAction

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

the class AdaptationPlanning method printAction.

private String printAction(final Action action) {
    final StringBuilder sb = new StringBuilder(200);
    if (action instanceof AcquireAction) {
        final AcquireAction acquire = (AcquireAction) action;
        sb.append("Acquire:\t").append(acquire.getSourceResourceContainer().getEntityName());
        sb.append("\tID: ").append(acquire.getSourceResourceContainer().getId());
    } else if (action instanceof TerminateAction) {
        final TerminateAction terminate = (TerminateAction) action;
        sb.append("Terminate:\t").append(terminate.getSourceResourceContainer().getEntityName());
        sb.append("\tID: ").append(terminate.getSourceResourceContainer().getId());
    } else if (action instanceof AllocateAction) {
        final AllocateAction allocate = (AllocateAction) action;
        sb.append("Allocate:\t").append(allocate.getSourceAssemblyContext().getEntityName());
        sb.append("\tID: ").append(allocate.getSourceAssemblyContext().getId());
        sb.append("\t ------- ");
        sb.append("\t->\t").append(allocate.getNewAllocationContext().getEntityName());
    } else if (action instanceof MigrateAction) {
        final MigrateAction migrate = (MigrateAction) action;
        sb.append("Migrate:\t").append(migrate.getSourceAssemblyContext().getEntityName());
        sb.append("\tID: ").append(migrate.getSourceAssemblyContext().getId());
        sb.append('\t').append(migrate.getSourceAllocationContext().getResourceContainer_AllocationContext().getEntityName());
        sb.append("\t->\t").append(migrate.getNewAllocationContext().getResourceContainer_AllocationContext().getEntityName());
    } else if (action instanceof ChangeRepositoryComponentAction) {
        final ChangeRepositoryComponentAction change = (ChangeRepositoryComponentAction) action;
        sb.append("ChangeComp:\t").append(change.getSourceAssemblyContext().getEntityName());
        sb.append("\tID: ").append(change.getSourceAssemblyContext().getId());
        sb.append('\t').append(change.getSourceAssemblyContext().getEncapsulatedComponent__AssemblyContext().getEntityName());
        sb.append("\t->\t").append(change.getNewRepositoryComponent().getEntityName());
    } else if (action instanceof DeallocateAction) {
        final DeallocateAction deAllocate = (DeallocateAction) action;
        sb.append("Deallocate:\t").append(deAllocate.getSourceAssemblyContext().getEntityName());
        sb.append("\tID: ").append(deAllocate.getSourceAssemblyContext().getId());
    } else {
        sb.append("UNKOWN:\t" + " ------------------------------------ ");
        sb.append("\tID: " + " ------------------------------------ ");
    }
    return sb.toString();
}
Also used : AcquireAction(org.iobserve.planning.systemadaptation.AcquireAction) TerminateAction(org.iobserve.planning.systemadaptation.TerminateAction) DeallocateAction(org.iobserve.planning.systemadaptation.DeallocateAction) AllocateAction(org.iobserve.planning.systemadaptation.AllocateAction) MigrateAction(org.iobserve.planning.systemadaptation.MigrateAction) ChangeRepositoryComponentAction(org.iobserve.planning.systemadaptation.ChangeRepositoryComponentAction)

Example 3 with TerminateAction

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

the class ResourceContainerActionFactory method createTerminateAction.

/**
 * Create a terminate action.
 *
 * @param runtimeServer
 *            the node going to be terminated
 * @return the action
 */
public static TerminateAction createTerminateAction(final DeploymentNode runtimeServer) {
    final SystemadaptationFactory factory = SystemadaptationFactory.eINSTANCE;
    final TerminateAction action = factory.createTerminateAction();
    ResourceContainerActionFactory.setSourceResourceContainer(action, runtimeServer.getResourceContainerID());
    return action;
}
Also used : TerminateAction(org.iobserve.planning.systemadaptation.TerminateAction) SystemadaptationFactory(org.iobserve.planning.systemadaptation.SystemadaptationFactory)

Aggregations

TerminateAction (org.iobserve.planning.systemadaptation.TerminateAction)3 AcquireAction (org.iobserve.planning.systemadaptation.AcquireAction)2 DeploymentNode (org.iobserve.analysis.data.graph.DeploymentNode)1 AllocateAction (org.iobserve.planning.systemadaptation.AllocateAction)1 ChangeRepositoryComponentAction (org.iobserve.planning.systemadaptation.ChangeRepositoryComponentAction)1 DeallocateAction (org.iobserve.planning.systemadaptation.DeallocateAction)1 MigrateAction (org.iobserve.planning.systemadaptation.MigrateAction)1 SystemadaptationFactory (org.iobserve.planning.systemadaptation.SystemadaptationFactory)1