Search in sources :

Example 16 with RepositoryComponent

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

the class SystemDataFactory method createAssemblyContext.

private static AssemblyContext createAssemblyContext(final Repository repository, final String contextName, final String componentName) {
    final AssemblyContext assemblyContext = CompositionFactory.eINSTANCE.createAssemblyContext();
    final RepositoryComponent component = RepositoryModelDataFactory.findComponentByName(repository, componentName);
    assemblyContext.setEncapsulatedComponent__AssemblyContext(component);
    assemblyContext.setEntityName(contextName);
    return assemblyContext;
}
Also used : AssemblyContext(org.palladiosimulator.pcm.core.composition.AssemblyContext) RepositoryComponent(org.palladiosimulator.pcm.repository.RepositoryComponent)

Example 17 with RepositoryComponent

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

the class RepositoryModelProviderTest method createThenReadReferencing.

@Override
@Test
public void createThenReadReferencing() throws DBException {
    final Neo4JModelResource<Repository> resource = ModelProviderTestUtils.prepareResource("createThenReadReferencing", this.prefix, this.ePackage);
    resource.storeModelPartition(this.testModel);
    final RepositoryComponent object = RepositoryModelDataFactory.findComponentByName(this.repository, RepositoryModelDataFactory.SEARCH_COMPONENT);
    final OperationProvidedRole providedSearchRole = RepositoryModelDataFactory.findProvidedRole(object, RepositoryModelDataFactory.CATALOG_SEARCH_PROVIDED_ROLE);
    final String id = ModelGraphFactory.getIdentification(object);
    final List<EObject> readReferencingObjects = resource.collectReferencingObjectsByTypeAndProperty(BasicComponent.class, RepositoryPackage.Literals.BASIC_COMPONENT, id);
    // Only the providedSearchOperation role is referencing the catalogSearch component
    Assert.assertTrue(readReferencingObjects.size() == 1);
    Assert.assertTrue(this.equalityHelper.comparePartition(providedSearchRole, readReferencingObjects.get(0), providedSearchRole.eClass()));
    resource.getGraphDatabaseService().shutdown();
}
Also used : Repository(org.palladiosimulator.pcm.repository.Repository) OperationProvidedRole(org.palladiosimulator.pcm.repository.OperationProvidedRole) EObject(org.eclipse.emf.ecore.EObject) RepositoryComponent(org.palladiosimulator.pcm.repository.RepositoryComponent) Test(org.junit.Test)

Example 18 with RepositoryComponent

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

the class ProbeMapper method computeAllocationComponentJavaSignature.

private String computeAllocationComponentJavaSignature(final AllocationContext allocation, final OperationSignature operationSignature) throws ControlEventCreationFailedException, InvocationException, DBException {
    // there are only interfaces on model level -> therefore only public methods (no
    // getModifiers available)
    final String modifier = "public";
    final DataType returnType = operationSignature.getReturnType__OperationSignature();
    final List<DataTypeEntry> dataTypeEntries = this.correspondenceResource.collectAllObjectsByType(DataTypeEntry.class, CorrespondencePackage.Literals.DATA_TYPE_ENTRY);
    final String codeLevelReturnType = this.getCodeLevelDataType(dataTypeEntries, returnType);
    final String methodSignature = operationSignature.getEntityName();
    // TODO parameters
    final String parameterString = "*";
    final AssemblyContext assemblyContext = this.assemblyResource.resolve(allocation.getAssemblyContext_AllocationContext());
    final RepositoryComponent repositoryComponent = this.repositoryResource.resolve(assemblyContext.getEncapsulatedComponent__AssemblyContext());
    final List<ComponentEntry> componentEntries = this.correspondenceResource.collectAllObjectsByType(ComponentEntry.class, CorrespondencePackage.Literals.COMPONENT_ENTRY);
    final String codeLevelComponentIdentifier = this.getCodeLevelComponent(componentEntries, repositoryComponent);
    final String completeMethodSignature = modifier + " " + codeLevelReturnType + " " + codeLevelComponentIdentifier + "." + methodSignature + "(" + parameterString + ")";
    this.logger.debug("Constructed method string: {}", completeMethodSignature);
    return completeMethodSignature;
}
Also used : DataTypeEntry(org.iobserve.model.correspondence.DataTypeEntry) ComponentEntry(org.iobserve.model.correspondence.ComponentEntry) PrimitiveDataType(org.palladiosimulator.pcm.repository.PrimitiveDataType) CompositeDataType(org.palladiosimulator.pcm.repository.CompositeDataType) DataType(org.palladiosimulator.pcm.repository.DataType) CollectionDataType(org.palladiosimulator.pcm.repository.CollectionDataType) AssemblyContext(org.palladiosimulator.pcm.core.composition.AssemblyContext) RepositoryComponent(org.palladiosimulator.pcm.repository.RepositoryComponent)

