Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: split data plane module into two separate modules #3676

Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/apidoc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
apiGroup: [ 'management-api', 'control-api' ]
apiGroup: [ 'public', 'management-api', 'control-api' ]
hamidonos marked this conversation as resolved.
Show resolved Hide resolved
env:
rootDir: resources/openapi/yaml/${{ matrix.apiGroup }}
SWAGGERHUB_API_KEY: ${{ secrets.SWAGGERHUB_TOKEN }}
Expand Down

This file was deleted.

32 changes: 32 additions & 0 deletions extensions/data-plane/data-plane-common/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
hamidonos marked this conversation as resolved.
Show resolved Hide resolved
* Copyright (c) 2022 Microsoft Corporation
*
* 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:
* Microsoft Corporation - initial API and implementation
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - improvements
* Mercedes-Benz Tech Innovation GmbH - publish public api context into dedicated swagger hub page
*
*/


plugins {
`java-library`
id("io.swagger.core.v3.swagger-gradle-plugin")
}

dependencies {
api(project(":spi:data-plane:data-plane-spi"))

implementation(libs.jakarta.rsApi)

testImplementation(project(":core:common:junit"))
testImplementation(testFixtures(project(":extensions:common:http:jersey-core")))
}


51 changes: 51 additions & 0 deletions extensions/data-plane/data-plane-control-api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Data Plane API
hamidonos marked this conversation as resolved.
Show resolved Hide resolved

This extension provides the APIs of the Data Plane which are used by the Control Plane to delegate the data transfer
to its Data Plane. APIs are not intended for public use. [See Data Plane Public API](../data-plane-public-api/README.md).

### Scope

These APIs have been designed to support the different data transfer types that the Data Plane must support, which are:

- Consumer Data Pull: the consumer backend applications use the Data Plane to proxy data request until the provided data source.
This data transfer type is exclusively built around the [Data Plane Public API](../data-plane-public-api/README.md).
hamidonos marked this conversation as resolved.
Show resolved Hide resolved
- Provider Push and Streaming: once contract is agreed by both participants, the Control Plane of the provider delegates
the data transfer to its Data Plane through the Control API.

### Use Cases

#### Use Case #1

Provider wants to expose a Rest API taking as input some query parameters that restrict the amount of data returned for each query.
Here it is not feasible for the data consumer to negotiate a contract for each query that will hit the provider data source API.
Here the approach for the consumer would then be to
[negotiate with the provider the possibility to access the data source through a proxy](../../control-plane/data-plane-transfer/data-plane-transfer-sync/).
If the negotiation ends successfully, the consumer will be provided an access token that its backend applications can then use when querying the Data Plane public API.

This approach enables the consumer backend application to pass directly the query parameters, path parameters and body
in the request to the [Data Plane Public API](../data-plane-public-api/README.md). If the provider data source allows it, these parameters will then be conveyed until the data source.

### Use Case #2

Provider exposes some data located in a Cloud storage, such as AWS S3 or Azure storage. Consumer wants to copy these data
into its own storage system (which can be of a different type than the one of the provider). Here the consumer will negotiate a
_simple_ data transfer, by notifying to which location the data should be copied. Once contract is agreed between both parties,
the provider will automatically trigger the data transfer by delegating the data copy to is Data Plane system, through its Control API.
hamidonos marked this conversation as resolved.
Show resolved Hide resolved

## Technical Details

### Interfaces

OpenApi documentation can be found [here](../../../resources/openapi/yaml/data-plane-control-api.yaml).
hamidonos marked this conversation as resolved.
Show resolved Hide resolved

### Dependencies

_Provide some information about dependencies, e.g., used extensions._

| Name | Description |
|:--------|:---------------------------------------------|
| web-spi | Essentially for the Controllers registration |
ndr-brt marked this conversation as resolved.
Show resolved Hide resolved

## Design Principles

