Search in sources :

Example 6 with Interface

use of org.palladiosimulator.pcm.repository.Interface in project Palladio-Editors-Sirius by PalladioSimulator.

the class AddSEFF method getSignature.

private Signature getSignature(ResourceDemandingSEFF seff) {
    // Filter list (Repository > Interface > Signature)
    Collection<Object> filter = new ArrayList<Object>();
    filter.add(Repository.class);
    filter.add(Interface.class);
    filter.add(Signature.class);
    // Additional Child References
    Collection<EReference> additionalChildReferences = new ArrayList<EReference>();
    // Creating the dialog
    PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(SHELL, filter, additionalChildReferences, seff.eResource().getResourceSet());
    // Setting the needed object type
    dialog.setProvidedService(Signature.class);
    // Filter: Show only provided interfaces
    for (Object o : dialog.getTreeViewer().getExpandedElements()) {
        BasicComponent parent = seff.getBasicComponent_ServiceEffectSpecification();
        EList<ProvidedRole> providedRoles = parent.getProvidedRoles_InterfaceProvidingEntity();
        if (o instanceof Interface) {
            if (!isReferenced(providedRoles, (Interface) o)) {
                dialog.getTreeViewer().remove(o);
            }
        }
    }
    dialog.open();
    return (Signature) dialog.getResult();
}
Also used : OperationProvidedRole(org.palladiosimulator.pcm.repository.OperationProvidedRole) InfrastructureProvidedRole(org.palladiosimulator.pcm.repository.InfrastructureProvidedRole) ProvidedRole(org.palladiosimulator.pcm.repository.ProvidedRole) PalladioSelectEObjectDialog(org.palladiosimulator.editors.commons.dialogs.selection.PalladioSelectEObjectDialog) Signature(org.palladiosimulator.pcm.repository.Signature) ArrayList(java.util.ArrayList) BasicComponent(org.palladiosimulator.pcm.repository.BasicComponent) EObject(org.eclipse.emf.ecore.EObject) EReference(org.eclipse.emf.ecore.EReference) Interface(org.palladiosimulator.pcm.repository.Interface)

Example 7 with Interface

use of org.palladiosimulator.pcm.repository.Interface in project iobserve-analysis by research-iobserve.

the class CreatePrivacyMain method addPrivacyAnnotations.

private static void addPrivacyAnnotations(final DataProtectionModel privacyModel, final Repository repository) {
    for (final Interface iface : repository.getInterfaces__Repository()) {
        if (iface instanceof OperationInterface) {
            CreatePrivacyMain.LOGGER.debug(String.format("interface %s\n", iface.getEntityName()));
            final OperationInterface operationInterface = (OperationInterface) iface;
            final Map<String, OperationSignatureDataProtection> ifacePrivacy = CreatePrivacyMain.PRIVACY_LEVEL_MAPS.get(iface.getEntityName());
            for (final OperationSignature signature : operationInterface.getSignatures__OperationInterface()) {
                CreatePrivacyMain.LOGGER.debug(String.format("\tsignature %s\n", signature.getEntityName()));
                final OperationSignatureDataProtection signaturePrivacy = ifacePrivacy.get(signature.getEntityName());
                if (signature.getReturnType__OperationSignature() != null) {
                    final ReturnTypeDataProtection returnTypeDataProection = PrivacyFactory.eINSTANCE.createReturnTypeDataProtection();
                    returnTypeDataProection.setLevel(signaturePrivacy.getReturnTypePrivacy());
                    returnTypeDataProection.setOperationSignature(signature);
                    privacyModel.getDataProectionLevels().add(returnTypeDataProection);
                }
                for (final Parameter parameter : signature.getParameters__OperationSignature()) {
                    CreatePrivacyMain.LOGGER.debug(String.format("\t\tparameter %s\n", parameter.getParameterName()));
                    final ParameterDataProtection parameterPrivacy = PrivacyFactory.eINSTANCE.createParameterDataProtection();
                    parameterPrivacy.setLevel(signaturePrivacy.getParameterPrivacy().get(parameter.getParameterName()));
                    parameterPrivacy.setParameter(parameter);
                    privacyModel.getDataProectionLevels().add(parameterPrivacy);
                }
            }
        }
    }
}
Also used : ReturnTypeDataProtection(org.iobserve.model.privacy.ReturnTypeDataProtection) OperationSignature(org.palladiosimulator.pcm.repository.OperationSignature) ParameterDataProtection(org.iobserve.model.privacy.ParameterDataProtection) Parameter(org.palladiosimulator.pcm.repository.Parameter) OperationInterface(org.palladiosimulator.pcm.repository.OperationInterface) Interface(org.palladiosimulator.pcm.repository.Interface) OperationInterface(org.palladiosimulator.pcm.repository.OperationInterface)

Example 8 with Interface

use of org.palladiosimulator.pcm.repository.Interface in project iobserve-analysis by research-iobserve.

the class DataProtectionWarner method clearAndFillQueryMaps.

/**
 * Fills the hash maps used for queries.
 *
 * @throws DBException
 * @throws InvocationException
 */
private void clearAndFillQueryMaps() throws InvocationException, DBException {
    DeploymentLock.lock();
    this.vertices.clear();
    this.geolocations.clear();
    this.stereotypes.clear();
    this.parameterprivacy.clear();
    this.returntypeprivacy.clear();
    this.interfaces.clear();
    for (final GeoLocation location : this.privacyRootElement.getResourceContainerLocations()) {
        this.geolocations.put(this.resourceEnvironmentResource.resolve(location.getResourceContainer()).getId(), location);
    }
    for (final EncapsulatedDataSource stereotype : this.privacyRootElement.getEncapsulatedDataSources()) {
        if (stereotype != null) {
            final BasicComponent resolvedComponent = this.repositoryResource.resolve(stereotype.getComponent());
            this.stereotypes.put(resolvedComponent.getId(), stereotype);
        } else {
            this.logger.debug("missing {}", stereotype);
        }
    }
    for (final IDataProtectionAnnotation dataProectionAnnocation : this.privacyRootElement.getDataProectionLevels()) {
        if (dataProectionAnnocation instanceof ParameterDataProtection) {
            final ParameterDataProtection parameterDataProtection = (ParameterDataProtection) dataProectionAnnocation;
            final Parameter parameter = this.repositoryResource.resolve(parameterDataProtection.getParameter());
            this.parameterprivacy.put(parameter.getParameterName(), parameterDataProtection);
        }
        if (dataProectionAnnocation instanceof ReturnTypeDataProtection) {
            final ReturnTypeDataProtection returnTypeDataProection = (ReturnTypeDataProtection) dataProectionAnnocation;
            this.returntypeprivacy.put(this.repositoryResource.resolve(returnTypeDataProection.getOperationSignature()).getId(), returnTypeDataProection);
        }
    }
    for (final Interface inf : this.repositoryRootElement.getInterfaces__Repository()) {
        if (inf instanceof OperationInterface) {
            this.interfaces.put(inf.getEntityName(), (OperationInterface) inf);
        }
    }
    DeploymentLock.unlock();
}
Also used : ReturnTypeDataProtection(org.iobserve.model.privacy.ReturnTypeDataProtection) ParameterDataProtection(org.iobserve.model.privacy.ParameterDataProtection) BasicComponent(org.palladiosimulator.pcm.repository.BasicComponent) Parameter(org.palladiosimulator.pcm.repository.Parameter) GeoLocation(org.iobserve.model.privacy.GeoLocation) EncapsulatedDataSource(org.iobserve.model.privacy.EncapsulatedDataSource) IDataProtectionAnnotation(org.iobserve.model.privacy.IDataProtectionAnnotation) OperationInterface(org.palladiosimulator.pcm.repository.OperationInterface) Interface(org.palladiosimulator.pcm.repository.Interface) OperationInterface(org.palladiosimulator.pcm.repository.OperationInterface)

