Search in sources :

Example 1 with AssemblyContext

use of org.palladiosimulator.pcm.core.composition.AssemblyContext in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddAllocationContextAssemblyContext method getAssemblyContext.

private AssemblyContext getAssemblyContext(AllocationContext allocationContext) {
    Collection<Object> filter = new ArrayList<Object>();
    filter.add(org.palladiosimulator.pcm.system.System.class);
    filter.add(AssemblyContext.class);
    Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
    PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, allocationContext.eResource().getResourceSet());
    dialog.setProvidedService(AssemblyContext.class);
    dialog.open();
    return (AssemblyContext) dialog.getResult();
}
Also used : PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) ArrayList(java.util.ArrayList) EObject(org.eclipse.emf.ecore.EObject) AssemblyContext(org.palladiosimulator.pcm.core.composition.AssemblyContext) EReference(org.eclipse.emf.ecore.EReference)

Example 2 with AssemblyContext

use of org.palladiosimulator.pcm.core.composition.AssemblyContext in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddAllocationContextAssemblyContext method execute.

@Override
public void execute(final Collection<? extends EObject> selections, final Map<String, Object> parameters) {
    AllocationContext allocationContext = (AllocationContext) parameters.get("instance");
    AssemblyContext assemblyContext = (AssemblyContext) getAssemblyContext(allocationContext);
    allocationContext.setAssemblyContext_AllocationContext(assemblyContext);
}
Also used : AllocationContext(org.palladiosimulator.pcm.allocation.AllocationContext) AssemblyContext(org.palladiosimulator.pcm.core.composition.AssemblyContext)

Example 3 with AssemblyContext

use of org.palladiosimulator.pcm.core.composition.AssemblyContext in project Palladio-Editors-Sirius by PalladioSimulator.

the class AllocationServices method getNestedUndeployedAssemblyContexts.

public Collection<AssemblyContext> getNestedUndeployedAssemblyContexts(AssemblyContext parentAssemblyContext, Allocation allocation) {
    if (!(parentAssemblyContext.getEncapsulatedComponent__AssemblyContext() instanceof SubSystem))
        return null;
    SubSystem encapsulatedSubsystem = (SubSystem) parentAssemblyContext.getEncapsulatedComponent__AssemblyContext();
    Collection<AssemblyContext> result = new ArrayList<AssemblyContext>();
    for (AssemblyContext nestedAssemblyContext : encapsulatedSubsystem.getAssemblyContexts__ComposedStructure()) {
        if (!isAllocated(nestedAssemblyContext, allocation))
            result.add(nestedAssemblyContext);
    }
    return result;
}
Also used : SubSystem(org.palladiosimulator.pcm.subsystem.SubSystem) ArrayList(java.util.ArrayList) AssemblyContext(org.palladiosimulator.pcm.core.composition.AssemblyContext)

Example 4 with AssemblyContext

use of org.palladiosimulator.pcm.core.composition.AssemblyContext in project iobserve-analysis by research-iobserve.

the class GraphFactory method createModelGraph.

/*
     * Build Graph Helpers
     */
