Search in sources :

Example 1 with AllocationContext

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());
        }
    }
}
Also used : AllocationContext(org.palladiosimulator.pcm.allocation.AllocationContext) AssemblyContext(org.palladiosimulator.pcm.core.composition.AssemblyContext) ResourceContainer(org.palladiosimulator.pcm.resourceenvironment.ResourceContainer)

Example 2 with AllocationContext

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;
}
Also used : AllocationContext(org.palladiosimulator.pcm.allocation.AllocationContext) AssemblyContext(org.palladiosimulator.pcm.core.composition.AssemblyContext)

Example 3 with AllocationContext

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;
}
Also used : AllocationContext(org.palladiosimulator.pcm.allocation.AllocationContext) AssemblyContext(org.palladiosimulator.pcm.core.composition.AssemblyContext)

Example 4 with AllocationContext

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);
        }
    }
}
Also used : AllocationContext(org.palladiosimulator.pcm.allocation.AllocationContext) AssemblyContext(org.palladiosimulator.pcm.core.composition.AssemblyContext)

Example 5 with AllocationContext

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();
}
Also used : AllocationContext(org.palladiosimulator.pcm.allocation.AllocationContext) AllocationGroup(org.iobserve.planning.data.AllocationGroup)

Aggregations

AllocationContext (org.palladiosimulator.pcm.allocation.AllocationContext)48 AssemblyContext (org.palladiosimulator.pcm.core.composition.AssemblyContext)16 Set (java.util.Set)11 OperationSignature (org.palladiosimulator.pcm.repository.OperationSignature)11 ResourceContainer (org.palladiosimulator.pcm.resourceenvironment.ResourceContainer)11 HashSet (java.util.HashSet)10 HashMap (java.util.HashMap)9 Allocation (org.palladiosimulator.pcm.allocation.Allocation)9 Test (org.junit.Test)7 LinkedHashSet (java.util.LinkedHashSet)4 ProbeManagementData (org.iobserve.service.privacy.violation.data.ProbeManagementData)4 Edge (org.iobserve.service.privacy.violation.transformation.analysisgraph.Edge)4 DBException (org.iobserve.model.persistence.DBException)3 InvocationException (org.iobserve.model.persistence.neo4j.InvocationException)3 ControlEventCreationFailedException (org.iobserve.service.privacy.violation.exceptions.ControlEventCreationFailedException)3 Vertex (org.iobserve.service.privacy.violation.transformation.analysisgraph.Vertex)3 RepositoryComponent (org.palladiosimulator.pcm.repository.RepositoryComponent)3 ResourceEnvironment (org.palladiosimulator.pcm.resourceenvironment.ResourceEnvironment)3 LinkedList (java.util.LinkedList)2 AllocationEntry (org.iobserve.model.correspondence.AllocationEntry)2