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;
}
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();
}
Aggregations