This API relies on the `DataPlaneManager` for executing the actual data transfer, see [Data Plane Framework](../../../core/data-plane/data-plane-framework/README.md) for more details.
ndr-brt marked this conversation as resolved.
Show resolved Hide resolved
43 changes: 43 additions & 0 deletions extensions/data-plane/data-plane-control-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright (c) 2022 Microsoft Corporation
*
* 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:
* Microsoft Corporation - initial API and implementation
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - improvements
* Mercedes-Benz Tech Innovation GmbH - publish public api context into dedicated swagger hub page
*
*/


plugins {
`java-library`
id("io.swagger.core.v3.swagger-gradle-plugin")
}

dependencies {
api(project(":spi:common:web-spi"))
api(project(":spi:data-plane:data-plane-spi"))
implementation(project(":extensions:common:api:control-api-configuration"))
implementation(project(":extensions:data-plane:data-plane-common"))

implementation(libs.jakarta.rsApi)

testImplementation(project(":extensions:common:http"))
testImplementation(project(":core:common:junit"))
testImplementation(libs.jersey.multipart)
testImplementation(libs.restAssured)
testImplementation(testFixtures(project(":extensions:common:http:jersey-core")))
}
edcBuild {
swagger {
apiGroup.set("control-api")
}
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright (c) 2022 Microsoft Corporation
*
* 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:
* Microsoft Corporation - initial API and implementation
* Mercedes-Benz Tech Innovation GmbH - publish public api context into dedicated swagger hub page
*
*/

package org.eclipse.edc.connector.dataplane.api;

import org.eclipse.edc.connector.api.control.configuration.ControlApiConfiguration;
import org.eclipse.edc.connector.dataplane.api.controller.DataPlaneControlApiController;
import org.eclipse.edc.connector.dataplane.spi.manager.DataPlaneManager;
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.web.spi.WebService;

/**
* This extension provides set of endpoints to trigger/monitor/cancel data transfers that should be accessible only
* by the Control Plane.
*/
@Extension(value = DataPlaneControlApiExtension.NAME)
public class DataPlaneControlApiExtension implements ServiceExtension {
public static final String NAME = "Data Plane Control API";

@Inject
private DataPlaneManager dataPlaneManager;

@Inject
private WebService webService;

@Inject
private ControlApiConfiguration controlApiConfiguration;

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

@Override
public void initialize(ServiceExtensionContext context) {
webService.registerResource(controlApiConfiguration.getContextAlias(), new DataPlaneControlApiController(dataPlaneManager));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.eclipse.edc.connector.dataplane.api.DataPlaneControlApiExtension
Original file line number Diff line number Diff line change
@@ -1,38 +1,15 @@
# Data Plane API
hamidonos marked this conversation as resolved.
Show resolved Hide resolved

This extension provides the interfaces and implementations for the Data Plane API, which are respectively:

- the Control API which is used by the Control Plane to delegate the data transfer to its Data Plane,
- the Public API which is essentially a data proxy enabling a consumer to actively query data out from the provider data source.
This extension provides the interfaces and implementations for the Data Plane Public API which is essentially a data
proxy enabling a consumer to actively query data out from the provider data source.

### Scope

These APIs have been designed to support the different data transfer types that the Data Plane must support, which are:

- Consumer Data Pull: the consumer backend applications use the Data Plane to proxy data request until the provided data source.
This data transfer type is exclusively built around the Public API of the Data Plane.
- Provider Push and Streaming: once contract is agreed by both participants, the Control Plane of the provider delegates
the data transfer to its Data Plane through the Control API.
See Data Plane scope [here](../data-plane-control-api/README.md#scope).
hamidonos marked this conversation as resolved.
Show resolved Hide resolved

### Use Cases
hamidonos marked this conversation as resolved.
Show resolved Hide resolved

#### Use Case #1

Provider wants to expose a Rest API taking as input some query parameters that restrict the amount of data returned for each query.
Here it is not feasible for the data consumer to negotiate a contract for each query that will hit the provider data source API.
Here the approach for the consumer would then be to
[negotiate with the provider the possibility to access the data source through a proxy](../../control-plane/data-plane-transfer/data-plane-transfer-sync/).
If the negotiation ends successfully, the consumer will be provided an access token that its backend applications can then use when querying the Data Plane public API.

This approach enables the consumer backend application to pass directly the query parameters, path parameters and body
in the request to Data Plane public API. If the provider data source allows it, these parameters will then be conveyed until the data source.

### Use Case #2

Provider exposes some data located in a Cloud storage, such as AWS S3 or Azure storage. Consumer wants to copy these data
into its own storage system (which can be of a different type than the one of the provider). Here the consumer will negotiate a
_simple_ data transfer, by notifying to which location the data should be copied. Once contract is agreed between both parties,
the provider will automatically trigger the data transfer by delegating the data copy to is Data Plane system, through its Control API.
See Data Plane use cases [here](../data-plane-control-api/README.md#use-cases).

## Technical Details

Expand All @@ -56,7 +33,7 @@ _Provide some information about dependencies, e.g., used extensions._

## Design Principles

Both public and control APIs rely on the `DataPlaneManager` for executing the actual data transfer, see [Data Plane Framework](../../../core/data-plane/data-plane-framework/README.md) for more details.
This API relies on the `DataPlaneManager` for executing the actual data transfer, see [Data Plane Framework](../../../core/data-plane/data-plane-framework/README.md) for more details.
hamidonos marked this conversation as resolved.
Show resolved Hide resolved

The Data Plane public API takes an access token in input from the `Authorization` header, which is validated and decode by calling the
validation server. If the validation is successful, then the Data Plane is executed in order to query the data from the data address returned by the validation server.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Contributors:
* Microsoft Corporation - initial API and implementation
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - improvements
* Mercedes-Benz Tech Innovation GmbH - publish public api context into dedicated swagger hub page
*
*/

Expand All @@ -23,9 +24,9 @@ dependencies {
api(project(":spi:common:http-spi"))
api(project(":spi:common:web-spi"))
api(project(":spi:data-plane:data-plane-spi"))
implementation(project(":core:data-plane:data-plane-util"))
implementation(project(":extensions:common:api:control-api-configuration"))

implementation(project(":core:data-plane:data-plane-util"))
implementation(project(":extensions:data-plane:data-plane-common"))
implementation(libs.jakarta.rsApi)

testImplementation(project(":extensions:common:http"))
Expand All @@ -38,7 +39,7 @@ dependencies {
}
edcBuild {
swagger {
apiGroup.set("control-api")
apiGroup.set("public")
hamidonos marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@
*
* Contributors:
* Microsoft Corporation - initial API and implementation
* Mercedes-Benz Tech Innovation GmbH - publish public api context into dedicated swagger hub page
*
*/

package org.eclipse.edc.connector.dataplane.api;

import org.eclipse.edc.connector.api.control.configuration.ControlApiConfiguration;
import org.eclipse.edc.connector.dataplane.api.controller.DataPlaneControlApiController;
import org.eclipse.edc.connector.dataplane.api.controller.DataPlanePublicApiController;
import org.eclipse.edc.connector.dataplane.api.validation.ConsumerPullTransferDataAddressResolver;
import org.eclipse.edc.connector.dataplane.spi.manager.DataPlaneManager;
import org.eclipse.edc.connector.dataplane.spi.pipeline.PipelineService;
import org.eclipse.edc.runtime.metamodel.annotation.Extension;
import org.eclipse.edc.runtime.metamodel.annotation.Inject;
Expand All @@ -33,13 +31,12 @@
import org.eclipse.edc.web.spi.configuration.WebServiceSettings;

/**
* This extension provides the Data Plane API:
* - Control API: set of endpoints to trigger/monitor/cancel data transfers that should be accessible only from the Control Plane.
* - Public API: generic endpoint open to other participants of the Dataspace and used to proxy a data request to the actual data source.
* This extension provides generic endpoints which are open to public participants of the Dataspace to execute
* requests on the actual data source.
*/
@Extension(value = DataPlaneApiExtension.NAME)
public class DataPlaneApiExtension implements ServiceExtension {
public static final String NAME = "Data Plane API";
@Extension(value = DataPlanePublicApiExtension.NAME)
public class DataPlanePublicApiExtension implements ServiceExtension {
public static final String NAME = "Data Plane Public API";
private static final int DEFAULT_PUBLIC_PORT = 8185;
private static final String PUBLIC_API_CONFIG = "web.http.public";
private static final String PUBLIC_CONTEXT_ALIAS = "public";
Expand All @@ -62,9 +59,6 @@ public class DataPlaneApiExtension implements ServiceExtension {
@Inject
private WebServiceConfigurer webServiceConfigurer;

@Inject
private DataPlaneManager dataPlaneManager;

@Inject
private PipelineService pipelineService;

Expand All @@ -74,9 +68,6 @@ public class DataPlaneApiExtension implements ServiceExtension {
@Inject
private EdcHttpClient httpClient;

@Inject
private ControlApiConfiguration controlApiConfiguration;

@Inject
private TypeManager typeManager;

Expand All @@ -88,11 +79,7 @@ public String name() {
@Override
public void initialize(ServiceExtensionContext context) {
var validationEndpoint = context.getConfig().getString(CONTROL_PLANE_VALIDATION_ENDPOINT);

var dataAddressResolver = new ConsumerPullTransferDataAddressResolver(httpClient, validationEndpoint, typeManager.getMapper());

webService.registerResource(controlApiConfiguration.getContextAlias(), new DataPlaneControlApiController(dataPlaneManager));

var configuration = webServiceConfigurer.configure(context, webServer, PUBLIC_SETTINGS);
var publicApiController = new DataPlanePublicApiController(pipelineService, dataAddressResolver);
webService.registerResource(configuration.getContextAlias(), publicApiController);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Contributors:
* Amadeus - initial API and implementation
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - improvements
* Mercedes-Benz Tech Innovation GmbH - publish public api context into dedicated swagger hub page
*
*/

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.eclipse.edc.connector.dataplane.api.DataPlanePublicApiExtension
4 changes: 3 additions & 1 deletion launchers/data-plane-server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*
* Contributors:
* Microsoft Corporation - initial API and implementation
* Mercedes-Benz Tech Innovation GmbH - publish public api context into dedicated swagger hub page
*
*/

Expand All @@ -26,7 +27,8 @@ dependencies {
implementation(project(":extensions:common:http"))
implementation(project(":extensions:common:configuration:configuration-filesystem"))
implementation(project(":extensions:data-plane:data-plane-http"))
implementation(project(":extensions:data-plane:data-plane-api"))
implementation(project(":extensions:data-plane:data-plane-control-api"))
implementation(project(":extensions:data-plane:data-plane-public-api"))
}

application {
Expand Down
5 changes: 4 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* Fraunhofer Institute for Software and Systems Engineering - refactoring
* ZF Friedrichshafen AG - add dependency & reorder entries
* Fraunhofer Institute for Software and Systems Engineering - refactoring
* Mercedes-Benz Tech Innovation GmbH - publish public api context into dedicated swagger hub page
*
*/

Expand Down Expand Up @@ -169,8 +170,10 @@ include(":extensions:control-plane:callback:callback-http-dispatcher")
include(":extensions:control-plane:callback:callback-static-endpoint")


include(":extensions:data-plane:data-plane-api")
include(":extensions:data-plane:data-plane-client")
include(":extensions:data-plane:data-plane-common")
include(":extensions:data-plane:data-plane-control-api")
include(":extensions:data-plane:data-plane-public-api")

include(":extensions:data-plane:data-plane-http")
include(":extensions:data-plane:data-plane-http-oauth2")
Expand Down
Loading
Loading