private ModelGraph createModelGraph() {
    final Map<String, DeploymentNode> servers = new HashMap<>();
    final Map<String, ComponentNode> components = new HashMap<>();
    // Build Servers Nodes
    for (final ResourceContainerPrivacy resContainer : this.resourceContainers.values()) {
        final DeploymentNode server = new DeploymentNode(resContainer.getId(), resContainer.getEntityName(), resContainer.getGeolocation());
        servers.put(resContainer.getId(), server);
    }
    // Build Component Nodes
    for (final AssemblyContext ac : this.assemblyContexts.values()) {
        final DeploymentNode hostServer = servers.get(this.ac2rcMap.get(ac.getId()));
        final DataPrivacyLvl acPrivacyLvl = this.assemblyContextPrivacyLvl.get(ac.getId());
        final ComponentNode component = new ComponentNode(ac.getId(), ac.getEntityName(), acPrivacyLvl, hostServer, ac.getEncapsulatedComponent__AssemblyContext().getId(), this.assemblyID2allocID.get(ac.getId()));
        hostServer.addComponent(component);
        components.put(ac.getId(), component);
    }
    // Set Edges
    for (final AssemblyConnectorPrivacy acp : this.assemblyConnectors.values()) {
        final String provACID = acp.getProvidingAssemblyContext_AssemblyConnector().getId();
        final String reqACID = acp.getRequiringAssemblyContext_AssemblyConnector().getId();
        final ComponentNode provNode = components.get(provACID);
        final ComponentNode reqNode = components.get(reqACID);
        final ComponentEdge edge = new ComponentEdge(acp.getId(), acp.getEntityName(), provNode, reqNode, acp.getPrivacyLevel());
        provNode.addCommunicationEdge(edge);
        reqNode.addCommunicationEdge(edge);
    }
    return new ModelGraph(servers.values(), components.values(), this.modelProvider);
}
Also used : AssemblyConnectorPrivacy(org.palladiosimulator.pcm.compositionprivacy.AssemblyConnectorPrivacy) HashMap(java.util.HashMap) ResourceContainerPrivacy(org.palladiosimulator.pcm.resourceenvironmentprivacy.ResourceContainerPrivacy) AssemblyContext(org.palladiosimulator.pcm.core.composition.AssemblyContext) DataPrivacyLvl(org.palladiosimulator.pcm.compositionprivacy.DataPrivacyLvl)

Example 5 with AssemblyContext

use of org.palladiosimulator.pcm.core.composition.AssemblyContext in project iobserve-analysis by research-iobserve.

the class GraphFactory method extractAssemblyContexts.

/*
     * Extract Information Helpers
     */
private void extractAssemblyContexts(final org.palladiosimulator.pcm.system.System sysModel) {
    final EList<AssemblyContext> newAssemblyContexts = sysModel.getAssemblyContexts__ComposedStructure();
    final Set<String> acs = new HashSet<>();
    for (final AssemblyContext assemblyContext : newAssemblyContexts) {
        this.assemblyContexts.put(assemblyContext.getId(), assemblyContext);
        acs.add(assemblyContext.getId());
    }
    if (GraphFactory.LOGGER.isInfoEnabled()) {
        GraphFactory.LOGGER.info("Individual Assembly Contexts found in System Model: " + acs.size());
    }
}
Also used : AssemblyContext(org.palladiosimulator.pcm.core.composition.AssemblyContext) HashSet(java.util.HashSet)

Aggregations

AssemblyContext (org.palladiosimulator.pcm.core.composition.AssemblyContext)40 ArrayList (java.util.ArrayList)8 AllocationContext (org.palladiosimulator.pcm.allocation.AllocationContext)7 AssemblyConnector (org.palladiosimulator.pcm.core.composition.AssemblyConnector)5 RepositoryComponent (org.palladiosimulator.pcm.repository.RepositoryComponent)5 ResourceContainer (org.palladiosimulator.pcm.resourceenvironment.ResourceContainer)5 System (org.palladiosimulator.pcm.system.System)5 Allocation (org.palladiosimulator.pcm.allocation.Allocation)4 Connector (org.palladiosimulator.pcm.core.composition.Connector)4 OperationProvidedRole (org.palladiosimulator.pcm.repository.OperationProvidedRole)4 OperationRequiredRole (org.palladiosimulator.pcm.repository.OperationRequiredRole)4 ProvidedRole (org.palladiosimulator.pcm.repository.ProvidedRole)4 RequiredRole (org.palladiosimulator.pcm.repository.RequiredRole)4 EObject (org.eclipse.emf.ecore.EObject)3 DataPrivacyLvl (org.palladiosimulator.pcm.compositionprivacy.DataPrivacyLvl)3 SubSystem (org.palladiosimulator.pcm.subsystem.SubSystem)3 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 LinkedList (java.util.LinkedList)2 JsonArray (javax.json.JsonArray)2