-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(dsp-negotiation): add dsp-negotiation-http-dispatcher
- Loading branch information
1 parent
3b8bf19
commit 04a20c9
Showing
4 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
data-protocols/dsp/dsp-negotiation/dsp-negotiation-http-dispatcher/build.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |
59 changes: 59 additions & 0 deletions
59
...clipse/edc/protocol/dsp/negotiation/dispatcher/DspNegotiationHttpDispatcherExtension.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...spatcher/src/main/resources/META-INF/services/org.eclipse.edc.spi.system.ServiceExtension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters