diff --git a/data-protocols/dsp/dsp-spi/src/main/java/org/eclipse/edc/protocol/dsp/spi/type/DspTransferProcessPropertyAndTypeNames.java b/data-protocols/dsp/dsp-spi/src/main/java/org/eclipse/edc/protocol/dsp/spi/type/DspTransferProcessPropertyAndTypeNames.java index e16a257fc65..af0cb6fd35f 100644 --- a/data-protocols/dsp/dsp-spi/src/main/java/org/eclipse/edc/protocol/dsp/spi/type/DspTransferProcessPropertyAndTypeNames.java +++ b/data-protocols/dsp/dsp-spi/src/main/java/org/eclipse/edc/protocol/dsp/spi/type/DspTransferProcessPropertyAndTypeNames.java @@ -27,12 +27,16 @@ public interface DspTransferProcessPropertyAndTypeNames { String DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI = DSPACE_SCHEMA + DSPACE_TYPE_TRANSFER_START_MESSAGE_TERM; String DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_TERM = "TransferCompletionMessage"; String DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI = DSPACE_SCHEMA + DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_TERM; - String DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE = DSPACE_SCHEMA + "TransferSuspensionMessage"; + String DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE_TERM = "TransferSuspensionMessage"; + String DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE_IRI = DSPACE_SCHEMA + DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE_TERM; String DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_TERM = "TransferTerminationMessage"; String DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI = DSPACE_SCHEMA + DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_TERM; - String DSPACE_TYPE_TRANSFER_PROCESS = DSPACE_SCHEMA + "TransferProcess"; - String DSPACE_TYPE_TRANSFER_ERROR = DSPACE_SCHEMA + "TransferError"; - - String DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID = DSPACE_SCHEMA + "agreementId"; - String DSPACE_PROPERTY_DATA_ADDRESS = DSPACE_SCHEMA + "dataAddress"; + String DSPACE_TYPE_TRANSFER_PROCESS_TERM = "TransferProcess"; + String DSPACE_TYPE_TRANSFER_PROCESS_IRI = DSPACE_SCHEMA + DSPACE_TYPE_TRANSFER_PROCESS_TERM; + String DSPACE_TYPE_TRANSFER_ERROR_TERM = "TransferError"; + String DSPACE_TYPE_TRANSFER_ERROR_IRI = DSPACE_SCHEMA + DSPACE_TYPE_TRANSFER_ERROR_TERM; + String DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID_TERM = DSPACE_SCHEMA + "agreementId"; + String DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID_IRI = DSPACE_SCHEMA + DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID_TERM; + String DSPACE_PROPERTY_DATA_ADDRESS_TERM = "dataAddress"; + String DSPACE_PROPERTY_DATA_ADDRESS_IRI = DSPACE_SCHEMA + DSPACE_PROPERTY_DATA_ADDRESS_TERM; } diff --git a/data-protocols/dsp/dsp-transfer-process/build.gradle.kts b/data-protocols/dsp/dsp-transfer-process/build.gradle.kts index dca105cc8f3..a4899db98f4 100644 --- a/data-protocols/dsp/dsp-transfer-process/build.gradle.kts +++ b/data-protocols/dsp/dsp-transfer-process/build.gradle.kts @@ -22,4 +22,5 @@ dependencies { api(project(":data-protocols:dsp:dsp-transfer-process:dsp-transfer-process-http-dispatcher")) api(project(":data-protocols:dsp:dsp-transfer-process:dsp-transfer-process-transform")) api(project(":data-protocols:dsp:dsp-transfer-process:lib:dsp-transfer-process-validation-lib")) + api(project(":data-protocols:dsp:dsp-transfer-process:lib:dsp-transfer-process-transform-lib")) } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/controller/DspTransferProcessApiController.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/controller/DspTransferProcessApiController.java index 832b0cc53f5..fc6c0b0e91c 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/controller/DspTransferProcessApiController.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/controller/DspTransferProcessApiController.java @@ -41,7 +41,7 @@ import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.transferprocess.http.api.TransferProcessApiPaths.BASE_PATH; import static org.eclipse.edc.protocol.dsp.transferprocess.http.api.TransferProcessApiPaths.TRANSFER_COMPLETION; @@ -200,7 +200,7 @@ public Response transferProcessTermination(@PathParam("id") String id, JsonObjec public Response transferProcessSuspension(@PathParam("id") String id, JsonObject jsonObject, @HeaderParam(AUTHORIZATION) String token) { var request = PostDspRequest.Builder.newInstance(TransferSuspensionMessage.class, TransferProcess.class, TransferError.class) .processId(id) - .expectedMessageType(DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE) + .expectedMessageType(DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE_IRI) .message(jsonObject) .token(token) .serviceCall(protocolService::notifySuspended) diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/controller/DspTransferProcessApiControllerTest.java b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/controller/DspTransferProcessApiControllerTest.java index 00cea4a6941..5dd71432e3f 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/controller/DspTransferProcessApiControllerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-http-api/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/http/api/controller/DspTransferProcessApiControllerTest.java @@ -49,7 +49,7 @@ import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.transferprocess.http.api.TransferProcessApiPaths.BASE_PATH; import static org.eclipse.edc.protocol.dsp.transferprocess.http.api.TransferProcessApiPaths.TRANSFER_COMPLETION; @@ -171,7 +171,7 @@ public Stream provideArguments(ExtensionContext context) { Arguments.of( BASE_PATH + PROCESS_ID + TRANSFER_SUSPENSION, TransferSuspensionMessage.class, - DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE), + DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE_IRI), Arguments.of( BASE_PATH + PROCESS_ID + TRANSFER_TERMINATION, TransferTerminationMessage.class, diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/build.gradle.kts b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/build.gradle.kts index 01e7e4d01ad..be08c843bc3 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/build.gradle.kts +++ b/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/build.gradle.kts @@ -23,6 +23,7 @@ dependencies { api(project(":data-protocols:dsp:dsp-spi")) api(project(":data-protocols:dsp:dsp-http-spi")) implementation(project(":core:common:lib:transform-lib")) + implementation(project(":data-protocols:dsp:dsp-transfer-process:lib:dsp-transfer-process-transform-lib")) testImplementation(project(":core:common:lib:json-ld-lib")) testImplementation(project(":core:common:junit")) diff --git a/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/build.gradle.kts b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/build.gradle.kts new file mode 100644 index 00000000000..f1425d0e0ca --- /dev/null +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/build.gradle.kts @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0 + * + * SPDX-License-Identifier: Apache-2.0 + * + * Contributors: + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation + * + */ + +plugins { + `java-library` +} + +dependencies { + api(project(":spi:common:json-ld-spi")) + api(project(":data-protocols:dsp:dsp-spi")) + api(project(":spi:control-plane:transfer-spi")) + implementation(project(":core:common:lib:transform-lib")) + + testImplementation(project(":core:common:junit")) + testImplementation(project(":extensions:common:json-ld")) + testImplementation(project(":core:common:lib:json-ld-lib")) + +} \ No newline at end of file diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferCompletionMessageTransformer.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferCompletionMessageTransformer.java similarity index 66% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferCompletionMessageTransformer.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferCompletionMessageTransformer.java index df08d226778..e0c7efbd390 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferCompletionMessageTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferCompletionMessageTransformer.java @@ -17,24 +17,29 @@ import jakarta.json.JsonBuilderFactory; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.transfer.spi.types.protocol.TransferCompletionMessage; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_TERM; -public class JsonObjectFromTransferCompletionMessageTransformer extends AbstractJsonLdTransformer { +public class JsonObjectFromTransferCompletionMessageTransformer extends AbstractNamespaceAwareJsonLdTransformer { private final JsonBuilderFactory jsonBuilderFactory; public JsonObjectFromTransferCompletionMessageTransformer(JsonBuilderFactory jsonBuilderFactory) { - super(TransferCompletionMessage.class, JsonObject.class); + this(jsonBuilderFactory, DSPACE_SCHEMA); + } + + public JsonObjectFromTransferCompletionMessageTransformer(JsonBuilderFactory jsonBuilderFactory, String namespace) { + super(TransferCompletionMessage.class, JsonObject.class, namespace); this.jsonBuilderFactory = jsonBuilderFactory; } @@ -42,9 +47,9 @@ public JsonObjectFromTransferCompletionMessageTransformer(JsonBuilderFactory jso public @Nullable JsonObject transform(@NotNull TransferCompletionMessage transferCompletionMessage, @NotNull TransformerContext context) { return jsonBuilderFactory.createObjectBuilder() .add(ID, transferCompletionMessage.getId()) - .add(TYPE, DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, transferCompletionMessage.getConsumerPid()) - .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, transferCompletionMessage.getProviderPid()) + .add(TYPE, forNamespace(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_TERM)) + .add(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM), transferCompletionMessage.getConsumerPid()) + .add(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM), transferCompletionMessage.getProviderPid()) .build(); } } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferErrorTransformer.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferErrorTransformer.java similarity index 65% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferErrorTransformer.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferErrorTransformer.java index 59f13ef704a..7d97a5feb67 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferErrorTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferErrorTransformer.java @@ -17,34 +17,39 @@ import jakarta.json.JsonBuilderFactory; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.transfer.spi.types.protocol.TransferError; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_ERROR; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_ERROR_TERM; /** * Transforms a {@link TransferError} to a {@link JsonObject} in JSON-LD expanded form. */ -public class JsonObjectFromTransferErrorTransformer extends AbstractJsonLdTransformer { +public class JsonObjectFromTransferErrorTransformer extends AbstractNamespaceAwareJsonLdTransformer { private final JsonBuilderFactory jsonFactory; public JsonObjectFromTransferErrorTransformer(JsonBuilderFactory jsonFactory) { - super(TransferError.class, JsonObject.class); + this(jsonFactory, DSPACE_SCHEMA); + } + + public JsonObjectFromTransferErrorTransformer(JsonBuilderFactory jsonFactory, String namespace) { + super(TransferError.class, JsonObject.class, namespace); this.jsonFactory = jsonFactory; } @Override public @Nullable JsonObject transform(@NotNull TransferError error, @NotNull TransformerContext context) { return jsonFactory.createObjectBuilder() - .add(TYPE, DSPACE_TYPE_TRANSFER_ERROR) - .add(DSPACE_PROPERTY_CODE_IRI, error.getCode()) - .add(DSPACE_PROPERTY_REASON_IRI, jsonFactory.createArrayBuilder(error.getMessages())) + .add(TYPE, forNamespace(DSPACE_TYPE_TRANSFER_ERROR_TERM)) + .add(forNamespace(DSPACE_PROPERTY_CODE_TERM), error.getCode()) + .add(forNamespace(DSPACE_PROPERTY_REASON_TERM), jsonFactory.createArrayBuilder(error.getMessages())) .build(); } } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferProcessTransformer.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferProcessTransformer.java similarity index 60% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferProcessTransformer.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferProcessTransformer.java index a19b46dc604..57ce2697b8d 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferProcessTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferProcessTransformer.java @@ -18,24 +18,29 @@ import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.transfer.spi.types.TransferProcess; import org.eclipse.edc.connector.controlplane.transfer.spi.types.TransferProcessStates; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_PROCESS; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_PROCESS_TERM; -public class JsonObjectFromTransferProcessTransformer extends AbstractJsonLdTransformer { +public class JsonObjectFromTransferProcessTransformer extends AbstractNamespaceAwareJsonLdTransformer { private final JsonBuilderFactory jsonBuilderFactory; public JsonObjectFromTransferProcessTransformer(JsonBuilderFactory jsonBuilderFactory) { - super(TransferProcess.class, JsonObject.class); + this(jsonBuilderFactory, DSPACE_SCHEMA); + } + + public JsonObjectFromTransferProcessTransformer(JsonBuilderFactory jsonBuilderFactory, String namespace) { + super(TransferProcess.class, JsonObject.class, namespace); this.jsonBuilderFactory = jsonBuilderFactory; } @@ -43,15 +48,15 @@ public JsonObjectFromTransferProcessTransformer(JsonBuilderFactory jsonBuilderFa public @Nullable JsonObject transform(@NotNull TransferProcess transferProcess, @NotNull TransformerContext context) { var builder = jsonBuilderFactory.createObjectBuilder() .add(ID, transferProcess.getId()) - .add(TYPE, DSPACE_TYPE_TRANSFER_PROCESS) - .add(DSPACE_PROPERTY_STATE_IRI, TransferProcessStates.from(transferProcess.getState()).name()); + .add(TYPE, forNamespace(DSPACE_TYPE_TRANSFER_PROCESS_TERM)) + .add(forNamespace(DSPACE_PROPERTY_STATE_TERM), TransferProcessStates.from(transferProcess.getState()).name()); if (transferProcess.getType() == TransferProcess.Type.PROVIDER) { - builder.add(DSPACE_PROPERTY_PROVIDER_PID_IRI, transferProcess.getId()); - addIfNotNull(transferProcess.getCorrelationId(), DSPACE_PROPERTY_CONSUMER_PID_IRI, builder); + builder.add(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM), transferProcess.getId()); + addIfNotNull(transferProcess.getCorrelationId(), forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM), builder); } else { - builder.add(DSPACE_PROPERTY_CONSUMER_PID_IRI, transferProcess.getId()); - addIfNotNull(transferProcess.getCorrelationId(), DSPACE_PROPERTY_PROVIDER_PID_IRI, builder); + builder.add(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM), transferProcess.getId()); + addIfNotNull(transferProcess.getCorrelationId(), forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM), builder); } return builder.build(); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferRequestMessageTransformer.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferRequestMessageTransformer.java similarity index 66% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferRequestMessageTransformer.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferRequestMessageTransformer.java index 8c63e7c96b5..24c94c70054 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferRequestMessageTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferRequestMessageTransformer.java @@ -17,7 +17,7 @@ import jakarta.json.JsonBuilderFactory; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.transfer.spi.types.protocol.TransferRequestMessage; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -26,20 +26,25 @@ import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCT_FORMAT_ATTRIBUTE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_TERM; -public class JsonObjectFromTransferRequestMessageTransformer extends AbstractJsonLdTransformer { +public class JsonObjectFromTransferRequestMessageTransformer extends AbstractNamespaceAwareJsonLdTransformer { private final JsonBuilderFactory jsonBuilderFactory; public JsonObjectFromTransferRequestMessageTransformer(JsonBuilderFactory jsonBuilderFactory) { - super(TransferRequestMessage.class, JsonObject.class); + this(jsonBuilderFactory, DSPACE_SCHEMA); + } + + public JsonObjectFromTransferRequestMessageTransformer(JsonBuilderFactory jsonBuilderFactory, String namespace) { + super(TransferRequestMessage.class, JsonObject.class, namespace); this.jsonBuilderFactory = jsonBuilderFactory; } @@ -50,14 +55,14 @@ public JsonObjectFromTransferRequestMessageTransformer(JsonBuilderFactory jsonBu var builder = jsonBuilderFactory.createObjectBuilder() .add(ID, transferRequestMessage.getId()) - .add(TYPE, DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID, transferRequestMessage.getContractId()) + .add(TYPE, forNamespace(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_TERM)) + .add(forNamespace(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID_TERM), transferRequestMessage.getContractId()) .add(DCT_FORMAT_ATTRIBUTE, format) - .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, transferRequestMessage.getCallbackAddress()) - .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, transferRequestMessage.getConsumerPid()); + .add(forNamespace(DSPACE_PROPERTY_CALLBACK_ADDRESS_TERM), transferRequestMessage.getCallbackAddress()) + .add(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM), transferRequestMessage.getConsumerPid()); if (transferRequestMessage.getDataDestination() != null && transferRequestMessage.getDataDestination().getProperties().size() > 1) { - builder.add(DSPACE_PROPERTY_DATA_ADDRESS, context.transform(transferRequestMessage.getDataDestination(), JsonObject.class)); + builder.add(forNamespace(DSPACE_PROPERTY_DATA_ADDRESS_TERM), context.transform(transferRequestMessage.getDataDestination(), JsonObject.class)); } return builder.build(); } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferStartMessageTransformer.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferStartMessageTransformer.java similarity index 61% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferStartMessageTransformer.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferStartMessageTransformer.java index bad8a8e3c9b..68d102d7cb5 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferStartMessageTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferStartMessageTransformer.java @@ -17,24 +17,29 @@ import jakarta.json.JsonBuilderFactory; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.transfer.spi.types.protocol.TransferStartMessage; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE_TERM; -public class JsonObjectFromTransferStartMessageTransformer extends AbstractJsonLdTransformer { +public class JsonObjectFromTransferStartMessageTransformer extends AbstractNamespaceAwareJsonLdTransformer { private final JsonBuilderFactory jsonBuilderFactory; public JsonObjectFromTransferStartMessageTransformer(JsonBuilderFactory jsonBuilderFactory) { - super(TransferStartMessage.class, JsonObject.class); + this(jsonBuilderFactory, DSPACE_SCHEMA); + } + + public JsonObjectFromTransferStartMessageTransformer(JsonBuilderFactory jsonBuilderFactory, String namespace) { + super(TransferStartMessage.class, JsonObject.class, namespace); this.jsonBuilderFactory = jsonBuilderFactory; } @@ -42,12 +47,12 @@ public JsonObjectFromTransferStartMessageTransformer(JsonBuilderFactory jsonBuil public @Nullable JsonObject transform(@NotNull TransferStartMessage transferStartMessage, @NotNull TransformerContext context) { var builder = jsonBuilderFactory.createObjectBuilder() .add(ID, transferStartMessage.getId()) - .add(TYPE, DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI) - .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, transferStartMessage.getProviderPid()) - .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, transferStartMessage.getConsumerPid()); + .add(TYPE, forNamespace(DSPACE_TYPE_TRANSFER_START_MESSAGE_TERM)) + .add(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM), transferStartMessage.getProviderPid()) + .add(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM), transferStartMessage.getConsumerPid()); if (transferStartMessage.getDataAddress() != null) { - builder.add(DSPACE_PROPERTY_DATA_ADDRESS, context.transform(transferStartMessage.getDataAddress(), JsonObject.class)); + builder.add(forNamespace(DSPACE_PROPERTY_DATA_ADDRESS_TERM), context.transform(transferStartMessage.getDataAddress(), JsonObject.class)); } return builder.build(); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferSuspensionMessageTransformer.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferSuspensionMessageTransformer.java similarity index 61% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferSuspensionMessageTransformer.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferSuspensionMessageTransformer.java index 81d9848dee9..f63e81fb9a4 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferSuspensionMessageTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferSuspensionMessageTransformer.java @@ -17,25 +17,30 @@ import jakarta.json.JsonBuilderFactory; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.transfer.spi.types.protocol.TransferSuspensionMessage; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE_TERM; -public class JsonObjectFromTransferSuspensionMessageTransformer extends AbstractJsonLdTransformer { +public class JsonObjectFromTransferSuspensionMessageTransformer extends AbstractNamespaceAwareJsonLdTransformer { private final JsonBuilderFactory jsonBuilderFactory; public JsonObjectFromTransferSuspensionMessageTransformer(JsonBuilderFactory jsonBuilderFactory) { - super(TransferSuspensionMessage.class, JsonObject.class); + this(jsonBuilderFactory, DSPACE_SCHEMA); + } + + public JsonObjectFromTransferSuspensionMessageTransformer(JsonBuilderFactory jsonBuilderFactory, String namespace) { + super(TransferSuspensionMessage.class, JsonObject.class, namespace); this.jsonBuilderFactory = jsonBuilderFactory; } @@ -43,12 +48,12 @@ public JsonObjectFromTransferSuspensionMessageTransformer(JsonBuilderFactory jso public @Nullable JsonObject transform(@NotNull TransferSuspensionMessage message, @NotNull TransformerContext context) { var builder = jsonBuilderFactory.createObjectBuilder() .add(ID, message.getId()) - .add(TYPE, DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE) - .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, message.getConsumerPid()) - .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, message.getProviderPid()) - .add(DSPACE_PROPERTY_REASON_IRI, jsonBuilderFactory.createArrayBuilder(message.getReason())); + .add(TYPE, forNamespace(DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE_TERM)) + .add(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM), message.getConsumerPid()) + .add(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM), message.getProviderPid()) + .add(forNamespace(DSPACE_PROPERTY_REASON_TERM), jsonBuilderFactory.createArrayBuilder(message.getReason())); - addIfNotNull(message.getCode(), DSPACE_PROPERTY_CODE_IRI, builder); + addIfNotNull(message.getCode(), forNamespace(DSPACE_PROPERTY_CODE_TERM), builder); return builder.build(); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferTerminationMessageTransformer.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferTerminationMessageTransformer.java similarity index 63% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferTerminationMessageTransformer.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferTerminationMessageTransformer.java index 8a2fbdf8c3a..2731d0a0ba2 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferTerminationMessageTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/from/JsonObjectFromTransferTerminationMessageTransformer.java @@ -17,25 +17,30 @@ import jakarta.json.JsonBuilderFactory; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.transfer.spi.types.protocol.TransferTerminationMessage; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.ID; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_TERM; -public class JsonObjectFromTransferTerminationMessageTransformer extends AbstractJsonLdTransformer { +public class JsonObjectFromTransferTerminationMessageTransformer extends AbstractNamespaceAwareJsonLdTransformer { private final JsonBuilderFactory jsonBuilderFactory; public JsonObjectFromTransferTerminationMessageTransformer(JsonBuilderFactory jsonBuilderFactory) { - super(TransferTerminationMessage.class, JsonObject.class); + this(jsonBuilderFactory, DSPACE_SCHEMA); + } + + public JsonObjectFromTransferTerminationMessageTransformer(JsonBuilderFactory jsonBuilderFactory, String namespace) { + super(TransferTerminationMessage.class, JsonObject.class, namespace); this.jsonBuilderFactory = jsonBuilderFactory; } @@ -43,12 +48,12 @@ public JsonObjectFromTransferTerminationMessageTransformer(JsonBuilderFactory js public @Nullable JsonObject transform(@NotNull TransferTerminationMessage transferTerminationMessage, @NotNull TransformerContext context) { var builder = jsonBuilderFactory.createObjectBuilder() .add(ID, transferTerminationMessage.getId()) - .add(TYPE, DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, transferTerminationMessage.getConsumerPid()) - .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, transferTerminationMessage.getProviderPid()); + .add(TYPE, forNamespace(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_TERM)) + .add(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM), transferTerminationMessage.getConsumerPid()) + .add(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM), transferTerminationMessage.getProviderPid()); - addIfNotNull(transferTerminationMessage.getCode(), DSPACE_PROPERTY_CODE_IRI, builder); - addIfNotNull(transferTerminationMessage.getReason(), DSPACE_PROPERTY_REASON_IRI, builder); + addIfNotNull(transferTerminationMessage.getCode(), forNamespace(DSPACE_PROPERTY_CODE_TERM), builder); + addIfNotNull(transferTerminationMessage.getReason(), forNamespace(DSPACE_PROPERTY_REASON_TERM), builder); return builder.build(); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferCompletionMessageTransformer.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferCompletionMessageTransformer.java similarity index 60% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferCompletionMessageTransformer.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferCompletionMessageTransformer.java index 17320b06cec..748e1cbe9b7 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferCompletionMessageTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferCompletionMessageTransformer.java @@ -16,39 +16,44 @@ import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.transfer.spi.types.protocol.TransferCompletionMessage; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_TERM; -public class JsonObjectToTransferCompletionMessageTransformer extends AbstractJsonLdTransformer { +public class JsonObjectToTransferCompletionMessageTransformer extends AbstractNamespaceAwareJsonLdTransformer { public JsonObjectToTransferCompletionMessageTransformer() { - super(JsonObject.class, TransferCompletionMessage.class); + this(DSPACE_SCHEMA); + } + + public JsonObjectToTransferCompletionMessageTransformer(String namespace) { + super(JsonObject.class, TransferCompletionMessage.class, namespace); } @Override public @Nullable TransferCompletionMessage transform(@NotNull JsonObject messageObject, @NotNull TransformerContext context) { var builder = TransferCompletionMessage.Builder.newInstance(); - if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_CONSUMER_PID_IRI), builder::consumerPid, context)) { + if (!transformMandatoryString(messageObject.get(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM)), builder::consumerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI) - .property(DSPACE_PROPERTY_CONSUMER_PID_IRI) + .type(forNamespace(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM)) .report(); return null; } - if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_PROVIDER_PID_IRI), builder::providerPid, context)) { + if (!transformMandatoryString(messageObject.get(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM)), builder::providerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_IRI) - .property(DSPACE_PROPERTY_PROVIDER_PID_IRI) + .type(forNamespace(DSPACE_TYPE_TRANSFER_COMPLETION_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM)) .report(); return null; } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferProcessAckTransformer.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferProcessAckTransformer.java similarity index 61% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferProcessAckTransformer.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferProcessAckTransformer.java index a298db46703..def7023f1bd 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferProcessAckTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferProcessAckTransformer.java @@ -16,32 +16,37 @@ import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.transfer.spi.types.protocol.TransferProcessAck; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE_IRI; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE_TERM; /** * Create a {@link TransferProcessAck} from {@link JsonObject} */ -public class JsonObjectToTransferProcessAckTransformer extends AbstractJsonLdTransformer { +public class JsonObjectToTransferProcessAckTransformer extends AbstractNamespaceAwareJsonLdTransformer { public JsonObjectToTransferProcessAckTransformer() { - super(JsonObject.class, TransferProcessAck.class); + this(DSPACE_SCHEMA); + } + + public JsonObjectToTransferProcessAckTransformer(String namespace) { + super(JsonObject.class, TransferProcessAck.class, namespace); } @Override public @Nullable TransferProcessAck transform(@NotNull JsonObject jsonObject, @NotNull TransformerContext context) { var builder = TransferProcessAck.Builder.newInstance(); - transformMandatoryString(jsonObject.get(DSPACE_PROPERTY_CONSUMER_PID_IRI), builder::consumerPid, context); - transformMandatoryString(jsonObject.get(DSPACE_PROPERTY_PROVIDER_PID_IRI), builder::providerPid, context); + transformMandatoryString(jsonObject.get(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM)), builder::consumerPid, context); + transformMandatoryString(jsonObject.get(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM)), builder::providerPid, context); return builder - .state(transformString(jsonObject.get(DSPACE_PROPERTY_STATE_IRI), context)) + .state(transformString(jsonObject.get(forNamespace(DSPACE_PROPERTY_STATE_TERM)), context)) .build(); } } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferRequestMessageTransformer.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferRequestMessageTransformer.java similarity index 55% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferRequestMessageTransformer.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferRequestMessageTransformer.java index 42db4fd0ec1..e32f238beec 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferRequestMessageTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferRequestMessageTransformer.java @@ -16,46 +16,52 @@ import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.transfer.spi.types.protocol.TransferRequestMessage; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.spi.types.domain.DataAddress; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCT_FORMAT_ATTRIBUTE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_TERM; -public class JsonObjectToTransferRequestMessageTransformer extends AbstractJsonLdTransformer { +public class JsonObjectToTransferRequestMessageTransformer extends AbstractNamespaceAwareJsonLdTransformer { public JsonObjectToTransferRequestMessageTransformer() { - super(JsonObject.class, TransferRequestMessage.class); + this(DSPACE_SCHEMA); + } + + public JsonObjectToTransferRequestMessageTransformer(String namespace) { + super(JsonObject.class, TransferRequestMessage.class, namespace); } @Override public @Nullable TransferRequestMessage transform(@NotNull JsonObject messageObject, @NotNull TransformerContext context) { var builder = TransferRequestMessage.Builder.newInstance(); - if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_CONSUMER_PID_IRI), builder::consumerPid, context)) { + if (!transformMandatoryString(messageObject.get(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM)), builder::consumerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI) - .property(DSPACE_PROPERTY_CONSUMER_PID_IRI) + .type(forNamespace(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM)) .report(); return null; } - visitProperties(messageObject, k -> switch (k) { - case DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID -> v -> builder.contractId(transformString(v, context)); - case DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI -> v -> builder.callbackAddress(transformString(v, context)); - case DSPACE_PROPERTY_DATA_ADDRESS -> - v -> builder.dataDestination(transformObject(v, DataAddress.class, context)); - case DCT_FORMAT_ATTRIBUTE -> v -> builder.transferType(transformString(v, context)); - default -> doNothing(); - }); + transformString(messageObject.get(forNamespace(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID_TERM)), builder::contractId, context); + transformString(messageObject.get(forNamespace(DSPACE_PROPERTY_CALLBACK_ADDRESS_TERM)), builder::callbackAddress, context); + + var dataAddressObject = messageObject.get(forNamespace(DSPACE_PROPERTY_DATA_ADDRESS_TERM)); + if (dataAddressObject != null) { + builder.dataDestination(transformObject(dataAddressObject, DataAddress.class, context)); + } + + transformString(messageObject.get(DCT_FORMAT_ATTRIBUTE), builder::transferType, context); return builder.build(); } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferStartMessageTransformer.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferStartMessageTransformer.java similarity index 59% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferStartMessageTransformer.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferStartMessageTransformer.java index 60d76b65215..26bfbd6f5e1 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferStartMessageTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferStartMessageTransformer.java @@ -16,46 +16,51 @@ import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.transfer.spi.types.protocol.TransferStartMessage; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.spi.types.domain.DataAddress; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE_TERM; -public class JsonObjectToTransferStartMessageTransformer extends AbstractJsonLdTransformer { +public class JsonObjectToTransferStartMessageTransformer extends AbstractNamespaceAwareJsonLdTransformer { public JsonObjectToTransferStartMessageTransformer() { - super(JsonObject.class, TransferStartMessage.class); + this(DSPACE_SCHEMA); + } + + public JsonObjectToTransferStartMessageTransformer(String namespace) { + super(JsonObject.class, TransferStartMessage.class, namespace); } @Override public @Nullable TransferStartMessage transform(@NotNull JsonObject messageObject, @NotNull TransformerContext context) { var builder = TransferStartMessage.Builder.newInstance(); - if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_CONSUMER_PID_IRI), builder::consumerPid, context)) { + if (!transformMandatoryString(messageObject.get(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM)), builder::consumerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI) - .property(DSPACE_PROPERTY_CONSUMER_PID_IRI) + .type(forNamespace(DSPACE_TYPE_TRANSFER_START_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM)) .report(); return null; } - if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_PROVIDER_PID_IRI), builder::providerPid, context)) { + if (!transformMandatoryString(messageObject.get(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM)), builder::providerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI) - .property(DSPACE_PROPERTY_PROVIDER_PID_IRI) + .type(forNamespace(DSPACE_TYPE_TRANSFER_START_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM)) .report(); return null; } - var dataAddressObject = returnJsonObject(messageObject.get(DSPACE_PROPERTY_DATA_ADDRESS), context, DSPACE_PROPERTY_DATA_ADDRESS, false); + var dataAddressObject = returnJsonObject(messageObject.get(forNamespace(DSPACE_PROPERTY_DATA_ADDRESS_TERM)), context, forNamespace(DSPACE_PROPERTY_DATA_ADDRESS_TERM), false); if (dataAddressObject != null) { builder.dataAddress(context.transform(dataAddressObject, DataAddress.class)); } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferSuspensionMessageTransformer.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferSuspensionMessageTransformer.java similarity index 64% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferSuspensionMessageTransformer.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferSuspensionMessageTransformer.java index 714706bbb23..24338c42d86 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferSuspensionMessageTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferSuspensionMessageTransformer.java @@ -20,7 +20,7 @@ import jakarta.json.JsonObject; import jakarta.json.JsonValue; import org.eclipse.edc.connector.controlplane.transfer.spi.types.protocol.TransferSuspensionMessage; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.spi.EdcException; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; @@ -29,57 +29,63 @@ import java.util.Map; import static jakarta.json.JsonValue.ValueType.ARRAY; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_TERM; -public class JsonObjectToTransferSuspensionMessageTransformer extends AbstractJsonLdTransformer { +public class JsonObjectToTransferSuspensionMessageTransformer extends AbstractNamespaceAwareJsonLdTransformer { private final ObjectMapper objectMapper; public JsonObjectToTransferSuspensionMessageTransformer(ObjectMapper objectMapper) { - super(JsonObject.class, TransferSuspensionMessage.class); + this(objectMapper, DSPACE_SCHEMA); + } + + public JsonObjectToTransferSuspensionMessageTransformer(ObjectMapper objectMapper, String namespace) { + super(JsonObject.class, TransferSuspensionMessage.class, namespace); this.objectMapper = objectMapper; } + @Override public @Nullable TransferSuspensionMessage transform(@NotNull JsonObject messageObject, @NotNull TransformerContext context) { var builder = TransferSuspensionMessage.Builder.newInstance(); - if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_CONSUMER_PID_IRI), builder::consumerPid, context)) { + if (!transformMandatoryString(messageObject.get(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM)), builder::consumerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE) - .property(DSPACE_PROPERTY_CONSUMER_PID_IRI) + .type(forNamespace(DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM)) .report(); return null; } - if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_PROVIDER_PID_IRI), builder::providerPid, context)) { + if (!transformMandatoryString(messageObject.get(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM)), builder::providerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE) - .property(DSPACE_PROPERTY_PROVIDER_PID_IRI) + .type(forNamespace(DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM)) .report(); return null; } - if (messageObject.containsKey(DSPACE_PROPERTY_CODE_IRI)) { - transformString(messageObject.get(DSPACE_PROPERTY_CODE_IRI), builder::code, context); + if (messageObject.containsKey(forNamespace(DSPACE_PROPERTY_CODE_TERM))) { + transformString(messageObject.get(forNamespace(DSPACE_PROPERTY_CODE_TERM)), builder::code, context); } - var reasons = messageObject.get(DSPACE_PROPERTY_REASON_IRI); + var reasons = messageObject.get(forNamespace(DSPACE_PROPERTY_REASON_TERM)); if (reasons != null) { if (reasons instanceof JsonArray array && !array.isEmpty()) { builder.reason(array.stream().map(this::deserialize).toList()); } else { context.problem() .unexpectedType() - .type(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI) - .property(DSPACE_PROPERTY_REASON_IRI) + .type(forNamespace(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_REASON_TERM)) .actual(reasons.getValueType()) .expected(ARRAY) .report(); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferTerminationMessageTransformer.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferTerminationMessageTransformer.java similarity index 61% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferTerminationMessageTransformer.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferTerminationMessageTransformer.java index f54170f1ad5..86c24bc2916 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferTerminationMessageTransformer.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/main/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/type/to/JsonObjectToTransferTerminationMessageTransformer.java @@ -17,57 +17,62 @@ import jakarta.json.JsonArray; import jakarta.json.JsonObject; import org.eclipse.edc.connector.controlplane.transfer.spi.types.protocol.TransferTerminationMessage; -import org.eclipse.edc.jsonld.spi.transformer.AbstractJsonLdTransformer; +import org.eclipse.edc.jsonld.spi.transformer.AbstractNamespaceAwareJsonLdTransformer; import org.eclipse.edc.transform.spi.TransformerContext; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import static jakarta.json.JsonValue.ValueType.ARRAY; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI; +import static org.eclipse.edc.jsonld.spi.Namespaces.DSPACE_SCHEMA; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_TERM; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_TERM; -public class JsonObjectToTransferTerminationMessageTransformer extends AbstractJsonLdTransformer { +public class JsonObjectToTransferTerminationMessageTransformer extends AbstractNamespaceAwareJsonLdTransformer { public JsonObjectToTransferTerminationMessageTransformer() { - super(JsonObject.class, TransferTerminationMessage.class); + this(DSPACE_SCHEMA); + } + + public JsonObjectToTransferTerminationMessageTransformer(String namespace) { + super(JsonObject.class, TransferTerminationMessage.class, namespace); } @Override public @Nullable TransferTerminationMessage transform(@NotNull JsonObject messageObject, @NotNull TransformerContext context) { var builder = TransferTerminationMessage.Builder.newInstance(); - if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_CONSUMER_PID_IRI), builder::consumerPid, context)) { + if (!transformMandatoryString(messageObject.get(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM)), builder::consumerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI) - .property(DSPACE_PROPERTY_CONSUMER_PID_IRI) + .type(forNamespace(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_CONSUMER_PID_TERM)) .report(); return null; } - if (!transformMandatoryString(messageObject.get(DSPACE_PROPERTY_PROVIDER_PID_IRI), builder::providerPid, context)) { + if (!transformMandatoryString(messageObject.get(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM)), builder::providerPid, context)) { context.problem() .missingProperty() - .type(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI) - .property(DSPACE_PROPERTY_PROVIDER_PID_IRI) + .type(forNamespace(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_PROVIDER_PID_TERM)) .report(); return null; } - if (messageObject.containsKey(DSPACE_PROPERTY_CODE_IRI)) { - transformString(messageObject.get(DSPACE_PROPERTY_CODE_IRI), builder::code, context); + if (messageObject.containsKey(forNamespace(DSPACE_PROPERTY_CODE_TERM))) { + transformString(messageObject.get(forNamespace(DSPACE_PROPERTY_CODE_TERM)), builder::code, context); } - var reasons = messageObject.get(DSPACE_PROPERTY_REASON_IRI); + var reasons = messageObject.get(forNamespace(DSPACE_PROPERTY_REASON_TERM)); if (reasons != null) { // optional property if (!(reasons instanceof JsonArray)) { context.problem() .unexpectedType() - .type(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_IRI) - .property(DSPACE_PROPERTY_REASON_IRI) + .type(forNamespace(DSPACE_TYPE_TRANSFER_TERMINATION_MESSAGE_TERM)) + .property(forNamespace(DSPACE_PROPERTY_REASON_TERM)) .actual(reasons.getValueType()) .expected(ARRAY) .report(); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromDataAddressTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromDataAddressTransformerTest.java similarity index 100% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromDataAddressTransformerTest.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromDataAddressTransformerTest.java diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferCompletionMessageTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferCompletionMessageTransformerTest.java similarity index 100% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferCompletionMessageTransformerTest.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferCompletionMessageTransformerTest.java diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferErrorTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferErrorTransformerTest.java similarity index 96% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferErrorTransformerTest.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferErrorTransformerTest.java index cee7e08e9dc..f2105343dbf 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferErrorTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferErrorTransformerTest.java @@ -29,7 +29,7 @@ import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CODE_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_ERROR; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_ERROR_IRI; import static org.mockito.Mockito.mock; class JsonObjectFromTransferErrorTransformerTest { @@ -55,7 +55,7 @@ void transform_returnJsonObject() { var result = transformer.transform(error, context); assertThat(result).isNotNull(); - assertThat(result.getJsonString(TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_ERROR); + assertThat(result.getJsonString(TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_ERROR_IRI); assertThat(result.getString(DSPACE_PROPERTY_CODE_IRI)).isEqualTo("code"); assertThat(result.getJsonArray(DSPACE_PROPERTY_REASON_IRI)).contains(Json.createValue("message")); } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferProcessTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferProcessTransformerTest.java similarity index 97% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferProcessTransformerTest.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferProcessTransformerTest.java index 4d68ce10c25..6a81208818d 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferProcessTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferProcessTransformerTest.java @@ -31,7 +31,7 @@ import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_PROCESS; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_PROCESS_IRI; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; @@ -65,7 +65,7 @@ void transformTransferProcessProvider() { var result = transformer.transform(transferProcess, context); assertThat(result).isNotNull(); - assertThat(result.getJsonString(TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_PROCESS); + assertThat(result.getJsonString(TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_PROCESS_IRI); assertThat(result.getJsonString(ID).getString()).isEqualTo("providerPid"); assertThat(result.getJsonString(DSPACE_PROPERTY_STATE_IRI).getString()).isEqualTo("INITIAL"); assertThat(result.getJsonString(DSPACE_PROPERTY_CONSUMER_PID_IRI).getString()).isEqualTo("consumerPid"); @@ -93,7 +93,7 @@ void transformTransferProcessConsumer() { var result = transformer.transform(transferProcess, context); assertThat(result).isNotNull(); - assertThat(result.getJsonString(TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_PROCESS); + assertThat(result.getJsonString(TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_PROCESS_IRI); assertThat(result.getJsonString(ID).getString()).isEqualTo("consumerPid"); assertThat(result.getJsonString(DSPACE_PROPERTY_STATE_IRI).getString()).isEqualTo("INITIAL"); assertThat(result.getJsonString(DSPACE_PROPERTY_CONSUMER_PID_IRI).getString()).isEqualTo("consumerPid"); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferRequestMessageTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferRequestMessageTransformerTest.java similarity index 95% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferRequestMessageTransformerTest.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferRequestMessageTransformerTest.java index 942f7482573..2f9d829b57c 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferRequestMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferRequestMessageTransformerTest.java @@ -31,8 +31,8 @@ import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCT_FORMAT_ATTRIBUTE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; @@ -82,11 +82,11 @@ void transformTransferRequestMessageWithDataAddress() { assertThat(result).isNotNull(); assertThat(result.getJsonString(JsonLdKeywords.TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI); - assertThat(result.getJsonString(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID).getString()).isEqualTo(contractId); + assertThat(result.getJsonString(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID_IRI).getString()).isEqualTo(contractId); assertThat(result.getJsonString(DCT_FORMAT_ATTRIBUTE).getString()).isEqualTo(dataAddressType); assertThat(result.getJsonString(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI).getString()).isEqualTo(callbackAddress); assertThat(result.getJsonString(DSPACE_PROPERTY_CONSUMER_PID_IRI).getString()).isEqualTo("consumerPid"); - assertThat(result.getJsonObject(DSPACE_PROPERTY_DATA_ADDRESS).getString("keyName")).isEqualTo(dataAddressKey); + assertThat(result.getJsonObject(DSPACE_PROPERTY_DATA_ADDRESS_IRI).getString("keyName")).isEqualTo(dataAddressKey); verify(context, never()).reportProblem(anyString()); } @@ -106,10 +106,10 @@ void transformTransferRequestMessageWithoutDataAddress() { assertThat(result).isNotNull(); assertThat(result.getJsonString(JsonLdKeywords.TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI); - assertThat(result.getJsonString(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID).getString()).isEqualTo(contractId); + assertThat(result.getJsonString(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID_IRI).getString()).isEqualTo(contractId); assertThat(result.getJsonString(DCT_FORMAT_ATTRIBUTE).getString()).isEqualTo(dataAddressType); assertThat(result.getJsonString(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI).getString()).isEqualTo(callbackAddress); - assertThat(result.getJsonObject(DSPACE_PROPERTY_DATA_ADDRESS)).isEqualTo(null); + assertThat(result.getJsonObject(DSPACE_PROPERTY_DATA_ADDRESS_IRI)).isEqualTo(null); verify(context, never()).reportProblem(anyString()); } @@ -130,10 +130,10 @@ void transformTransferRequestMessageWithTransferType() { assertThat(result).isNotNull(); assertThat(result.getJsonString(JsonLdKeywords.TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI); - assertThat(result.getJsonString(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID).getString()).isEqualTo(contractId); + assertThat(result.getJsonString(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID_IRI).getString()).isEqualTo(contractId); assertThat(result.getJsonString(DCT_FORMAT_ATTRIBUTE).getString()).isEqualTo(transferType); assertThat(result.getJsonString(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI).getString()).isEqualTo(callbackAddress); - assertThat(result.getJsonObject(DSPACE_PROPERTY_DATA_ADDRESS)).isEqualTo(null); + assertThat(result.getJsonObject(DSPACE_PROPERTY_DATA_ADDRESS_IRI)).isEqualTo(null); verify(context, never()).reportProblem(anyString()); } diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferStartMessageTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferStartMessageTransformerTest.java similarity index 97% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferStartMessageTransformerTest.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferStartMessageTransformerTest.java index e69000c80f8..3f00c4150df 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferStartMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferStartMessageTransformerTest.java @@ -29,7 +29,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; @@ -65,7 +65,7 @@ void transformTransferStartMessage() { assertThat(result.getString(JsonLdKeywords.TYPE)).isEqualTo(DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI); assertThat(result.getString(DSPACE_PROPERTY_PROVIDER_PID_IRI)).isEqualTo("providerPid"); assertThat(result.getString(DSPACE_PROPERTY_CONSUMER_PID_IRI)).isEqualTo("consumerPid"); - assertThat(result.getJsonObject(DSPACE_PROPERTY_DATA_ADDRESS)).isEqualTo(dataAddressJson); + assertThat(result.getJsonObject(DSPACE_PROPERTY_DATA_ADDRESS_IRI)).isEqualTo(dataAddressJson); verify(context, times(1)).transform(dataAddress, JsonObject.class); verify(context, never()).reportProblem(anyString()); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferSuspensionMessageTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferSuspensionMessageTransformerTest.java similarity index 98% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferSuspensionMessageTransformerTest.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferSuspensionMessageTransformerTest.java index 5dc4ef6150d..c4850d23542 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferSuspensionMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferSuspensionMessageTransformerTest.java @@ -30,7 +30,7 @@ import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE_IRI; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; @@ -58,7 +58,7 @@ void transformTransferSuspensionMessage() { var result = transformer.transform(message, context); assertThat(result).isNotNull(); - assertThat(result.getJsonString(TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE); + assertThat(result.getJsonString(TYPE).getString()).isEqualTo(DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE_IRI); assertThat(result.getJsonString(DSPACE_PROPERTY_CONSUMER_PID_IRI).getString()).isEqualTo("consumerPid"); assertThat(result.getJsonString(DSPACE_PROPERTY_PROVIDER_PID_IRI).getString()).isEqualTo("providerPid"); assertThat(result.getJsonString(DSPACE_PROPERTY_CODE_IRI).getString()).isEqualTo("testCode"); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferTerminationMessageTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferTerminationMessageTransformerTest.java similarity index 100% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferTerminationMessageTransformerTest.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/from/JsonObjectFromTransferTerminationMessageTransformerTest.java diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferCompletionMessageTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferCompletionMessageTransformerTest.java similarity index 100% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferCompletionMessageTransformerTest.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferCompletionMessageTransformerTest.java diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferProcessAckTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferProcessAckTransformerTest.java similarity index 95% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferProcessAckTransformerTest.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferProcessAckTransformerTest.java index 385dbd5296d..0b00bcbbb68 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferProcessAckTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferProcessAckTransformerTest.java @@ -27,7 +27,7 @@ import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_STATE_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_PROCESS; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_PROCESS_IRI; import static org.eclipse.edc.protocol.dsp.transferprocess.transform.to.TestInput.getExpanded; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verifyNoInteractions; @@ -41,7 +41,7 @@ class JsonObjectToTransferProcessAckTransformerTest { @Test void shouldTransform() { var message = jsonFactory.createObjectBuilder() - .add(TYPE, DSPACE_TYPE_TRANSFER_PROCESS) + .add(TYPE, DSPACE_TYPE_TRANSFER_PROCESS_IRI) .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") .add(DSPACE_PROPERTY_STATE_IRI, "STATE") diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferRequestMessageTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferRequestMessageTransformerTest.java similarity index 92% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferRequestMessageTransformerTest.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferRequestMessageTransformerTest.java index 365c894a817..b82a3853afb 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferRequestMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferRequestMessageTransformerTest.java @@ -27,8 +27,8 @@ import static org.eclipse.edc.jsonld.spi.PropertyAndTypeNames.DCT_FORMAT_ATTRIBUTE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID_IRI; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.transferprocess.transform.to.TestInput.getExpanded; import static org.eclipse.edc.spi.constants.CoreConstants.EDC_NAMESPACE; @@ -55,7 +55,7 @@ class JsonObjectToTransferRequestMessageTransformerTest { void jsonObjectToTransferRequestWithoutDataAddress() { var json = Json.createObjectBuilder() .add(TYPE, DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID, contractId) + .add(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID_IRI, contractId) .add(DCT_FORMAT_ATTRIBUTE, destinationType) .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, callbackAddress) .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "processId") @@ -79,9 +79,9 @@ void jsonObjectToTransferRequestWithDataAddress() { when(context.transform(any(), eq(DataAddress.class))).thenReturn(dataDestination); var json = Json.createObjectBuilder() .add(TYPE, DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID, contractId) + .add(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID_IRI, contractId) .add(DCT_FORMAT_ATTRIBUTE, destinationType) - .add(DSPACE_PROPERTY_DATA_ADDRESS, createDataAddress()) + .add(DSPACE_PROPERTY_DATA_ADDRESS_IRI, createDataAddress()) .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, callbackAddress) .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "processId") .build(); @@ -102,9 +102,9 @@ void shouldReturnNullAndReportError_whenConsumerPidNotSet() { when(context.problem()).thenReturn(new ProblemBuilder(context)); var json = Json.createObjectBuilder() .add(TYPE, DSPACE_TYPE_TRANSFER_REQUEST_MESSAGE_IRI) - .add(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID, contractId) + .add(DSPACE_PROPERTY_CONTRACT_AGREEMENT_ID_IRI, contractId) .add(DCT_FORMAT_ATTRIBUTE, destinationType) - .add(DSPACE_PROPERTY_DATA_ADDRESS, Json.createObjectBuilder().build()) + .add(DSPACE_PROPERTY_DATA_ADDRESS_IRI, Json.createObjectBuilder().build()) .add(DSPACE_PROPERTY_CALLBACK_ADDRESS_IRI, callbackAddress) .build(); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferStartMessageTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferStartMessageTransformerTest.java similarity index 95% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferStartMessageTransformerTest.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferStartMessageTransformerTest.java index 44d72161283..bee4a2853fb 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferStartMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferStartMessageTransformerTest.java @@ -26,7 +26,7 @@ import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.TYPE; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_PROPERTY_DATA_ADDRESS_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.transferprocess.transform.to.TestInput.getExpanded; import static org.eclipse.edc.spi.constants.CoreConstants.EDC_NAMESPACE; @@ -82,7 +82,7 @@ void jsonObjectToTransferStartMessageWithDataAddress() { .add(TYPE, DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") - .add(DSPACE_PROPERTY_DATA_ADDRESS, dataAddressObject) + .add(DSPACE_PROPERTY_DATA_ADDRESS_IRI, dataAddressObject) .build(); var dataAddress = DataAddress.Builder.newInstance().type("AWS").build(); @@ -103,7 +103,7 @@ void jsonObjectToTransferStartMessageWithEmptyDataAddress() { .add(TYPE, DSPACE_TYPE_TRANSFER_START_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") - .add(DSPACE_PROPERTY_DATA_ADDRESS, Json.createObjectBuilder().build()) + .add(DSPACE_PROPERTY_DATA_ADDRESS_IRI, Json.createObjectBuilder().build()) .build(); var result = transformer.transform(getExpanded(json), context); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferSuspensionMessageTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferSuspensionMessageTransformerTest.java similarity index 99% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferSuspensionMessageTransformerTest.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferSuspensionMessageTransformerTest.java index c89dc4e6cd0..a78cc9842d2 100644 --- a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferSuspensionMessageTransformerTest.java +++ b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferSuspensionMessageTransformerTest.java @@ -36,7 +36,7 @@ import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_CONSUMER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_PROVIDER_PID_IRI; import static org.eclipse.edc.protocol.dsp.spi.type.DspPropertyAndTypeNames.DSPACE_PROPERTY_REASON_IRI; -import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE; +import static org.eclipse.edc.protocol.dsp.spi.type.DspTransferProcessPropertyAndTypeNames.DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE_IRI; import static org.eclipse.edc.protocol.dsp.transferprocess.transform.to.TestInput.getExpanded; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; @@ -55,7 +55,7 @@ class JsonObjectToTransferSuspensionMessageTransformerTest { void shouldTransform() { var json = createObjectBuilder() .add(CONTEXT, createObjectBuilder().add(VOCAB, DSPACE_SCHEMA)) - .add(TYPE, DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE) + .add(TYPE, DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE_IRI) .add(DSPACE_PROPERTY_CONSUMER_PID_IRI, "consumerPid") .add(DSPACE_PROPERTY_PROVIDER_PID_IRI, "providerPid") .add(DSPACE_PROPERTY_CODE_IRI, "testCode") @@ -84,7 +84,7 @@ void shouldReportError_whenMissingPids() { var reasonArray = Json.createBuilderFactory(Map.of()).createArrayBuilder().add(reason).build(); var json = createObjectBuilder() - .add(TYPE, DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE) + .add(TYPE, DSPACE_TYPE_TRANSFER_SUSPENSION_MESSAGE_IRI) .add(DSPACE_PROPERTY_CODE_IRI, "testCode") .add(DSPACE_PROPERTY_REASON_IRI, Json.createBuilderFactory(Map.of()).createArrayBuilder().add(reasonArray).build()) .build(); diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferTerminationMessageTransformerTest.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferTerminationMessageTransformerTest.java similarity index 100% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferTerminationMessageTransformerTest.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/JsonObjectToTransferTerminationMessageTransformerTest.java diff --git a/data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/TestInput.java b/data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/TestInput.java similarity index 100% rename from data-protocols/dsp/dsp-transfer-process/dsp-transfer-process-transform/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/TestInput.java rename to data-protocols/dsp/dsp-transfer-process/lib/dsp-transfer-process-transform-lib/src/test/java/org/eclipse/edc/protocol/dsp/transferprocess/transform/to/TestInput.java diff --git a/settings.gradle.kts b/settings.gradle.kts index 75aeecf072f..5f572b01e63 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -100,6 +100,7 @@ include(":data-protocols:dsp:dsp-transfer-process:dsp-transfer-process-http-api" include(":data-protocols:dsp:dsp-transfer-process:dsp-transfer-process-http-dispatcher") include(":data-protocols:dsp:dsp-transfer-process:dsp-transfer-process-transform") include(":data-protocols:dsp:dsp-transfer-process:lib:dsp-transfer-process-validation-lib") +include(":data-protocols:dsp:dsp-transfer-process:lib:dsp-transfer-process-transform-lib") include(":data-protocols:dsp:dsp-version:dsp-version-http-api") // modules for technology- or cloud-provider extensions --------------------------------------------