Skip to content

Commit

Permalink
chore(dsp-negotiation): add dsp-negotiation-http-dispatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
juliapampus committed Apr 24, 2023
1 parent 3b8bf19 commit 04a20c9
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering
*
* 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:
* Fraunhofer Institute for Software and Systems Engineering - initial API and implementation
*
*/

plugins {
`java-library`
}

dependencies {
api(project(":data-protocols:dsp:dsp-negotiation:dsp-negotiation-spi"))
api(project(":data-protocols:dsp:dsp-negotiation:dsp-negotiation-transform"))
api(project(":data-protocols:dsp:dsp-http-core"))
api(project(":data-protocols:dsp:dsp-http-spi"))
api(project(":extensions:common:json-ld"))
api(project(":spi:control-plane:contract-spi"))

api(libs.jakartaJson)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering
*
* 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:
* Fraunhofer Institute for Software and Systems Engineering - initial API and implementation
*
*/

package org.eclipse.edc.protocol.dsp.negotiation.dispatcher;

import org.eclipse.edc.jsonld.transformer.JsonLdTransformerRegistry;
import org.eclipse.edc.protocol.dsp.negotiation.dispatcher.delegate.ContractAgreementMessageDelegate;
import org.eclipse.edc.protocol.dsp.negotiation.dispatcher.delegate.ContractAgreementVerificationMessageDelegate;
import org.eclipse.edc.protocol.dsp.negotiation.dispatcher.delegate.ContractNegotiationEventMessageDelegate;
import org.eclipse.edc.protocol.dsp.negotiation.dispatcher.delegate.ContractOfferRequestDelegate;
import org.eclipse.edc.protocol.dsp.negotiation.dispatcher.delegate.ContractRejectionHttpDelegate;
import org.eclipse.edc.protocol.dsp.spi.dispatcher.DspHttpRemoteMessageDispatcher;
import org.eclipse.edc.runtime.metamodel.annotation.Extension;
import org.eclipse.edc.runtime.metamodel.annotation.Inject;
import org.eclipse.edc.spi.system.ServiceExtension;
import org.eclipse.edc.spi.system.ServiceExtensionContext;
import org.eclipse.edc.spi.types.TypeManager;

import static org.eclipse.edc.jsonld.JsonLdExtension.TYPE_MANAGER_CONTEXT_JSON_LD;

@Extension(value = DspNegotiationHttpDispatcherExtension.NAME)
public class DspNegotiationHttpDispatcherExtension implements ServiceExtension {

public static final String NAME = "Dataspace Protocol Negotiation HTTP Dispatcher Extension";

@Inject
private DspHttpRemoteMessageDispatcher messageDispatcher;
@Inject
private TypeManager typeManager;
@Inject
private JsonLdTransformerRegistry transformerRegistry;

@Override
public String name() {
return NAME;
}

@Override
public void initialize(ServiceExtensionContext context) {
var objectMapper = typeManager.getMapper(TYPE_MANAGER_CONTEXT_JSON_LD);

messageDispatcher.registerDelegate(new ContractAgreementMessageDelegate(objectMapper, transformerRegistry));
messageDispatcher.registerDelegate(new ContractAgreementVerificationMessageDelegate(objectMapper, transformerRegistry));
messageDispatcher.registerDelegate(new ContractNegotiationEventMessageDelegate(objectMapper, transformerRegistry));
messageDispatcher.registerDelegate(new ContractOfferRequestDelegate(objectMapper, transformerRegistry));
messageDispatcher.registerDelegate(new ContractRejectionHttpDelegate(objectMapper, transformerRegistry));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#
# Copyright (c) 2023 Fraunhofer Institute for Software and Systems Engineering
#
# 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:
# Fraunhofer Institute for Software and Systems Engineering - Initial API and Implementation
#
#

org.eclipse.edc.protocol.dsp.negotiation.dispatcher.DspNegotiationHttpDispatcherExtension
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ include(":data-protocols:dsp:dsp-catalog:dsp-catalog-http-dispatcher")
include(":data-protocols:dsp:dsp-catalog:dsp-catalog-spi")
include(":data-protocols:dsp:dsp-catalog:dsp-catalog-transform")
include(":data-protocols:dsp:dsp-transfer-process:dsp-transfer-process-transform")
include(":data-protocols:dsp:dsp-negotiation:dsp-negotiation-http-dispatcher")
include(":data-protocols:dsp:dsp-negotiation:dsp-negotiation-spi")
include(":data-protocols:dsp:dsp-negotiation:dsp-negotiation-transform")
include(":data-protocols:dsp:dsp-http-core")
Expand Down

0 comments on commit 04a20c9

Please sign in to comment.