use of org.palladiosimulator.pcm.compositionprivacy.DataPrivacyLvl 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.compositionprivacy.DataPrivacyLvl in project iobserve-analysis by research-iobserve.
the class GraphFactory method adaptPrivacyLvl.
private void adaptPrivacyLvl() {
final Collection<AssemblyConnectorPrivacy> acps = this.assemblyConnectors.values();
final Set<String> acs = new HashSet<>();
for (final AssemblyConnectorPrivacy acp : acps) {
final DataPrivacyLvl assemblyConnectorPrivacyLvl = acp.getPrivacyLevel();
final String providedACID = acp.getProvidingAssemblyContext_AssemblyConnector().getId();
final String requiredACID = acp.getRequiringAssemblyContext_AssemblyConnector().getId();
this.updatePrivacyLvl(acp, assemblyConnectorPrivacyLvl, providedACID);
this.updatePrivacyLvl(acp, assemblyConnectorPrivacyLvl, requiredACID);
acs.add(requiredACID);
acs.add(providedACID);
}
if (GraphFactory.LOGGER.isInfoEnabled()) {
GraphFactory.LOGGER.info("Individual Assembly Contexts found in Assembly Connectors: " + acs.size());
}
}
use of org.palladiosimulator.pcm.compositionprivacy.DataPrivacyLvl in project iobserve-analysis by research-iobserve.
the class GraphFactory method updatePrivacyLvl.
private void updatePrivacyLvl(final AssemblyConnectorPrivacy acp, final DataPrivacyLvl assemblyConnectorPrivacyLvl, final String assemblyContextID) {
// Check whether the AssemblyContext was found while extracting
final AssemblyContext assemblyContext = this.assemblyContexts.get(assemblyContextID);
if (assemblyContext == null) {
if (GraphFactory.LOGGER.isErrorEnabled()) {
GraphFactory.LOGGER.error("The provided AssemblyContext (ID: " + assemblyContextID + ") form the AssemblyConnectorPrivacy (ID:" + acp.getId() + ") " + "was not found during the AssemblyContextExtraction");
}
this.assemblyContexts.put(assemblyContextID, acp.getProvidingAssemblyContext_AssemblyConnector());
}
// Do the actual job and update the privacy lvl
DataPrivacyLvl currentDataLevelPrivacy = this.assemblyContextPrivacyLvl.get(assemblyContextID);
if (currentDataLevelPrivacy != null) {
currentDataLevelPrivacy = DataPrivacyLvl.get(Math.min(assemblyConnectorPrivacyLvl.getValue(), currentDataLevelPrivacy.getValue()));
} else {
currentDataLevelPrivacy = assemblyConnectorPrivacyLvl;
}
this.assemblyContextPrivacyLvl.put(assemblyContextID, currentDataLevelPrivacy);
}
use of org.palladiosimulator.pcm.compositionprivacy.DataPrivacyLvl 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.compositionprivacy.DataPrivacyLvl in project iobserve-analysis by research-iobserve.
the class HostComponentAllocationGraphFactory method adaptPrivacyLvl.
private void adaptPrivacyLvl() {
final Collection<AssemblyConnector> acps = this.assemblyConnectors.values();
final Set<String> acs = new HashSet<>();
for (final AssemblyConnector acp : acps) {
if (acp instanceof AssemblyConnectorPrivacy) {
final DataPrivacyLvl assemblyConnectorPrivacyLvl = ((AssemblyConnectorPrivacy) acp).getPrivacyLevel();
final String providedACID = acp.getProvidingAssemblyContext_AssemblyConnector().getId();
final String requiredACID = acp.getRequiringAssemblyContext_AssemblyConnector().getId();
this.updatePrivacyLvl((AssemblyConnectorPrivacy) acp, assemblyConnectorPrivacyLvl, providedACID);
this.updatePrivacyLvl((AssemblyConnectorPrivacy) acp, assemblyConnectorPrivacyLvl, requiredACID);
acs.add(requiredACID);
acs.add(providedACID);
}
}
if (HostComponentAllocationGraphFactory.LOGGER.isDebugEnabled()) {
HostComponentAllocationGraphFactory.LOGGER.debug("Individual Assembly Contexts found in Assembly Connectors: " + acs.size());
}
}
Aggregations