Example 19 with RepositoryComponent

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

the class DataProtectionWarner method addConnectors.

/**
 * Adding connections between components to the privacy graph.
 *
 * @param graph
 *            graph
 * @throws DBException
 *             on db errors during resolving objects
 * @throws InvocationException
 *             on other errors during resolving objects
 */
private void addConnectors(final PrivacyGraph graph) throws InvocationException, DBException {
    for (final Connector connector : this.systemRootElement.getConnectors__ComposedStructure()) {
        if (connector instanceof AssemblyConnector) {
            final AssemblyConnector assemblyConnector = (AssemblyConnector) connector;
            // Providing Component
            final AssemblyContext provididingAssemblyContext = assemblyConnector.getProvidingAssemblyContext_AssemblyConnector();
            final RepositoryComponent providingComponent = this.repositoryResource.resolve(provididingAssemblyContext.getEncapsulatedComponent__AssemblyContext());
            // Requiring Component
            final AssemblyContext requiringAssemblyContext = assemblyConnector.getRequiringAssemblyContext_AssemblyConnector();
            final RepositoryComponent requiringComponent = this.repositoryResource.resolve(requiringAssemblyContext.getEncapsulatedComponent__AssemblyContext());
            if (providingComponent != null && requiringComponent != null) {
                final OperationProvidedRole providedRole = this.repositoryResource.resolve(assemblyConnector.getProvidedRole_AssemblyConnector());
                final String interfaceName = this.shortName(providedRole.getEntityName());
                // Check Interface Name in Repository and add Edge
                final OperationInterface operationInterface = this.interfaces.get(interfaceName);
                this.computePrivacyLevelsAndAddEdge(graph, operationInterface, providingComponent, requiringComponent);
            } else {
                this.logger.info("Either Providing: " + providingComponent + " was Null or Requiring: " + requiringComponent + " was Null.");
            }
        }
    }
}
Also used : AssemblyConnector(org.palladiosimulator.pcm.core.composition.AssemblyConnector) Connector(org.palladiosimulator.pcm.core.composition.Connector) AssemblyConnector(org.palladiosimulator.pcm.core.composition.AssemblyConnector) OperationProvidedRole(org.palladiosimulator.pcm.repository.OperationProvidedRole) AssemblyContext(org.palladiosimulator.pcm.core.composition.AssemblyContext) RepositoryComponent(org.palladiosimulator.pcm.repository.RepositoryComponent) OperationInterface(org.palladiosimulator.pcm.repository.OperationInterface)

Aggregations

RepositoryComponent (org.palladiosimulator.pcm.repository.RepositoryComponent)19 AssemblyContext (org.palladiosimulator.pcm.core.composition.AssemblyContext)10 OperationProvidedRole (org.palladiosimulator.pcm.repository.OperationProvidedRole)9 OperationInterface (org.palladiosimulator.pcm.repository.OperationInterface)7 Interface (org.palladiosimulator.pcm.repository.Interface)6 ProvidedRole (org.palladiosimulator.pcm.repository.ProvidedRole)6 OperationSignature (org.palladiosimulator.pcm.repository.OperationSignature)5 BasicComponent (org.palladiosimulator.pcm.repository.BasicComponent)4 Repository (org.palladiosimulator.pcm.repository.Repository)4 Test (org.junit.Test)3 AllocationContext (org.palladiosimulator.pcm.allocation.AllocationContext)3 HashMap (java.util.HashMap)2 EObject (org.eclipse.emf.ecore.EObject)2 OperationRequiredRole (org.palladiosimulator.pcm.repository.OperationRequiredRole)2 RequiredRole (org.palladiosimulator.pcm.repository.RequiredRole)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 Set (java.util.Set)1 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1