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