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;
}
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();
}
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;
}
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.");
}
}
}
}
Aggregations