Example 9 with Interface

use of org.palladiosimulator.pcm.repository.Interface in project iobserve-analysis by research-iobserve.

the class RepositoryLookupModelProvider method initializeLookupMaps.

/**
 * Initializing the maps for data access.
 */
private void initializeLookupMaps() {
    this.opInfToProvInfMap = new HashMap<>();
    this.opProvidedRoleMap = new HashMap<>();
    this.operationInterfaceMap = new HashMap<>();
    this.operationSignatureMap = new HashMap<>();
    // loading OperationProvidedRoles and OperationInterfaces in dedicated maps
    for (final RepositoryComponent nextRepoCmp : this.repositoryModel.getComponents__Repository()) {
        if (nextRepoCmp instanceof BasicComponent) {
            final BasicComponent basicCmp = (BasicComponent) nextRepoCmp;
            for (final ProvidedRole providedRole : basicCmp.getProvidedRoles_InterfaceProvidingEntity()) {
                if (providedRole instanceof OperationProvidedRole) {
                    final OperationProvidedRole opProvRole = (OperationProvidedRole) providedRole;
                    final OperationInterface opInterface = opProvRole.getProvidedInterface__OperationProvidedRole();
                    this.opInfToProvInfMap.put(opInterface.getId(), opProvRole.getId());
                    this.opProvidedRoleMap.put(opProvRole.getId(), opProvRole);
                }
            }
        }
    }
    // loading OperationInterfaces and OperationSignatures in dedicated maps
    for (final Interface nextInterface : this.repositoryModel.getInterfaces__Repository()) {
        if (nextInterface instanceof OperationInterface) {
            final OperationInterface opInf = (OperationInterface) nextInterface;
            this.operationInterfaceMap.put(opInf.getId(), opInf);
            for (final OperationSignature opSig : opInf.getSignatures__OperationInterface()) {
                this.operationSignatureMap.put(opSig.getId(), opSig);
            }
        }
    }
}
Also used : OperationProvidedRole(org.palladiosimulator.pcm.repository.OperationProvidedRole) ProvidedRole(org.palladiosimulator.pcm.repository.ProvidedRole) OperationSignature(org.palladiosimulator.pcm.repository.OperationSignature) OperationProvidedRole(org.palladiosimulator.pcm.repository.OperationProvidedRole) BasicComponent(org.palladiosimulator.pcm.repository.BasicComponent) RepositoryComponent(org.palladiosimulator.pcm.repository.RepositoryComponent) OperationInterface(org.palladiosimulator.pcm.repository.OperationInterface) Interface(org.palladiosimulator.pcm.repository.Interface) OperationInterface(org.palladiosimulator.pcm.repository.OperationInterface)

Aggregations

Interface (org.palladiosimulator.pcm.repository.Interface)9 OperationInterface (org.palladiosimulator.pcm.repository.OperationInterface)8 OperationProvidedRole (org.palladiosimulator.pcm.repository.OperationProvidedRole)6 RepositoryComponent (org.palladiosimulator.pcm.repository.RepositoryComponent)6 BasicComponent (org.palladiosimulator.pcm.repository.BasicComponent)5 OperationSignature (org.palladiosimulator.pcm.repository.OperationSignature)5 ProvidedRole (org.palladiosimulator.pcm.repository.ProvidedRole)5 Repository (org.palladiosimulator.pcm.repository.Repository)3 ParameterDataProtection (org.iobserve.model.privacy.ParameterDataProtection)2 ReturnTypeDataProtection (org.iobserve.model.privacy.ReturnTypeDataProtection)2 Test (org.junit.Test)2 Parameter (org.palladiosimulator.pcm.repository.Parameter)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 Set (java.util.Set)1 EObject (org.eclipse.emf.ecore.EObject)1 EReference (org.eclipse.emf.ecore.EReference)1 DBException (org.iobserve.model.persistence.DBException)1