Search in sources :

Example 1 with AllocateAction

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

the class AssemblyContextActionFactory method generateAllocateAction.

/**
 * Create an allocation action.
 *
 * @param runtimeNode
 *            node to be allocated
 * @param reDeploymentNode
 *            node to be deployed
 * @return returns the allocation action
 */
public static AllocateAction generateAllocateAction(final ComponentNode runtimeNode, final ComponentNode reDeploymentNode) {
    final SystemadaptationFactory factory = SystemadaptationFactory.eINSTANCE;
    final AllocateAction action = factory.createAllocateAction();
    // Allcotaion has no runtime component
    // AssemblyContextActionFactory.setSourceAssemblyContext(action,
    // runtimeNode.getAssemblyContextID());
    final org.palladiosimulator.pcm.system.System reDeplSystem = ActionFactory.getRedeploymentModels().getSystemModel();
    action.setSourceAssemblyContext(ActionFactory.getAssemblyContext(reDeploymentNode.getAssemblyContextID(), reDeplSystem));
    final Allocation reDeplAllocation = ActionFactory.getRedeploymentModels().getAllocationModel();
    action.setNewAllocationContext(ActionFactory.getAllocationContext(reDeploymentNode.getAllocationContextID(), reDeplAllocation));
    return action;
}
Also used : Allocation(org.palladiosimulator.pcm.allocation.Allocation) SystemadaptationFactory(org.iobserve.planning.systemadaptation.SystemadaptationFactory) AllocateAction(org.iobserve.planning.systemadaptation.AllocateAction)

Example 2 with AllocateAction

use of org.iobserve.planning.systemadaptation.AllocateAction 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)

Aggregations

AllocateAction (org.iobserve.planning.systemadaptation.AllocateAction)2 AcquireAction (org.iobserve.planning.systemadaptation.AcquireAction)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 TerminateAction (org.iobserve.planning.systemadaptation.TerminateAction)1 Allocation (org.palladiosimulator.pcm.allocation.Allocation)1