Search in sources :

Example 1 with ComponentEntry

use of org.iobserve.model.correspondence.ComponentEntry in project iobserve-analysis by research-iobserve.

the class EntryEventMapperStage method execute.

@Override
protected void execute(final EntryCallEvent event) throws Exception {
    /**
     * retrieve mapping.
     */
    // TODO correct key names?
    final List<ComponentEntry> entries = this.correspondenceResource.findObjectsByTypeAndProperty(ComponentEntry.class, CorrespondencePackage.Literals.COMPONENT_ENTRY, "implementationId", event.getClassSignature());
    if (!entries.isEmpty()) {
        final ComponentEntry componentEntry = entries.get(0);
        final OperationEntry operationEntry = this.correspondenceResource.findObjectsByTypeAndProperty(OperationEntry.class, CorrespondencePackage.Literals.OPERATION_ENTRY, "implementationId", event.getOperationSignature()).get(0);
        if (operationEntry != null) {
            final AllocationEntry allocationEntry = this.correspondenceResource.findObjectsByTypeAndProperty(AllocationEntry.class, CorrespondencePackage.Literals.ALLOCATION_ENTRY, "implementationId", event.getHostname()).get(0);
            if (allocationEntry != null) {
                this.computePcmEntryCallEvent(componentEntry, operationEntry, allocationEntry, event);
            } else {
                this.logger.debug("No corresponding allocation for entry call {}", event.toString());
            }
        } else {
            this.logger.debug("No corresponding component for entry call {}", event.toString());
        }
    } else {
        this.logger.debug("No corresponding component for entry call {}", event.toString());
    }
}
Also used : AllocationEntry(org.iobserve.model.correspondence.AllocationEntry) ComponentEntry(org.iobserve.model.correspondence.ComponentEntry) OperationEntry(org.iobserve.model.correspondence.OperationEntry)

Example 2 with ComponentEntry

use of org.iobserve.model.correspondence.ComponentEntry 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)

Aggregations

ComponentEntry (org.iobserve.model.correspondence.ComponentEntry)2 AllocationEntry (org.iobserve.model.correspondence.AllocationEntry)1 DataTypeEntry (org.iobserve.model.correspondence.DataTypeEntry)1 OperationEntry (org.iobserve.model.correspondence.OperationEntry)1 AssemblyContext (org.palladiosimulator.pcm.core.composition.AssemblyContext)1 CollectionDataType (org.palladiosimulator.pcm.repository.CollectionDataType)1 CompositeDataType (org.palladiosimulator.pcm.repository.CompositeDataType)1 DataType (org.palladiosimulator.pcm.repository.DataType)1 PrimitiveDataType (org.palladiosimulator.pcm.repository.PrimitiveDataType)1 RepositoryComponent (org.palladiosimulator.pcm.repository.RepositoryComponent)1