Skip to content

Commit

Permalink
Merge pull request #107 from amosproj/data-transfer-dk
Browse files Browse the repository at this point in the history
Data transfer Implemented
  • Loading branch information
daku-de authored Jul 16, 2024
2 parents b95da09 + e94fbb4 commit 03415a3
Show file tree
Hide file tree
Showing 61 changed files with 996 additions and 295 deletions.
2 changes: 1 addition & 1 deletion src/database/bank_database.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ EXPOSE 8080

ENV CONNECTOR_NAME=bank

RUN ./gradlew build
RUN gradle build

CMD ["java", "-jar", "build/libs/filestorage-database.jar"]

2 changes: 1 addition & 1 deletion src/database/company_database.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ EXPOSE 8080

ENV CONNECTOR_NAME=company

RUN ./gradlew build
RUN gradle build

CMD ["java", "-jar", "build/libs/filestorage-database.jar"]

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package de.uni1.amos.filestorage.controller;

import de.uni1.amos.filestorage.entity.ContractAgreement;
import de.uni1.amos.filestorage.service.ContractAgreementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;

@RestController
@RequestMapping("/contracts")
public class ContractAgreementController {

@Autowired
private ContractAgreementService contractAgreementService;

@PostMapping("/store")
public ResponseEntity<String> uploadFile(@RequestBody ContractAgreement contract) throws IOException {
contractAgreementService.saveContract(contract);
return new ResponseEntity<>("Contract saved!", HttpStatus.OK);
}

@GetMapping("/get/{id}")
public ResponseEntity<Object> getContract(@PathVariable String id) {
ContractAgreement contract = contractAgreementService.getContractAgreement(id);
if (contract == null) {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
return new ResponseEntity<>(contract, HttpStatus.OK);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package de.uni1.amos.filestorage.entity;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;

@Entity
public class ContractAgreement {

@Id
private String id;

private String fileName;

private String fileSize;

private String title;

private String date;

private String author;

private String contenttype;


public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public String getFileName() {
return fileName;
}

public void setFileName(String fileName) {
this.fileName = fileName;
}

public void setFileSize(String fileSize) {
this.fileSize = fileSize;
}

public String getFileSize() {
return fileSize;
}

public void setTitle(String title) {
this.title = title;
}

public String getTitle() {
return title;
}

public void setDate(String date) {
this.date = date;
}

public String getDate() {
return date;
}

public void setAuthor(String author) {
this.author = author;
}

public String getAuthor() {
return author;
}

public void setContenttype(String contenttype) {
this.contenttype = contenttype;
}

public String getContenttype() {
return contenttype;
}

}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package de.uni1.amos.filestorage.entity;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Lob;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package de.uni1.amos.filestorage.repository;

import de.uni1.amos.filestorage.entity.ContractAgreement;
import org.springframework.data.jpa.repository.JpaRepository;

public interface ContractAgreementRepository extends JpaRepository<ContractAgreement, String> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package de.uni1.amos.filestorage.service;

import de.uni1.amos.filestorage.repository.ContractAgreementRepository;
import de.uni1.amos.filestorage.entity.ContractAgreement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.IOException;

@Service
public class ContractAgreementService {

@Autowired
private ContractAgreementRepository contractRepository;

public ContractAgreement saveContract(ContractAgreement contract) throws IOException {
return contractRepository.save(contract);
}

public ContractAgreement getContractAgreement(String id) {
return contractRepository.findById(id).orElse(null);
}

}
2 changes: 1 addition & 1 deletion src/database/taxadvisor_database.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ EXPOSE 8080

ENV CONNECTOR_NAME=taxadvisor

RUN ./gradlew build
RUN gradle build

CMD ["java", "-jar", "build/libs/filestorage-database.jar"]

6 changes: 4 additions & 2 deletions src/edc-connector/bank_connector.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ EXPOSE 19193
EXPOSE 19194
EXPOSE 19291

RUN ./gradlew connector:build
RUN gradle connector:build

CMD ["java", "-Dedc.keystore=resources/certs/cert.pfx", "-Dedc.keystore.password=123456", "-Dedc.vault=resources/configuration/bank-vault.properties", "-Dedc.fs.config=resources/configuration/bank-configuration.properties", "-jar", "connector/build/libs/connector.jar"]
ENV EDC_FS_CONFIG=resources/configuration/bank-configuration.properties

CMD ["java", "-jar", "connector/build/libs/connector.jar"]

6 changes: 4 additions & 2 deletions src/edc-connector/company_connector.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ EXPOSE 19193
EXPOSE 19194
EXPOSE 19291

RUN ./gradlew connector:build
RUN gradle connector:build

CMD ["java", "-Dedc.keystore=resources/certs/cert.pfx", "-Dedc.keystore.password=123456", "-Dedc.vault=resources/configuration/company-vault.properties", "-Dedc.fs.config=resources/configuration/company-configuration.properties", "-jar", "connector/build/libs/connector.jar"]
ENV EDC_FS_CONFIG=resources/configuration/company-configuration.properties

CMD ["java", "-jar", "connector/build/libs/connector.jar"]

1 change: 1 addition & 0 deletions src/edc-connector/connector/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ plugins {
}

dependencies {
implementation(libs.edc.control.api.configuration)
implementation(libs.edc.control.plane.api.client)
implementation(libs.edc.control.plane.api)
implementation(libs.edc.control.plane.core)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/*
* 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.extension.runtime;

import org.eclipse.edc.runtime.metamodel.annotation.Inject;
import org.eclipse.edc.spi.security.Vault;
import org.eclipse.edc.spi.system.ServiceExtension;
import org.eclipse.edc.spi.system.ServiceExtensionContext;

public class SeedVaultExtension implements ServiceExtension {

@Inject
private Vault vault;

private static final String PUBLIC_KEY = """
-----BEGIN CERTIFICATE-----
MIIDazCCAlOgAwIBAgIUZ3/sZXYzW4PjmOXKrZn6WBmUJ+4wDQYJKoZIhvcNAQEL
BQAwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxITAfBgNVBAoM
GEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDAeFw0yMjAyMjMxNTA2MDNaFw0zMjAy
MjExNTA2MDNaMEUxCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEw
HwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggEiMA0GCSqGSIb3DQEB
AQUAA4IBDwAwggEKAoIBAQDBl6XaJnXTL+6DWip3aBhU+MzmY4d1V9hbTm1tiZ3g
E0VbUrvGO3LoYaxpPv6zFmsg3uJv6JxVAde7EddidN0ITHB9cQNdAfdUJ5njmsGS
PbdQuOQTHw0aG7/QvTI/nsvfEE6e0lbV/0e7DHacZT/+OztBH1RwkG2ymM94Hf8H
I6x7q6yfRTAZOqeOMrPCYTcluAgE9NskoPvjX5qASakBtXISKIsOU84N0/2HDN3W
EGMXvoHUQu6vrij6BwiwxKaw1AKwWENKoga775bPXN3M+JTSaIKE7dZbKzvx0Zi0
h5X+bxc3BJi3Z/CsUBCzE+Y0SFetOiYmyl/2YmnneYoVAgMBAAGjUzBRMB0GA1Ud
DgQWBBTvK1wVERwjni4B2vdH7KtEJeVWFzAfBgNVHSMEGDAWgBTvK1wVERwjni4B
2vdH7KtEJeVWFzAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQBn
QHiPA7OBYukHd9gS7c0HXE+fsWcS3GZeLqcHfQQnV3pte1vTmu9//IVW71wNCJ1/
rySRyODPQoPehxEcyHwupNZSzXK//nPlTdSgjMfFxscvt1YndyQLQYCfyOJMixAe
Aqrb14GTFHUUrdor0PyElhkULjkOXUrSIsdBrfWrwLTkelE8NK3tb5ZG8KPzD9Jy
+NwEPPr9d+iHkUkM7EFWw/cl56wka9ryBb97RI7DqbO6/j6OXHMk4GByxKv7DSIR
IvF9/Dw20qytajtaHV0pluFcOBuFc0NfiDvCaQlbTsfjzbc6UmZWbOi9YOJl3VQ/
g3h+15GuzbsSzOCOEYOT
-----END CERTIFICATE-----
""";

private static final String PRIVATE_KEY = """
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDBl6XaJnXTL+6D
Wip3aBhU+MzmY4d1V9hbTm1tiZ3gE0VbUrvGO3LoYaxpPv6zFmsg3uJv6JxVAde7
EddidN0ITHB9cQNdAfdUJ5njmsGSPbdQuOQTHw0aG7/QvTI/nsvfEE6e0lbV/0e7
DHacZT/+OztBH1RwkG2ymM94Hf8HI6x7q6yfRTAZOqeOMrPCYTcluAgE9NskoPvj
X5qASakBtXISKIsOU84N0/2HDN3WEGMXvoHUQu6vrij6BwiwxKaw1AKwWENKoga7
75bPXN3M+JTSaIKE7dZbKzvx0Zi0h5X+bxc3BJi3Z/CsUBCzE+Y0SFetOiYmyl/2
YmnneYoVAgMBAAECggEBAJHXiN6bctAyn+DcoHlsNkhtVw+Jk5bXIutGXjHTJtiU
K//siAGC78IZMyXmi0KndPVCdBwShROVW8xWWIiXuZxy2Zvm872xqX4Ah3JsN7/Q
NrXdVBUDo38zwIGkxqIfIz9crZ4An+J/eq5zaTfRHzCLtswMqjRS2hFeBY5cKrBY
4bkSDGTP/c5cP7xS/UwaiTR2Ptd41f4zTyd4l5rl30TYHpazQNlbdxcOV4jh2Rnp
E0+cFEvEfeagVq7RmfBScKG5pk4qcRG0q2QHMyK5y00hdYvhdRjSgN7xIDkeO5B8
s8/tSLU78nCl2gA9IKxTXYLitpISwZ81Q04mEAKRRtECgYEA+6lKnhn//aXerkLo
ZOLOjWQZhh005jHdNxX7DZqLpTrrfxc8v15KWUkAK1H0QHqYvfPrbbsBV1MY1xXt
sKmkeu/k8fJQzCIvFN4K2J5W5kMfq9PSw5d3XPeDaQuXUVaxBVp0gzPEPHmkKRbA
AkUqY0oJwA9gMKf8dK+flmLZfbsCgYEAxO4Roj2G46/Oox1GEZGxdLpiMpr9rEdR
JlSZ9kMGfddNLV7sFp6yPXDcyc/AOqeNj7tw1MyoT3Ar454+V0q83EZzCXvs4U6f
jUrfFcoVWIwf9AV/J4KWzMIzfqPIeNwqymZKd6BrZgcXXvAEPWt27mwO4a1GhC4G
oZv0t3lAsm8CgYAQ8C0IhSF4tgBN5Ez19VoHpDQflbmowLRt77nNCZjajyOokyzQ
iI0ig0pSoBp7eITtTAyNfyew8/PZDi3IVTKv35OeQTv08VwP4H4EZGve5aetDf3C
kmBDTpl2qYQOwnH5tUPgTMypcVp+NXzI6lTXB/WuCprjy3qvc96e5ZpT3wKBgQC8
Xny/k9rTL/eYTwgXBiWYYjBL97VudUlKQOKEjNhIxwkrvQBXIrWbz7lh0Tcu49al
BcaHxru4QLO6pkM7fGHq0fh3ufJ8EZjMrjF1xjdk26Q05o0aXe+hLKHVIRVBhlfo
ArB4fRo+HcpdJXjox0KcDQCvHe+1v9DYBTWvymv4QQKBgBy3YH7hKz35DcXvA2r4
Kis9a4ycuZqTXockO4rkcIwC6CJp9JbHDIRzig8HYOaRqmZ4a+coqLmddXr2uOF1
7+iAxxG1KzdT6uFNd+e/j2cdUjnqcSmz49PRtdDswgyYhoDT+W4yVGNQ4VuKg6a3
Z3pC+KTdoHSKeA2FyAGnSUpD
-----END PRIVATE KEY-----
""";

@Override
public void initialize(ServiceExtensionContext context) {
vault.storeSecret("public-key", PUBLIC_KEY);
vault.storeSecret("private-key", PRIVATE_KEY);
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
org.eclipse.edc.extension.status.StatusEndpointExtension
org.eclipse.edc.extension.bootstrap.BootstrapLoaderExtension
org.eclipse.edc.extension.policy.PolicyFunctionsExtension
org.eclipse.edc.extension.policy.PolicyFunctionsExtension
org.eclipse.edc.extension.runtime.SeedVaultExtension
5 changes: 3 additions & 2 deletions src/edc-connector/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ format.version = "1.1"
[versions]
assertj = "3.25.3"
awaitility = "4.2.1"
edc = "0.7.0"
edc = "0.7.1"
jakarta-json = "2.0.1"
junit-pioneer = "2.2.0"
jupiter = "5.10.2"
Expand All @@ -26,10 +26,11 @@ edc-configuration-filesystem = { module = "org.eclipse.edc:configuration-filesys
edc-connector-core = { module = "org.eclipse.edc:connector-core", version.ref = "edc" }
edc-control-plane-api-client = { module = "org.eclipse.edc:control-plane-api-client", version.ref = "edc" }
edc-control-plane-api = { module = "org.eclipse.edc:control-plane-api", version.ref = "edc" }
edc-control-api-configuration = { module = "org.eclipse.edc:control-api-configuration", version.ref = "edc" }
edc-control-plane-core = { module = "org.eclipse.edc:control-plane-core", version.ref = "edc" }
edc-control-plane-spi = { module = "org.eclipse.edc:control-plane-spi", version.ref = "edc" }
edc-data-plane-control-api = { module = "org.eclipse.edc:data-plane-control-api", version.ref = "edc" }
edc-data-plane-public-api = { module = "org.eclipse.edc:data-plane-public-api", version.ref = "edc" }
edc-data-plane-public-api = { module = "org.eclipse.edc:data-plane-public-api-v2", version.ref = "edc" }
edc-data-plane-aws-s3 = { module = "org.eclipse.edc:data-plane-aws-s3", version.ref = "edc" }
edc-data-plane-azure-storage = { module = "org.eclipse.edc:data-plane-azure-storage", version.ref = "edc" }
edc-data-plane-client = { module = "org.eclipse.edc:data-plane-client", version.ref = "edc" }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
edc.api.auth.key=bank-pass
edc.connector.name=bank
edc.participant.id=bank
edc.dsp.callback.address=http://localhost:19194/protocol

edc.api.auth.key=bank-pass

edc.dsp.callback.address=http://bank:19194/protocol
edc.dataplane.api.public.baseurl=http://bank:19291/public
edc.dataplane.token.validation.endpoint=http://bank:19192/control/token

edc.keystore=resources/certs/cert.pfx
edc.keystore.password=123456

edc.transfer.proxy.token.signer.privatekey.alias=private-key
edc.transfer.proxy.token.verifier.publickey.alias=public-key

web.http.port=19191
web.http.path=/connector-api
web.http.control.port=19192
web.http.control.path=/control
web.http.management.port=19193
web.http.management.path=/management
web.http.protocol.port=19194
web.http.protocol.path=/protocol
edc.receiver.http.endpoint=http://localhost:4000/receiver/urn:connector:provider/callback
edc.public.key.alias=public-key
edc.transfer.dataplane.token.signer.privatekey.alias=1
edc.transfer.proxy.token.signer.privatekey.alias=1
edc.transfer.proxy.token.verifier.publickey.alias=public-key
web.http.public.port=19291
web.http.public.path=/public
web.http.control.port=19192
web.http.control.path=/control
edc.dataplane.token.validation.endpoint=http://localhost:19192/control/token
web.http.public.path=/public

This file was deleted.

Loading

0 comments on commit 03415a3

Please sign in to comment.