use of org.palladiosimulator.pcm.allocation.AllocationContext in project iobserve-analysis by research-iobserve.
the class GraphFactory method extractAllocations.
private void extractAllocations(final Allocation allocationModel) {
final EList<AllocationContext> allocationContexts = allocationModel.getAllocationContexts_Allocation();
for (final AllocationContext allocationContext : allocationContexts) {
final ResourceContainer resContainer = allocationContext.getResourceContainer_AllocationContext();
final AssemblyContext assemblyContext = allocationContext.getAssemblyContext_AllocationContext();
this.assemblyID2allocID.put(assemblyContext.getId(), allocationContext.getId());
boolean correctIDs = true;
final String resContainerID = resContainer.getId();
if (!this.resourceContainers.containsKey(resContainerID)) {
if (GraphFactory.LOGGER.isErrorEnabled()) {
GraphFactory.LOGGER.error("A unknown ResourceContainer (ID: " + resContainer.getId() + ") was found during allocation context analysis.\n");
}
correctIDs = false;
}
final String assemblyContextID = assemblyContext.getId();
if (!this.assemblyContexts.containsKey(assemblyContextID)) {
if (GraphFactory.LOGGER.isErrorEnabled()) {
GraphFactory.LOGGER.error("An unknown AssemblyContext (ID: " + assemblyContext.getId() + ") was found during allocation context analysis.\n");
}
correctIDs = false;
}
if (correctIDs) {
this.ac2rcMap.put(assemblyContext.getId(), resContainer.getId());
}
}
}
use of org.palladiosimulator.pcm.allocation.AllocationContext in project iobserve-analysis by research-iobserve.
the class AllocationGeneration method generateAllocation.
/**
* @param newAssemblyContexts
* @param prefix
* @return
*/
public Allocation generateAllocation(final List<AssemblyContext> newAssemblyContexts, final String prefix) {
for (final AssemblyContext assemblyContext : newAssemblyContexts) {
final AllocationContext allocationContext = this.generateAllocationContext(assemblyContext);
allocationContext.setEntityName(prefix + ": " + allocationContext.getEntityName());
this.allocationModel.getAllocationContexts_Allocation().add(allocationContext);
}
return this.allocationModel;
}
use of org.palladiosimulator.pcm.allocation.AllocationContext in project iobserve-analysis by research-iobserve.
the class AllocationGeneration method generateAllocation.
/**
* @return
*/
public Allocation generateAllocation() {
for (final AssemblyContext assemblyContext : this.systemModel.getAssemblyContexts__ComposedStructure()) {
final AllocationContext allocationContext = this.generateAllocationContext(assemblyContext);
this.allocationModel.getAllocationContexts_Allocation().add(allocationContext);
}
return this.allocationModel;
}
use of org.palladiosimulator.pcm.allocation.AllocationContext in project iobserve-analysis by research-iobserve.
the class AllocationModification method modifyAllocationFixDeallocations.
/**
* @param deallocatedAssemblyContexts
*/
public void modifyAllocationFixDeallocations(final List<AssemblyContext> deallocatedAssemblyContexts) {
for (final AssemblyContext deallocatedAssemblyCon : deallocatedAssemblyContexts) {
if (this.assemblyCon2AllocationContext.containsKey(deallocatedAssemblyCon.getId())) {
final AllocationContext allocationCon = this.assemblyCon2AllocationContext.get(deallocatedAssemblyCon.getId());
this.allocationModel.getAllocationContexts_Allocation().remove(allocationCon);
}
}
}
use of org.palladiosimulator.pcm.allocation.AllocationContext in project iobserve-analysis by research-iobserve.
the class ModelTransformer method rebuildEnvironment.
private void rebuildEnvironment() throws ModelHandlingErrorException {
for (final AllocationGroup allocationGroup : this.originalAllocationGroups.getAllocationGroups()) {
final AllocationContext representingContext = allocationGroup.getRepresentingContext();
this.createResourcesAndReplicationDegrees(allocationGroup);
this.allocationModel.getAllocationContexts_Allocation().add(representingContext);
}
for (final AllocationGroup allocationGroup : this.originalAllocationGroups.getAllocationGroups()) {
final String allocationDegreeName = String.format("%s_AllocationDegree", allocationGroup.getName());
DesignDecisionModelFactory.createAllocationDegree(this.decisionModel, allocationDegreeName, allocationGroup.getRepresentingContext(), this.resourceEnvironmentModel.getResourceContainer_ResourceEnvironment());
}
ModelHelper.addAllAllocationsToReplicationDegrees(this.allocationModel, this.decisionModel);
this.saveModels();
}
Aggregations