-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: exposes protocol protoco version management api endpoint
- Loading branch information
Showing
33 changed files
with
1,342 additions
and
6 deletions.
There are no files selected for viewing
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
43 changes: 43 additions & 0 deletions
43
...ain/java/org/eclipse/edc/connector/controlplane/services/protocol/VersionServiceImpl.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,43 @@ | ||
/* | ||
* 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 | ||
* | ||
*/ | ||
|
||
package org.eclipse.edc.connector.controlplane.services.protocol; | ||
|
||
import org.eclipse.edc.connector.controlplane.protocolversion.spi.ProtocolVersionRequest; | ||
import org.eclipse.edc.connector.controlplane.protocolversion.spi.ProtocolVersionRequestMessage; | ||
import org.eclipse.edc.connector.controlplane.services.spi.protocol.VersionService; | ||
import org.eclipse.edc.spi.message.RemoteMessageDispatcherRegistry; | ||
import org.eclipse.edc.spi.response.StatusResult; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
public class VersionServiceImpl implements VersionService { | ||
|
||
private final RemoteMessageDispatcherRegistry dispatcher; | ||
|
||
public VersionServiceImpl(RemoteMessageDispatcherRegistry dispatcher) { | ||
this.dispatcher = dispatcher; | ||
} | ||
|
||
@Override | ||
public CompletableFuture<StatusResult<byte[]>> requestVersions(ProtocolVersionRequest request) { | ||
var message = ProtocolVersionRequestMessage.Builder.newInstance() | ||
.protocol(request.getProtocol()) | ||
.counterPartyId(request.getCounterPartyId()) | ||
.counterPartyAddress(request.getCounterPartyAddress()) | ||
.build(); | ||
|
||
return dispatcher.dispatch(byte[].class, message); | ||
} | ||
} |
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
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
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
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
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
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,23 @@ | ||
/* | ||
* 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(":data-protocols:dsp:dsp-version:dsp-version-http-api")) | ||
api(project(":data-protocols:dsp:dsp-version:dsp-version-http-dispatcher")) | ||
} |
25 changes: 25 additions & 0 deletions
25
data-protocols/dsp/dsp-version/dsp-version-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,25 @@ | ||
/* | ||
* 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(":data-protocols:dsp:dsp-http-core")) | ||
api(project(":data-protocols:dsp:dsp-http-spi")) | ||
api(project(":spi:control-plane:protocol-version-spi")) | ||
|
||
testImplementation(testFixtures(project(":data-protocols:dsp:dsp-http-spi"))) | ||
} |
60 changes: 60 additions & 0 deletions
60
...g/eclipse/edc/protocol/dsp/version/http/dispatcher/DspVersionHttpDispatcherExtension.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,60 @@ | ||
/* | ||
* 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 | ||
* | ||
*/ | ||
|
||
package org.eclipse.edc.protocol.dsp.version.http.dispatcher; | ||
|
||
import org.eclipse.edc.connector.controlplane.protocolversion.spi.ProtocolVersionRequestMessage; | ||
import org.eclipse.edc.protocol.dsp.http.dispatcher.GetDspHttpRequestFactory; | ||
import org.eclipse.edc.protocol.dsp.http.serialization.ByteArrayBodyExtractor; | ||
import org.eclipse.edc.protocol.dsp.http.spi.DspProtocolParser; | ||
import org.eclipse.edc.protocol.dsp.http.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 static org.eclipse.edc.protocol.dsp.version.http.dispatcher.VersionApiPaths.PATH; | ||
|
||
/** | ||
* Creates and registers the HTTP dispatcher delegate for sending a version request as defined in | ||
* the dataspace protocol specification. | ||
*/ | ||
@Extension(value = DspVersionHttpDispatcherExtension.NAME) | ||
public class DspVersionHttpDispatcherExtension implements ServiceExtension { | ||
|
||
public static final String NAME = "Dataspace Protocol Version HTTP Dispatcher Extension"; | ||
|
||
@Inject | ||
private DspHttpRemoteMessageDispatcher messageDispatcher; | ||
|
||
@Inject | ||
private DspProtocolParser dspProtocolParser; | ||
|
||
@Override | ||
public String name() { | ||
return NAME; | ||
} | ||
|
||
@Override | ||
public void initialize(ServiceExtensionContext context) { | ||
var byteArrayBodyExtractor = new ByteArrayBodyExtractor(); | ||
|
||
messageDispatcher.registerMessage( | ||
ProtocolVersionRequestMessage.class, | ||
new GetDspHttpRequestFactory<>(dspProtocolParser, m -> PATH), | ||
byteArrayBodyExtractor | ||
); | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
...r/src/main/java/org/eclipse/edc/protocol/dsp/version/http/dispatcher/VersionApiPaths.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,24 @@ | ||
/* | ||
* 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 | ||
* | ||
*/ | ||
|
||
package org.eclipse.edc.protocol.dsp.version.http.dispatcher; | ||
|
||
/** | ||
* API paths for version requests as defined in the dataspace protocol specification. | ||
*/ | ||
public interface VersionApiPaths { | ||
|
||
String PATH = "/.well-known/dspace-version"; | ||
|
||
} |
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) 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 | ||
# | ||
# | ||
|
||
org.eclipse.edc.protocol.dsp.version.http.dispatcher.DspVersionHttpDispatcherExtension |
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
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
44 changes: 44 additions & 0 deletions
44
extensions/control-plane/api/management-api/protocol-version-api/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,44 @@ | ||
/* | ||
* 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` | ||
id(libs.plugins.swagger.get().pluginId) | ||
} | ||
|
||
dependencies { | ||
api(project(":spi:control-plane:control-plane-spi")) | ||
|
||
implementation(project(":core:common:lib:validator-lib")) | ||
implementation(project(":extensions:common:api:api-core")) | ||
implementation(project(":extensions:common:api:lib:management-api-lib")) | ||
|
||
implementation(libs.jakarta.rsApi) | ||
|
||
testImplementation(project(":core:common:junit")) | ||
testImplementation(project(":core:common:lib:transform-lib")) | ||
testImplementation(project(":core:control-plane:control-plane-core")) | ||
testImplementation(project(":core:data-plane-selector:data-plane-selector-core")) | ||
testImplementation(project(":extensions:common:http")) | ||
testImplementation(project(":extensions:common:iam:iam-mock")) | ||
testImplementation(testFixtures(project(":extensions:common:http:jersey-core"))) | ||
testImplementation(libs.restAssured) | ||
} | ||
|
||
edcBuild { | ||
swagger { | ||
apiGroup.set("management-api") | ||
} | ||
} | ||
|
||
|
Oops, something went wrong.