use of org.palladiosimulator.pcm.resourceenvironmentprivacy.ResourceContainerPrivacy 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);
}
use of org.palladiosimulator.pcm.resourceenvironmentprivacy.ResourceContainerPrivacy in project iobserve-analysis by research-iobserve.
the class ResourceEnvironmentGeneration method craeteResourceEnvironment.
public ResourceEnvironment craeteResourceEnvironment(final int resourceContainerCount) {
for (int i = 0; i < resourceContainerCount; i++) {
final String prefix = Integer.toString(i);
final ResourceContainerPrivacy resContainer = this.createResourceContainer(prefix);
this.resourceEnvironment.getResourceContainer_ResourceEnvironment().add(resContainer);
}
return this.resourceEnvironment;
}
use of org.palladiosimulator.pcm.resourceenvironmentprivacy.ResourceContainerPrivacy in project iobserve-analysis by research-iobserve.
the class ResourceEnvironmentGeneration method addResourceContainers.
public void addResourceContainers(final int resourceContainerCount, final String postPrefix) {
for (int i = 0; i < resourceContainerCount; i++) {
final String prefix = Integer.toString(i);
final ResourceContainerPrivacy resContainer = this.createResourceContainer(prefix + "_" + postPrefix);
this.resourceEnvironment.getResourceContainer_ResourceEnvironment().add(resContainer);
}
}
use of org.palladiosimulator.pcm.resourceenvironmentprivacy.ResourceContainerPrivacy in project iobserve-analysis by research-iobserve.
the class GeoLocation method execute.
@Override
protected void execute(final PCMDeployedEvent element) throws Exception {
// TODO this might be better implemented using query functions addressing RescourceContainer
final ResourceEnvironment resourceEnvironment = this.resourceEnvironmentModelProvider.readRootComponent(ResourceEnvironment.class);
final EList<ResourceContainer> resContainers = resourceEnvironment.getResourceContainer_ResourceEnvironment();
for (final ResourceContainer resContainer : resContainers) {
if (resContainer.getEntityName().equals(element.getService()) && resContainer instanceof ResourceContainerPrivacy) {
final ResourceContainerPrivacy resContainerPrivacy = (ResourceContainerPrivacy) resContainer;
final int geolocation = resContainerPrivacy.getGeolocation();
if (geolocation != element.getCountryCode()) {
resContainerPrivacy.setGeolocation(element.getCountryCode());
this.outputPort.send(element);
}
break;
}
}
}
use of org.palladiosimulator.pcm.resourceenvironmentprivacy.ResourceContainerPrivacy in project iobserve-analysis by research-iobserve.
the class ResourceEnvironmentModelFactory method createResourceContainer.
/**
* Create a {@link ResourceContainer} with the given name, without checking if it already
* exists. Use {@link #createResourceContainerIfAbsent(String)} instead if you wont create the
* container if it is already available.
*
* @param model
* resource environment model
* @param name
* name of the new container
* @return builder
*/
public static ResourceContainer createResourceContainer(final ResourceEnvironment model, final String name) {
final ResourceContainerPrivacy resContainer = ResourceenvironmentPrivacyFactory.eINSTANCE.createResourceContainerPrivacy();
resContainer.setEntityName(name);
model.getResourceContainer_ResourceEnvironment().add(resContainer);
return resContainer;
}
Aggregations