From 07f8f32ee803e964e1203f552f7ee4c7edb96293 Mon Sep 17 00:00:00 2001 From: Michael Lux Date: Wed, 2 Mar 2022 10:49:23 +0100 Subject: [PATCH] Fixed "unknown UC contract" issue for provider push scenario --- .../ids/camel/processors/ContractAgreementReceiverProcessor.kt | 3 +++ .../kotlin/de/fhg/aisec/ids/camel/processors/ProviderDB.kt | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/camel-processors/src/main/kotlin/de/fhg/aisec/ids/camel/processors/ContractAgreementReceiverProcessor.kt b/camel-processors/src/main/kotlin/de/fhg/aisec/ids/camel/processors/ContractAgreementReceiverProcessor.kt index a30099ad6..d525f4fc0 100644 --- a/camel-processors/src/main/kotlin/de/fhg/aisec/ids/camel/processors/ContractAgreementReceiverProcessor.kt +++ b/camel-processors/src/main/kotlin/de/fhg/aisec/ids/camel/processors/ContractAgreementReceiverProcessor.kt @@ -50,6 +50,7 @@ class ContractAgreementReceiverProcessor : Processor { ProviderDB.contractAgreements[contractAgreement.id] = contractAgreement for (permission in contractAgreement.permission) { + // Entry for the case when provider is setting up multiple agreements with different requesting connectors ProviderDB.artifactUrisMapped2ContractAgreements[ Pair( permission.target, @@ -60,6 +61,8 @@ class ContractAgreementReceiverProcessor : Processor { ) ) ] = contractAgreement.id + // Additional entry for the case when an artifact is pushed directly to the consumer + ProviderDB.artifactUrisMapped2ContractAgreements[Pair(permission.target, null)] = contractAgreement.id } if (LOG.isDebugEnabled) { diff --git a/camel-processors/src/main/kotlin/de/fhg/aisec/ids/camel/processors/ProviderDB.kt b/camel-processors/src/main/kotlin/de/fhg/aisec/ids/camel/processors/ProviderDB.kt index 65485f8f1..973a6f516 100644 --- a/camel-processors/src/main/kotlin/de/fhg/aisec/ids/camel/processors/ProviderDB.kt +++ b/camel-processors/src/main/kotlin/de/fhg/aisec/ids/camel/processors/ProviderDB.kt @@ -27,7 +27,7 @@ import java.util.concurrent.ConcurrentHashMap object ProviderDB { val availableArtifactURIs: ConcurrentHashMap = ConcurrentHashMap() val artifactUrisMapped2ContractAgreements: - ConcurrentHashMap, URI> = ConcurrentHashMap() + ConcurrentHashMap, URI> = ConcurrentHashMap() val contractAgreements: ConcurrentHashMap = ConcurrentHashMap() init {