Search in sources :

Example 21 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 22 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 23 with AssemblyContext

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

the class HostComponentAllocationGraphFactory method createComponentNodes.

private Map<String, ComponentNode> createComponentNodes(final Map<String, DeploymentNode> servers, final ModelGraphRevision revision) {
    final Map<String, ComponentNode> components = new HashMap<>();
    for (final AllocationContext allocationContext : this.allocationContexts.values()) {
        final DeploymentNode hostServer = servers.get(allocationContext.getResourceContainer_AllocationContext().getId());
        final String assemblyContextID = allocationContext.getAssemblyContext_AllocationContext().getId();
        final AssemblyContext assemblyContext = this.assemblyContexts.get(assemblyContextID);
        final DataPrivacyLvl acPrivacyLvl = this.assemblyContextPrivacyLvl.get(assemblyContextID);
        final ComponentNode component = new ComponentNode(assemblyContextID, assemblyContext.getEntityName(), acPrivacyLvl, hostServer, assemblyContext.getEncapsulatedComponent__AssemblyContext().getId(), allocationContext.getId(), revision);
        hostServer.addComponent(component);
        components.put(allocationContext.getId(), component);
    }
    return components;
}
Also used : AllocationContext(org.palladiosimulator.pcm.allocation.AllocationContext) HashMap(java.util.HashMap) AssemblyContext(org.palladiosimulator.pcm.core.composition.AssemblyContext) DataPrivacyLvl(org.palladiosimulator.pcm.compositionprivacy.DataPrivacyLvl)

Example 24 with AssemblyContext

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

the class HostComponentAllocationGraphFactory method extractAssemblyContexts.

/*
     * Extract Information Helpers
     */
private void extractAssemblyContexts(final 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 (HostComponentAllocationGraphFactory.LOGGER.isDebugEnabled()) {
        HostComponentAllocationGraphFactory.LOGGER.debug("Individual Assembly Contexts found in System Model: " + acs.size());
    }
}
Also used : AssemblyContext(org.palladiosimulator.pcm.core.composition.AssemblyContext) HashSet(java.util.HashSet)

Example 25 with AssemblyContext

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

the class UndeployPCMMapperStage method performMapping.

private void performMapping(final String service, final String context, final long observedTime) throws InvocationException, DBException {
    DeploymentLock.lock();
    final List<AssemblyEntry> assemblyEntry = this.correspondenceModelResource.findObjectsByTypeAndProperty(AssemblyEntry.class, CorrespondencePackage.Literals.ASSEMBLY_ENTRY, "implementationId", context);
    final List<ResourceContainer> resourceContainers = this.resourceEnvironmentResource.findObjectsByTypeAndProperty(ResourceContainer.class, ResourceenvironmentPackage.Literals.RESOURCE_CONTAINER, "entityName", service);
    if (!resourceContainers.isEmpty()) {
        if (assemblyEntry.size() == 1) {
            final ResourceContainer resourceContainer = resourceContainers.get(0);
            final AssemblyContext assemblyContext = this.systemModelResource.resolve(assemblyEntry.get(0).getAssembly());
            this.outputPort.send(new PCMUndeployedEvent(service, assemblyContext, resourceContainer, observedTime));
        } else if (assemblyEntry.isEmpty()) {
            this.logger.error("Undeplyoment failed: No corresponding assembly context {} found on {}.", context, service);
        } else if (assemblyEntry.size() > 1) {
            this.logger.error("Undeplyoment failed: Multiple corresponding assembly contexts {} found on {}.", context, service);
        }
    } else {
        this.logger.warn("Undeplyoment issue: No resource container found {}.", service);
    }
    DeploymentLock.unlock();
}
Also used : AssemblyEntry(org.iobserve.model.correspondence.AssemblyEntry) PCMUndeployedEvent(org.iobserve.analysis.deployment.data.PCMUndeployedEvent) AssemblyContext(org.palladiosimulator.pcm.core.composition.AssemblyContext) ResourceContainer(org.palladiosimulator.pcm.resourceenvironment.ResourceContainer)

Aggregations

AssemblyContext (org.palladiosimulator.pcm.core.composition.AssemblyContext)64 AllocationContext (org.palladiosimulator.pcm.allocation.AllocationContext)16 RepositoryComponent (org.palladiosimulator.pcm.repository.RepositoryComponent)11 ArrayList (java.util.ArrayList)9 ResourceContainer (org.palladiosimulator.pcm.resourceenvironment.ResourceContainer)9 AssemblyConnector (org.palladiosimulator.pcm.core.composition.AssemblyConnector)8 System (org.palladiosimulator.pcm.system.System)8 Test (org.junit.Test)7 Connector (org.palladiosimulator.pcm.core.composition.Connector)7 OperationProvidedRole (org.palladiosimulator.pcm.repository.OperationProvidedRole)6 HashSet (java.util.HashSet)5 EObject (org.eclipse.emf.ecore.EObject)5 Allocation (org.palladiosimulator.pcm.allocation.Allocation)5 DataPrivacyLvl (org.palladiosimulator.pcm.compositionprivacy.DataPrivacyLvl)5 OperationRequiredRole (org.palladiosimulator.pcm.repository.OperationRequiredRole)5 ProvidedRole (org.palladiosimulator.pcm.repository.ProvidedRole)5 HashMap (java.util.HashMap)4 AssemblyEntry (org.iobserve.model.correspondence.AssemblyEntry)4 RequiredRole (org.palladiosimulator.pcm.repository.RequiredRole)4 URL (java.net.URL)3