Search in sources :

Example 1 with DataPrivacyLvl

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);
}
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 2 with DataPrivacyLvl

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());
    }
}
Also used : AssemblyConnectorPrivacy(org.palladiosimulator.pcm.compositionprivacy.AssemblyConnectorPrivacy) DataPrivacyLvl(org.palladiosimulator.pcm.compositionprivacy.DataPrivacyLvl) HashSet(java.util.HashSet)

Example 3 with DataPrivacyLvl

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);
}
Also used : AssemblyContext(org.palladiosimulator.pcm.core.composition.AssemblyContext) DataPrivacyLvl(org.palladiosimulator.pcm.compositionprivacy.DataPrivacyLvl)

Example 4 with DataPrivacyLvl

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;
}
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 5 with DataPrivacyLvl

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());
    }
}
Also used : AssemblyConnectorPrivacy(org.palladiosimulator.pcm.compositionprivacy.AssemblyConnectorPrivacy) AssemblyConnector(org.palladiosimulator.pcm.core.composition.AssemblyConnector) DataPrivacyLvl(org.palladiosimulator.pcm.compositionprivacy.DataPrivacyLvl) HashSet(java.util.HashSet)

Aggregations

DataPrivacyLvl (org.palladiosimulator.pcm.compositionprivacy.DataPrivacyLvl)6 AssemblyContext (org.palladiosimulator.pcm.core.composition.AssemblyContext)4 AssemblyConnectorPrivacy (org.palladiosimulator.pcm.compositionprivacy.AssemblyConnectorPrivacy)3 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 AllocationContext (org.palladiosimulator.pcm.allocation.AllocationContext)1 AssemblyConnector (org.palladiosimulator.pcm.core.composition.AssemblyConnector)1 ResourceContainerPrivacy (org.palladiosimulator.pcm.resourceenvironmentprivacy.ResourceContainerPrivacy)1