This is an automated email from the ASF dual-hosted git repository.
dimuthuupe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-mft.git
The following commit(s) were added to refs/heads/master by this push:
new b777c44 Refactoring storage and resource interfaces for database
backend
b777c44 is described below
commit b777c440a4b277d83a07d578fd241c14efd8eedf
Author: Dimuthu Wannipurage <[email protected]>
AuthorDate: Wed Mar 9 16:21:52 2022 -0500
Refactoring storage and resource interfaces for database backend
---
api/client/pom.xml | 10 ++
.../airavata/mft/api/client/MFTApiClient.java | 102 +++++++++++++++-
.../airavata/mft/api/client/examples/Example.java | 6 +-
.../airavata/mft/api/handler/MFTApiHandler.java | 2 +-
.../proto/{MFTApi.proto => MFTTransferApi.proto} | 2 +-
.../mft/examples/http/DownloadExample.java | 7 +-
.../airavata/mft/examples/metadata/SCPExample.java | 5 +-
.../mft/examples/transfer/LocalExample.java | 3 +-
.../airavata/mft/examples/transfer/S3Example.java | 3 +-
.../airavata/mft/examples/transfer/SCPExample.java | 3 +-
pom.xml | 2 +-
.../server/backend/sql/SQLResourceBackend.java | 129 ++++++++++++++++++---
.../backend/sql/entity/FTPResourceEntity.java | 74 ------------
.../backend/sql/entity/GenericResourceEntity.java | 76 ++++++++++++
.../backend/sql/entity/LocalResourceEntity.java | 55 ---------
.../backend/sql/entity/LocalStorageEntity.java | 19 +++
.../server/backend/sql/entity/S3StorageEntity.java | 70 +++++++++++
.../backend/sql/entity/SCPResourceEntity.java | 73 ------------
.../sql/repository/FTPResourceRepository.java | 27 -----
.../sql/repository/GenericResourceRepository.java | 13 +++
.../sql/repository/LocalResourceRepository.java | 27 -----
.../sql/repository/LocalStorageRepository.java | 7 ++
.../sql/repository/S3StorageRepository.java | 8 ++
.../sql/repository/SCPResourceRepository.java | 27 -----
.../stub/src/main/proto/azure/AzureStorage.proto | 1 +
.../stub/src/main/proto/box/BoxStorage.proto | 1 +
.../src/main/proto/dropbox/DropboxStorage.proto | 1 +
.../stub/src/main/proto/ftp/FTPStorage.proto | 1 +
.../stub/src/main/proto/gcs/GCSStorage.proto | 1 +
.../stub/src/main/proto/local/LocalStorage.proto | 1 +
.../src/main/proto/resource/ResourceService.proto | 12 ++
.../stub/src/main/proto/s3/S3Storage.proto | 7 ++
.../stub/src/main/proto/scp/SCPStorage.proto | 1 +
33 files changed, 457 insertions(+), 319 deletions(-)
diff --git a/api/client/pom.xml b/api/client/pom.xml
index d54623c..5d0d4ea 100644
--- a/api/client/pom.xml
+++ b/api/client/pom.xml
@@ -38,6 +38,16 @@
<artifactId>mft-api-stub</artifactId>
<version>0.01-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>mft-resource-service-client</artifactId>
+ <version>0.01-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>mft-secret-service-client</artifactId>
+ <version>0.01-SNAPSHOT</version>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
diff --git
a/api/client/src/main/java/org/apache/airavata/mft/api/client/MFTApiClient.java
b/api/client/src/main/java/org/apache/airavata/mft/api/client/MFTApiClient.java
index d103849..f328afa 100644
---
a/api/client/src/main/java/org/apache/airavata/mft/api/client/MFTApiClient.java
+++
b/api/client/src/main/java/org/apache/airavata/mft/api/client/MFTApiClient.java
@@ -20,6 +20,13 @@ package org.apache.airavata.mft.api.client;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import org.apache.airavata.mft.api.service.*;
+import org.apache.airavata.mft.resource.client.ResourceServiceClient;
+import org.apache.airavata.mft.resource.client.ResourceServiceClientBuilder;
+import org.apache.airavata.mft.resource.client.StorageServiceClient;
+import org.apache.airavata.mft.resource.client.StorageServiceClientBuilder;
+import
org.apache.airavata.mft.resource.stubs.common.GenericResourceServiceGrpc;
+import org.apache.airavata.mft.secret.client.SecretServiceClient;
+import org.apache.airavata.mft.secret.client.SecretServiceClientBuilder;
import java.io.Closeable;
import java.io.IOException;
@@ -29,14 +36,41 @@ import java.util.concurrent.ConcurrentHashMap;
public class MFTApiClient implements Closeable {
- private final ManagedChannel channel;
+ private ManagedChannel channel;
+ private ResourceServiceClient resourceServiceClient;
+ private StorageServiceClient storageServiceClient;
+ private SecretServiceClient secretServiceClient;
- public MFTApiClient(String hostName, int port) {
- channel = ManagedChannelBuilder.forAddress(hostName,
port).usePlaintext().build();
+ private String transferServiceHost;
+ private int transferServicePort;
+
+ private String resourceServiceHost;
+ private int resourceServicePort;
+
+ private String secretServiceHost;
+ private int secretServicePort;
+
+ public void init() {
+ channel = ManagedChannelBuilder.forAddress(transferServiceHost,
transferServicePort).usePlaintext().build();
+ resourceServiceClient =
ResourceServiceClientBuilder.buildClient(resourceServiceHost,
resourceServicePort);
+ storageServiceClient =
StorageServiceClientBuilder.buildClient(resourceServiceHost,
resourceServicePort);
+ secretServiceClient =
SecretServiceClientBuilder.buildClient(secretServiceHost, secretServicePort);
+ }
+
+ public MFTTransferServiceGrpc.MFTTransferServiceBlockingStub
getTransferClient() {
+ return MFTTransferServiceGrpc.newBlockingStub(channel);
+ }
+
+ public GenericResourceServiceGrpc.GenericResourceServiceBlockingStub
getResourceClient() {
+ return resourceServiceClient.get();
}
- public MFTApiServiceGrpc.MFTApiServiceBlockingStub get() {
- return MFTApiServiceGrpc.newBlockingStub(channel);
+ public StorageServiceClient getStorageServiceClient() {
+ return storageServiceClient;
+ }
+
+ public SecretServiceClient getSecretServiceClient() {
+ return secretServiceClient;
}
@Override
@@ -45,4 +79,62 @@ public class MFTApiClient implements Closeable {
channel.shutdown();
}
}
+
+ public static final class MFTApiClientBuilder {
+ private String transferServiceHost = "localhost";
+ private int transferServicePort = 7004;
+ private String resourceServiceHost = "localhost";
+ private int resourceServicePort = 7002;
+ private String secretServiceHost = "localhost";
+ private int secretServicePort = 7003;
+
+ private MFTApiClientBuilder() {
+ }
+
+ public static MFTApiClientBuilder newBuilder() {
+ return new MFTApiClientBuilder();
+ }
+
+ public MFTApiClientBuilder withTransferServiceHost(String
transferServiceHost) {
+ this.transferServiceHost = transferServiceHost;
+ return this;
+ }
+
+ public MFTApiClientBuilder withTransferServicePort(int
transferServicePort) {
+ this.transferServicePort = transferServicePort;
+ return this;
+ }
+
+ public MFTApiClientBuilder withResourceServiceHost(String
resourceServiceHost) {
+ this.resourceServiceHost = resourceServiceHost;
+ return this;
+ }
+
+ public MFTApiClientBuilder withResourceServicePort(int
resourceServicePort) {
+ this.resourceServicePort = resourceServicePort;
+ return this;
+ }
+
+ public MFTApiClientBuilder withSecretServiceHost(String
secretServiceHost) {
+ this.secretServiceHost = secretServiceHost;
+ return this;
+ }
+
+ public MFTApiClientBuilder withSecretServicePort(int
secretServicePort) {
+ this.secretServicePort = secretServicePort;
+ return this;
+ }
+
+ public MFTApiClient build() {
+ MFTApiClient mFTApiClient = new MFTApiClient();
+ mFTApiClient.transferServicePort = this.transferServicePort;
+ mFTApiClient.transferServiceHost = this.transferServiceHost;
+ mFTApiClient.secretServicePort = this.secretServicePort;
+ mFTApiClient.resourceServicePort = this.resourceServicePort;
+ mFTApiClient.secretServiceHost = this.secretServiceHost;
+ mFTApiClient.resourceServiceHost = this.resourceServiceHost;
+ mFTApiClient.init();
+ return mFTApiClient;
+ }
+ }
}
diff --git
a/api/client/src/main/java/org/apache/airavata/mft/api/client/examples/Example.java
b/api/client/src/main/java/org/apache/airavata/mft/api/client/examples/Example.java
index 808c913..52c7b60 100644
---
a/api/client/src/main/java/org/apache/airavata/mft/api/client/examples/Example.java
+++
b/api/client/src/main/java/org/apache/airavata/mft/api/client/examples/Example.java
@@ -1,14 +1,14 @@
package org.apache.airavata.mft.api.client.examples;
import org.apache.airavata.mft.api.client.MFTApiClient;
-import org.apache.airavata.mft.api.service.FetchResourceMetadataRequest;
-import org.apache.airavata.mft.api.service.MFTApiServiceGrpc;
+import org.apache.airavata.mft.api.service.MFTTransferServiceGrpc;
import org.apache.airavata.mft.api.service.ResourceAvailabilityRequest;
public class Example {
public static void main(String a[]) {
- MFTApiServiceGrpc.MFTApiServiceBlockingStub mftClient = new
MFTApiClient("localhost", 7004).get();
+ MFTTransferServiceGrpc.MFTTransferServiceBlockingStub mftClient =
MFTApiClient.MFTApiClientBuilder
+ .newBuilder().build().getTransferClient();
mftClient.getResourceAvailability(ResourceAvailabilityRequest.newBuilder()
.setResourceId("a")
.setResourceToken("b")
diff --git
a/api/service/src/main/java/org/apache/airavata/mft/api/handler/MFTApiHandler.java
b/api/service/src/main/java/org/apache/airavata/mft/api/handler/MFTApiHandler.java
index dbce2d2..cfca425 100644
---
a/api/service/src/main/java/org/apache/airavata/mft/api/handler/MFTApiHandler.java
+++
b/api/service/src/main/java/org/apache/airavata/mft/api/handler/MFTApiHandler.java
@@ -42,7 +42,7 @@ import java.util.Optional;
import java.util.UUID;
@GRpcService
-public class MFTApiHandler extends MFTApiServiceGrpc.MFTApiServiceImplBase {
+public class MFTApiHandler extends
MFTTransferServiceGrpc.MFTTransferServiceImplBase {
private static final Logger logger =
LoggerFactory.getLogger(MFTApiHandler.class);
diff --git a/api/stub/src/main/proto/MFTApi.proto
b/api/stub/src/main/proto/MFTTransferApi.proto
similarity index 99%
rename from api/stub/src/main/proto/MFTApi.proto
rename to api/stub/src/main/proto/MFTTransferApi.proto
index 0e2f145..4ddb90e 100644
--- a/api/stub/src/main/proto/MFTApi.proto
+++ b/api/stub/src/main/proto/MFTTransferApi.proto
@@ -124,7 +124,7 @@ message FetchResourceMetadataRequest {
org.apache.airavata.mft.common.AuthToken mftAuthorizationToken = 9;
}
-service MFTApiService {
+service MFTTransferService {
rpc submitTransfer(TransferApiRequest) returns (TransferApiResponse) {
option (google.api.http) = {
diff --git
a/examples/src/main/java/org/apache/airavata/mft/examples/http/DownloadExample.java
b/examples/src/main/java/org/apache/airavata/mft/examples/http/DownloadExample.java
index 31f8f02..77b3cb6 100644
---
a/examples/src/main/java/org/apache/airavata/mft/examples/http/DownloadExample.java
+++
b/examples/src/main/java/org/apache/airavata/mft/examples/http/DownloadExample.java
@@ -20,7 +20,7 @@ package org.apache.airavata.mft.examples.http;
import org.apache.airavata.mft.api.client.MFTApiClient;
import org.apache.airavata.mft.api.service.HttpDownloadApiRequest;
import org.apache.airavata.mft.api.service.HttpDownloadApiResponse;
-import org.apache.airavata.mft.api.service.MFTApiServiceGrpc;
+import org.apache.airavata.mft.api.service.MFTTransferServiceGrpc;
import org.apache.airavata.mft.common.AuthToken;
import org.apache.airavata.mft.common.UserTokenAuth;
@@ -28,8 +28,9 @@ public class DownloadExample {
public static void main(String args[]) {
AuthToken mftAuthorizationToken =
AuthToken.newBuilder().setUserTokenAuth(UserTokenAuth.newBuilder().setToken("43ff79ac-e4f2-473c-9ea1-04eee9509a53").build()).build();
- MFTApiServiceGrpc.MFTApiServiceBlockingStub client = new
MFTApiClient("localhost", 7004).get();
- HttpDownloadApiResponse httpDownloadApiResponse =
client.submitHttpDownload(HttpDownloadApiRequest.newBuilder()
+ MFTTransferServiceGrpc.MFTTransferServiceBlockingStub mftClient =
MFTApiClient.MFTApiClientBuilder
+ .newBuilder().build().getTransferClient();
+ HttpDownloadApiResponse httpDownloadApiResponse =
mftClient.submitHttpDownload(HttpDownloadApiRequest.newBuilder()
.setTargetAgent("agent0")
.setSourceResourceId("remote-ssh-resource")
.setSourceToken("local-ssh-cred")
diff --git
a/examples/src/main/java/org/apache/airavata/mft/examples/metadata/SCPExample.java
b/examples/src/main/java/org/apache/airavata/mft/examples/metadata/SCPExample.java
index 0a95ac1..f90a938 100644
---
a/examples/src/main/java/org/apache/airavata/mft/examples/metadata/SCPExample.java
+++
b/examples/src/main/java/org/apache/airavata/mft/examples/metadata/SCPExample.java
@@ -4,11 +4,12 @@ import org.apache.airavata.mft.api.client.MFTApiClient;
import org.apache.airavata.mft.api.service.DirectoryMetadataResponse;
import org.apache.airavata.mft.api.service.FetchResourceMetadataRequest;
import org.apache.airavata.mft.api.service.FileMetadataResponse;
-import org.apache.airavata.mft.api.service.MFTApiServiceGrpc;
+import org.apache.airavata.mft.api.service.MFTTransferServiceGrpc;
public class SCPExample {
public static void main(String args[]) throws Exception {
- MFTApiServiceGrpc.MFTApiServiceBlockingStub client = new
MFTApiClient("localhost", 7004).get();
+ MFTTransferServiceGrpc.MFTTransferServiceBlockingStub client =
MFTApiClient.MFTApiClientBuilder
+ .newBuilder().build().getTransferClient();
// File metadata
long startTime = System.currentTimeMillis();
diff --git
a/examples/src/main/java/org/apache/airavata/mft/examples/transfer/LocalExample.java
b/examples/src/main/java/org/apache/airavata/mft/examples/transfer/LocalExample.java
index 096cba9..4289c58 100644
---
a/examples/src/main/java/org/apache/airavata/mft/examples/transfer/LocalExample.java
+++
b/examples/src/main/java/org/apache/airavata/mft/examples/transfer/LocalExample.java
@@ -26,7 +26,8 @@ import java.util.Iterator;
public class LocalExample {
public static void main(String args[]) throws Exception {
- MFTApiServiceGrpc.MFTApiServiceBlockingStub client = new
MFTApiClient("localhost", 7004).get();
+ MFTTransferServiceGrpc.MFTTransferServiceBlockingStub client =
MFTApiClient.MFTApiClientBuilder
+ .newBuilder().build().getTransferClient();
String sourceResourceId = "remote-ssh-resource";
String sourceToken = "local-ssh-cred";
diff --git
a/examples/src/main/java/org/apache/airavata/mft/examples/transfer/S3Example.java
b/examples/src/main/java/org/apache/airavata/mft/examples/transfer/S3Example.java
index 6894b7e..63cd455 100644
---
a/examples/src/main/java/org/apache/airavata/mft/examples/transfer/S3Example.java
+++
b/examples/src/main/java/org/apache/airavata/mft/examples/transfer/S3Example.java
@@ -26,7 +26,8 @@ import java.util.Iterator;
public class S3Example {
public static void main(String args[]) throws Exception {
- MFTApiServiceGrpc.MFTApiServiceBlockingStub client = new
MFTApiClient("localhost", 7004).get();
+ MFTTransferServiceGrpc.MFTTransferServiceBlockingStub client =
MFTApiClient.MFTApiClientBuilder
+ .newBuilder().build().getTransferClient();
String sourceResourceId = "remote-ssh-storage";
String sourceResourcePath = "/tmp/1mb.txt";
diff --git
a/examples/src/main/java/org/apache/airavata/mft/examples/transfer/SCPExample.java
b/examples/src/main/java/org/apache/airavata/mft/examples/transfer/SCPExample.java
index c48119b..59591e3 100644
---
a/examples/src/main/java/org/apache/airavata/mft/examples/transfer/SCPExample.java
+++
b/examples/src/main/java/org/apache/airavata/mft/examples/transfer/SCPExample.java
@@ -26,7 +26,8 @@ import java.util.Iterator;
public class SCPExample {
public static void main(String args[]) throws Exception {
- MFTApiServiceGrpc.MFTApiServiceBlockingStub client = new
MFTApiClient("localhost", 7004).get();
+ MFTTransferServiceGrpc.MFTTransferServiceBlockingStub client =
MFTApiClient.MFTApiClientBuilder
+ .newBuilder().build().getTransferClient();
String sourceResourceId = "remote-ssh-resource-1";
String sourceResourcePath = "/tmp/1mb.txt";
diff --git a/pom.xml b/pom.xml
index d57ae7d..a2c70df 100755
--- a/pom.xml
+++ b/pom.xml
@@ -43,10 +43,10 @@
<modules>
<module>common</module>
<module>core</module>
+ <module>services</module>
<module>api</module>
<module>transport</module>
<module>agent</module>
- <module>services</module>
<module>controller</module>
<module>examples</module>
</modules>
diff --git
a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/SQLResourceBackend.java
b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/SQLResourceBackend.java
index f91bb7f..5703e91 100644
---
a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/SQLResourceBackend.java
+++
b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/SQLResourceBackend.java
@@ -33,7 +33,9 @@ import org.dozer.DozerBeanMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.repository.CrudRepository;
+import javax.el.ELException;
import java.util.Optional;
public class SQLResourceBackend implements ResourceBackend {
@@ -41,19 +43,19 @@ public class SQLResourceBackend implements ResourceBackend {
private static final Logger logger =
LoggerFactory.getLogger(SQLResourceBackend.class);
@Autowired
- private SCPStorageRepository scpStorageRepository;
+ private GenericResourceRepository resourceRepository;
@Autowired
- private SCPResourceRepository scpResourceRepository;
+ private SCPStorageRepository scpStorageRepository;
@Autowired
- private LocalResourceRepository localResourceRepository;
+ private S3StorageRepository s3StorageRepository;
@Autowired
- private FTPResourceRepository ftpResourceRepository;
+ private FTPStorageRepository ftpStorageRepository;
@Autowired
- private FTPStorageRepository ftpStorageRepository;
+ private LocalStorageRepository localStorageRepository;
private DozerBeanMapper mapper = new DozerBeanMapper();
@@ -69,11 +71,93 @@ public class SQLResourceBackend implements ResourceBackend {
@Override
public Optional<GenericResource>
getGenericResource(GenericResourceGetRequest request) throws Exception {
- throw new UnsupportedOperationException("Operation is not supported in
backend");
+ Optional<GenericResourceEntity> resourceEtyOp =
resourceRepository.findByResourceId(request.getResourceId());
+ if (resourceEtyOp.isPresent()) {
+
+ GenericResourceEntity resourceEty = resourceEtyOp.get();
+ GenericResource.Builder builder =
GenericResource.newBuilder();
+ builder.setResourceId(resourceEty.getResourceId());
+ switch (resourceEty.getResourceType()){
+ case DIRECTORY:
+
builder.setDirectory(DirectoryResource.newBuilder().setResourcePath(resourceEty.getResourcePath()).build());
+ break;
+ case FILE:
+
builder.setFile(FileResource.newBuilder().setResourcePath(resourceEty.getResourcePath()).build());
+ break;
+ }
+
+ switch (resourceEty.getStorageType()) {
+ case S3:
+ Optional<S3Storage> s3Storage =
getS3Storage(S3StorageGetRequest.newBuilder()
+ .setStorageId(resourceEty.getStorageId()).build());
+ builder.setS3Storage(s3Storage.orElseThrow(() -> new
Exception("Could not find a S3 storage with id "
+ + resourceEty.getStorageId() + " for resource " +
resourceEty.getResourceId())));
+ break;
+ case SCP:
+ Optional<SCPStorage> scpStorage =
getSCPStorage(SCPStorageGetRequest.newBuilder()
+ .setStorageId(resourceEty.getStorageId()).build());
+ builder.setScpStorage(scpStorage.orElseThrow(() -> new
Exception("Could not find a SCP storage with id "
+ + resourceEty.getStorageId() + " for resource " +
resourceEty.getResourceId())));
+ break;
+ case LOCAL:
+ Optional<LocalStorage> localStorage =
getLocalStorage(LocalStorageGetRequest.newBuilder()
+ .setStorageId(resourceEty.getStorageId()).build());
+ builder.setLocalStorage(localStorage.orElseThrow(() -> new
Exception("Could not find a Local storage with id "
+ + resourceEty.getStorageId() + " for resource " +
resourceEty.getResourceId())));
+ break;
+ case FTP:
+ Optional<FTPStorage> ftpStorage =
getFTPStorage(FTPStorageGetRequest.newBuilder()
+ .setStorageId(resourceEty.getStorageId()).build());
+ builder.setFtpStorage(ftpStorage.orElseThrow(() -> new
Exception("Could not find a FTP storage with id "
+ + resourceEty.getStorageId() + " for resource " +
resourceEty.getResourceId())));
+ break;
+ case BOX:
+ Optional<BoxStorage> boxStorage =
getBoxStorage(BoxStorageGetRequest.newBuilder()
+ .setStorageId(resourceEty.getStorageId()).build());
+ builder.setBoxStorage(boxStorage.orElseThrow(() -> new
Exception("Could not find a Box storage with id "
+ + resourceEty.getStorageId() + " for resource " +
resourceEty.getResourceId())));
+ break;
+ case DROPBOX:
+ Optional<DropboxStorage> dropBoxStorage =
getDropboxStorage(DropboxStorageGetRequest.newBuilder()
+ .setStorageId(resourceEty.getStorageId()).build());
+ builder.setDropboxStorage(dropBoxStorage.orElseThrow(() ->
new Exception("Could not find a Dropbox storage with id "
+ + resourceEty.getStorageId() + " for resource " +
resourceEty.getResourceId())));
+ break;
+ case GCS:
+ Optional<GCSStorage> gcsStorage =
getGCSStorage(GCSStorageGetRequest.newBuilder()
+ .setStorageId(resourceEty.getStorageId()).build());
+ builder.setGcsStorage(gcsStorage.orElseThrow(() -> new
Exception("Could not find a GCS storage with id "
+ + resourceEty.getStorageId() + " for resource " +
resourceEty.getResourceId())));
+ break;
+ case AZURE:
+ Optional<AzureStorage> azureStorage =
getAzureStorage(AzureStorageGetRequest.newBuilder()
+ .setStorageId(resourceEty.getStorageId()).build());
+ builder.setAzureStorage(azureStorage.orElseThrow(() -> new
Exception("Could not find a Azure storage with id "
+ + resourceEty.getStorageId() + " for resource " +
resourceEty.getResourceId())));
+ break;
+ }
+
+ return Optional.of(builder.build());
+ } else {
+ return Optional.empty();
+ }
}
@Override
public GenericResource createGenericResource(GenericResourceCreateRequest
request) throws Exception {
+
+ GenericResourceEntity entity = new GenericResourceEntity();
+ entity.setStorageId(request.getStorageId());
+
+ switch (request.getResourceCase()) {
+ case FILE:
+ entity.setResourcePath(request.getFile().getResourcePath());
+ break;
+ case DIRECTORY:
+
entity.setResourcePath(request.getDirectory().getResourcePath());
+ break;
+ }
+
throw new UnsupportedOperationException("Operation is not supported in
backend");
}
@@ -113,42 +197,52 @@ public class SQLResourceBackend implements
ResourceBackend {
@Override
public Optional<LocalStorage> getLocalStorage(LocalStorageGetRequest
request) throws Exception {
- throw new UnsupportedOperationException("Operation is not supported in
backend");
+ Optional<LocalStorageEntity> entity =
localStorageRepository.findById(request.getStorageId());
+ return entity.map(e -> mapper.map(e,
LocalStorage.newBuilder().getClass()).build());
}
@Override
public LocalStorage createLocalStorage(LocalStorageCreateRequest request)
throws Exception {
- throw new UnsupportedOperationException("Operation is not supported in
backend");
+ LocalStorageEntity savedEntity =
localStorageRepository.save(mapper.map(request, LocalStorageEntity.class));
+ return mapper.map(savedEntity,
LocalStorage.newBuilder().getClass()).build();
}
@Override
public boolean updateLocalStorage(LocalStorageUpdateRequest request)
throws Exception {
- throw new UnsupportedOperationException("Operation is not supported in
backend");
+ localStorageRepository.save(mapper.map(request,
LocalStorageEntity.class));
+ return true;
}
@Override
public boolean deleteLocalStorage(LocalStorageDeleteRequest request)
throws Exception {
- throw new UnsupportedOperationException("Operation is not supported in
backend");
+ localStorageRepository.deleteById(request.getStorageId());
+
resourceRepository.deleteByStorageIdAndStorageType(request.getStorageId(),
GenericResourceEntity.StorageType.LOCAL);
+ return true;
}
@Override
public Optional<S3Storage> getS3Storage(S3StorageGetRequest request)
throws Exception {
- throw new UnsupportedOperationException("Operation is not supported in
backend");
+ Optional<S3StorageEntity> entity =
s3StorageRepository.findById(request.getStorageId());
+ return entity.map(e -> mapper.map(e,
S3Storage.newBuilder().getClass()).build());
}
@Override
public S3Storage createS3Storage(S3StorageCreateRequest request) throws
Exception {
- throw new UnsupportedOperationException("Operation is not supported in
backend");
+ S3StorageEntity savedEntity =
s3StorageRepository.save(mapper.map(request, S3StorageEntity.class));
+ return mapper.map(savedEntity,
S3Storage.newBuilder().getClass()).build();
}
@Override
public boolean updateS3Storage(S3StorageUpdateRequest request) throws
Exception {
- throw new UnsupportedOperationException("Operation is not supported in
backend");
+ s3StorageRepository.save(mapper.map(request, S3StorageEntity.class));
+ return true;
}
@Override
public boolean deleteS3Storage(S3StorageDeleteRequest request) throws
Exception {
- throw new UnsupportedOperationException("Operation is not supported in
backend");
+ s3StorageRepository.deleteById(request.getStorageId());
+
resourceRepository.deleteByStorageIdAndStorageType(request.getStorageId(),
GenericResourceEntity.StorageType.S3);
+ return true;
}
@Override
@@ -233,8 +327,8 @@ public class SQLResourceBackend implements ResourceBackend {
@Override
public Optional<FTPStorage> getFTPStorage(FTPStorageGetRequest request) {
- Optional<FTPStorageEntity> storageEty =
ftpStorageRepository.findByStorageId(request.getStorageId());
- return storageEty.map(ftpStorageEntity -> mapper.map(ftpStorageEntity,
FTPStorage.newBuilder().getClass()).build());
+ Optional<FTPStorageEntity> entity =
ftpStorageRepository.findByStorageId(request.getStorageId());
+ return entity.map(e -> mapper.map(e,
FTPStorage.newBuilder().getClass()).build());
}
@Override
@@ -251,7 +345,8 @@ public class SQLResourceBackend implements ResourceBackend {
@Override
public boolean deleteFTPStorage(FTPStorageDeleteRequest request) {
- ftpResourceRepository.deleteById(request.getStorageId());
+ ftpStorageRepository.deleteById(request.getStorageId());
+
resourceRepository.deleteByStorageIdAndStorageType(request.getStorageId(),
GenericResourceEntity.StorageType.FTP);
return true;
}
diff --git
a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/FTPResourceEntity.java
b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/FTPResourceEntity.java
deleted file mode 100644
index 6f378aa..0000000
---
a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/FTPResourceEntity.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.airavata.mft.resource.server.backend.sql.entity;
-
-import org.hibernate.annotations.GenericGenerator;
-
-import javax.persistence.*;
-
-@Entity
-public class FTPResourceEntity {
-
- @Id
- @Column(name = "FTP_RESOURCE_ID")
- @GeneratedValue(generator = "uuid")
- @GenericGenerator(name = "uuid", strategy = "uuid2")
- private String resourceId;
-
- @Column(name = "FTP_STORAGE_ID")
- private String ftpStorageId;
-
- @ManyToOne(fetch = FetchType.EAGER)
- @JoinColumn(name = "FTP_STORAGE_ID", referencedColumnName =
"FTP_STORAGE_ID", nullable = false, insertable = false, updatable = false)
- private FTPStorageEntity ftpStorage;
-
- @Column(name = "RESOURCE_PATH")
- private String resourcePath;
-
- public String getResourceId() {
- return resourceId;
- }
-
- public void setResourceId(String resourceId) {
- this.resourceId = resourceId;
- }
-
- public String getFtpStorageId() {
- return ftpStorageId;
- }
-
- public void setFtpStorageId(String ftpStorageId) {
- this.ftpStorageId = ftpStorageId;
- }
-
- public FTPStorageEntity getFtpStorage() {
- return ftpStorage;
- }
-
- public void setFtpStorage(FTPStorageEntity ftpStorage) {
- this.ftpStorage = ftpStorage;
- }
-
- public String getResourcePath() {
- return resourcePath;
- }
-
- public void setResourcePath(String resourcePath) {
- this.resourcePath = resourcePath;
- }
-}
diff --git
a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/GenericResourceEntity.java
b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/GenericResourceEntity.java
new file mode 100644
index 0000000..12c8e69
--- /dev/null
+++
b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/GenericResourceEntity.java
@@ -0,0 +1,76 @@
+package org.apache.airavata.mft.resource.server.backend.sql.entity;
+
+import org.hibernate.annotations.GenericGenerator;
+
+import javax.persistence.Column;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+public class GenericResourceEntity {
+
+ public enum ResourceType {
+ FILE, DIRECTORY;
+ }
+
+ public enum StorageType {
+ S3, SCP, LOCAL, FTP, BOX, DROPBOX, GCS, AZURE;
+ }
+
+ @Id
+ @Column(name = "RESOURCE_ID")
+ @GeneratedValue(generator = "uuid")
+ @GenericGenerator(name = "uuid", strategy = "uuid2")
+ private String resourceId;
+
+ @Column(name = "RESOURCE_PATH")
+ private String resourcePath;
+
+ @Column(name = "RESOURCE_TYPE")
+ private ResourceType resourceType;
+
+ @Column(name = "STORAGE_ID")
+ private String storageId;
+
+ @Column(name = "STORAGE_TYPE")
+ private StorageType storageType;
+
+ public String getResourceId() {
+ return resourceId;
+ }
+
+ public void setResourceId(String resourceId) {
+ this.resourceId = resourceId;
+ }
+
+ public String getResourcePath() {
+ return resourcePath;
+ }
+
+ public void setResourcePath(String resourcePath) {
+ this.resourcePath = resourcePath;
+ }
+
+ public ResourceType getResourceType() {
+ return resourceType;
+ }
+
+ public void setResourceType(ResourceType resourceType) {
+ this.resourceType = resourceType;
+ }
+
+ public String getStorageId() {
+ return storageId;
+ }
+
+ public void setStorageId(String storageId) {
+ this.storageId = storageId;
+ }
+
+ public StorageType getStorageType() {
+ return storageType;
+ }
+
+ public void setStorageType(StorageType storageType) {
+ this.storageType = storageType;
+ }
+}
diff --git
a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/LocalResourceEntity.java
b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/LocalResourceEntity.java
deleted file mode 100644
index 2a8ed81..0000000
---
a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/LocalResourceEntity.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.airavata.mft.resource.server.backend.sql.entity;
-
-import org.hibernate.annotations.GenericGenerator;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-
-@Entity
-public class LocalResourceEntity {
-
-
- @Id
- @Column(name = "LOCAL_RESOURCE_ID")
- @GeneratedValue(generator = "uuid")
- @GenericGenerator(name = "uuid", strategy = "uuid2")
- private String resourceId;
-
- @Column(name = "RESOURCE_PATH")
- private String resourcePath;
-
- public String getResourceId() {
- return resourceId;
- }
-
- public void setResourceId(String resourceId) {
- this.resourceId = resourceId;
- }
-
- public String getResourcePath() {
- return resourcePath;
- }
-
- public void setResourcePath(String resourcePath) {
- this.resourcePath = resourcePath;
- }
-}
diff --git
a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/LocalStorageEntity.java
b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/LocalStorageEntity.java
new file mode 100644
index 0000000..4ca7735
--- /dev/null
+++
b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/LocalStorageEntity.java
@@ -0,0 +1,19 @@
+package org.apache.airavata.mft.resource.server.backend.sql.entity;
+
+import org.hibernate.annotations.GenericGenerator;
+
+import javax.persistence.Column;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+public class LocalStorageEntity {
+
+ @Id
+ @Column(name = "SCP_STORAGE_ID")
+ @GeneratedValue(generator = "uuid")
+ @GenericGenerator(name = "uuid", strategy = "uuid2")
+ private String storageId;
+
+ @Column(name = "AGENT_ID")
+ private String agentId;
+}
diff --git
a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/S3StorageEntity.java
b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/S3StorageEntity.java
new file mode 100644
index 0000000..a9c7f19
--- /dev/null
+++
b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/S3StorageEntity.java
@@ -0,0 +1,70 @@
+package org.apache.airavata.mft.resource.server.backend.sql.entity;
+
+import org.hibernate.annotations.GenericGenerator;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+@Entity
+public class S3StorageEntity {
+
+ @Id
+ @Column(name = "S3_STORAGE_ID")
+ @GeneratedValue(generator = "uuid")
+ @GenericGenerator(name = "uuid", strategy = "uuid2")
+ private String storageId;
+
+ @Column(name = "BUCKET_NAME")
+ private String bucketName;
+
+ @Column(name = "REGION")
+ private String region;
+
+ @Column(name = "ENDPOINT")
+ private String endpoint;
+
+ @Column(name = "USE_TLS")
+ private boolean useTLS;
+
+ public String getStorageId() {
+ return storageId;
+ }
+
+ public void setStorageId(String storageId) {
+ this.storageId = storageId;
+ }
+
+ public String getBucketName() {
+ return bucketName;
+ }
+
+ public void setBucketName(String bucketName) {
+ this.bucketName = bucketName;
+ }
+
+ public String getRegion() {
+ return region;
+ }
+
+ public void setRegion(String region) {
+ this.region = region;
+ }
+
+ public String getEndpoint() {
+ return endpoint;
+ }
+
+ public void setEndpoint(String endpoint) {
+ this.endpoint = endpoint;
+ }
+
+ public boolean isUseTLS() {
+ return useTLS;
+ }
+
+ public void setUseTLS(boolean useTLS) {
+ this.useTLS = useTLS;
+ }
+}
diff --git
a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/SCPResourceEntity.java
b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/SCPResourceEntity.java
deleted file mode 100644
index 63a6b32..0000000
---
a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/entity/SCPResourceEntity.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.airavata.mft.resource.server.backend.sql.entity;
-
-import org.hibernate.annotations.GenericGenerator;
-
-import javax.persistence.*;
-
-@Entity
-public class SCPResourceEntity {
-
- @Id
- @Column(name = "SCP_RESOURCE_ID")
- @GeneratedValue(generator = "uuid")
- @GenericGenerator(name = "uuid", strategy = "uuid2")
- private String resourceId;
-
- @Column(name = "SCP_STORAGE_ID")
- private String scpStorageId;
-
- @ManyToOne(fetch = FetchType.EAGER)
- @JoinColumn(name = "SCP_STORAGE_ID", referencedColumnName =
"SCP_STORAGE_ID", nullable = false, insertable = false, updatable = false)
- private SCPStorageEntity scpStorage;
-
- @Column(name = "RESOURCE_PATH")
- private String resourcePath;
-
- public String getResourceId() {
- return resourceId;
- }
-
- public void setResourceId(String resourceId) {
- this.resourceId = resourceId;
- }
-
- public SCPStorageEntity getScpStorage() {
- return scpStorage;
- }
-
- public void setScpStorage(SCPStorageEntity scpStorage) {
- this.scpStorage = scpStorage;
- }
-
- public String getResourcePath() {
- return resourcePath;
- }
-
- public void setResourcePath(String resourcePath) {
- this.resourcePath = resourcePath;
- }
-
- public String getScpStorageId() {
- return scpStorageId;
- }
-
- public void setScpStorageId(String scpStorageId) {
- this.scpStorageId = scpStorageId;
- }
-}
diff --git
a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/FTPResourceRepository.java
b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/FTPResourceRepository.java
deleted file mode 100644
index 53d0222..0000000
---
a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/FTPResourceRepository.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.airavata.mft.resource.server.backend.sql.repository;
-
-import
org.apache.airavata.mft.resource.server.backend.sql.entity.FTPResourceEntity;
-import org.springframework.data.repository.CrudRepository;
-
-import java.util.Optional;
-
-public interface FTPResourceRepository extends
CrudRepository<FTPResourceEntity, String> {
- Optional<FTPResourceEntity> findByResourceId(String resourceId);
-}
diff --git
a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/GenericResourceRepository.java
b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/GenericResourceRepository.java
new file mode 100644
index 0000000..36da35d
--- /dev/null
+++
b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/GenericResourceRepository.java
@@ -0,0 +1,13 @@
+package org.apache.airavata.mft.resource.server.backend.sql.repository;
+
+import
org.apache.airavata.mft.resource.server.backend.sql.entity.GenericResourceEntity;
+import org.springframework.data.repository.CrudRepository;
+
+import java.util.List;
+import java.util.Optional;
+
+public interface GenericResourceRepository extends
CrudRepository<GenericResourceEntity, String> {
+ public Optional<GenericResourceEntity> findByResourceId(String resourceId);
+ public List<GenericResourceEntity> findByStorageId(String storageId);
+ public void deleteByStorageIdAndStorageType(String storageId,
GenericResourceEntity.StorageType storageType);
+}
diff --git
a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/LocalResourceRepository.java
b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/LocalResourceRepository.java
deleted file mode 100644
index cd062fc..0000000
---
a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/LocalResourceRepository.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.airavata.mft.resource.server.backend.sql.repository;
-
-import
org.apache.airavata.mft.resource.server.backend.sql.entity.LocalResourceEntity;
-import org.springframework.data.repository.CrudRepository;
-
-import java.util.Optional;
-
-public interface LocalResourceRepository extends
CrudRepository<LocalResourceEntity, String> {
- Optional<LocalResourceEntity> findByResourceId(String resourceId);
-}
diff --git
a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/LocalStorageRepository.java
b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/LocalStorageRepository.java
new file mode 100644
index 0000000..7761148
--- /dev/null
+++
b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/LocalStorageRepository.java
@@ -0,0 +1,7 @@
+package org.apache.airavata.mft.resource.server.backend.sql.repository;
+
+import
org.apache.airavata.mft.resource.server.backend.sql.entity.LocalStorageEntity;
+import org.springframework.data.repository.CrudRepository;
+
+public interface LocalStorageRepository extends
CrudRepository<LocalStorageEntity, String> {
+}
diff --git
a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/S3StorageRepository.java
b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/S3StorageRepository.java
new file mode 100644
index 0000000..f879189
--- /dev/null
+++
b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/S3StorageRepository.java
@@ -0,0 +1,8 @@
+package org.apache.airavata.mft.resource.server.backend.sql.repository;
+
+import
org.apache.airavata.mft.resource.server.backend.sql.entity.S3StorageEntity;
+import org.springframework.data.repository.CrudRepository;
+
+public interface S3StorageRepository extends CrudRepository<S3StorageEntity,
String> {
+
+}
diff --git
a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/SCPResourceRepository.java
b/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/SCPResourceRepository.java
deleted file mode 100644
index 5f3a0bc..0000000
---
a/services/resource-service/server/src/main/java/org/apache/airavata/mft/resource/server/backend/sql/repository/SCPResourceRepository.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.airavata.mft.resource.server.backend.sql.repository;
-
-import
org.apache.airavata.mft.resource.server.backend.sql.entity.SCPResourceEntity;
-import org.springframework.data.repository.CrudRepository;
-
-import java.util.Optional;
-
-public interface SCPResourceRepository extends
CrudRepository<SCPResourceEntity, String> {
- Optional<SCPResourceEntity> findByResourceId(String resourceId);
-}
diff --git
a/services/resource-service/stub/src/main/proto/azure/AzureStorage.proto
b/services/resource-service/stub/src/main/proto/azure/AzureStorage.proto
index 7893c44..960225d 100644
--- a/services/resource-service/stub/src/main/proto/azure/AzureStorage.proto
+++ b/services/resource-service/stub/src/main/proto/azure/AzureStorage.proto
@@ -31,6 +31,7 @@ message AzureStorageGetRequest {
message AzureStorageCreateRequest {
string container = 1;
+ string storageId = 2;
}
message AzureStorageUpdateRequest {
diff --git a/services/resource-service/stub/src/main/proto/box/BoxStorage.proto
b/services/resource-service/stub/src/main/proto/box/BoxStorage.proto
index c198706..aec0555 100644
--- a/services/resource-service/stub/src/main/proto/box/BoxStorage.proto
+++ b/services/resource-service/stub/src/main/proto/box/BoxStorage.proto
@@ -29,6 +29,7 @@ message BoxStorageGetRequest {
}
message BoxStorageCreateRequest {
+ string storageId = 1;
}
message BoxStorageUpdateRequest {
diff --git
a/services/resource-service/stub/src/main/proto/dropbox/DropboxStorage.proto
b/services/resource-service/stub/src/main/proto/dropbox/DropboxStorage.proto
index dd8b18f..26cfc11 100644
--- a/services/resource-service/stub/src/main/proto/dropbox/DropboxStorage.proto
+++ b/services/resource-service/stub/src/main/proto/dropbox/DropboxStorage.proto
@@ -29,6 +29,7 @@ message DropboxStorageGetRequest {
}
message DropboxStorageCreateRequest {
+ string storageId = 4;
}
message DropboxStorageUpdateRequest {
diff --git a/services/resource-service/stub/src/main/proto/ftp/FTPStorage.proto
b/services/resource-service/stub/src/main/proto/ftp/FTPStorage.proto
index 51ec2ff..6c1dd56 100644
--- a/services/resource-service/stub/src/main/proto/ftp/FTPStorage.proto
+++ b/services/resource-service/stub/src/main/proto/ftp/FTPStorage.proto
@@ -33,6 +33,7 @@ message FTPStorageGetRequest {
message FTPStorageCreateRequest {
string host = 1;
int32 port = 2;
+ string storageId = 3;
}
message FTPStorageUpdateRequest {
diff --git a/services/resource-service/stub/src/main/proto/gcs/GCSStorage.proto
b/services/resource-service/stub/src/main/proto/gcs/GCSStorage.proto
index b974245..a74b574 100644
--- a/services/resource-service/stub/src/main/proto/gcs/GCSStorage.proto
+++ b/services/resource-service/stub/src/main/proto/gcs/GCSStorage.proto
@@ -31,6 +31,7 @@ message GCSStorageGetRequest {
message GCSStorageCreateRequest {
string bucketName = 1;
+ string storageId = 2;
}
message GCSStorageUpdateRequest {
diff --git
a/services/resource-service/stub/src/main/proto/local/LocalStorage.proto
b/services/resource-service/stub/src/main/proto/local/LocalStorage.proto
index 9b9e9b9..2f9ffe5 100644
--- a/services/resource-service/stub/src/main/proto/local/LocalStorage.proto
+++ b/services/resource-service/stub/src/main/proto/local/LocalStorage.proto
@@ -31,6 +31,7 @@ message LocalStorageGetRequest {
message LocalStorageCreateRequest {
string agentId = 1;
+ string storageId = 2;
}
message LocalStorageUpdateRequest {
diff --git
a/services/resource-service/stub/src/main/proto/resource/ResourceService.proto
b/services/resource-service/stub/src/main/proto/resource/ResourceService.proto
index 10f0372..86234cf 100644
---
a/services/resource-service/stub/src/main/proto/resource/ResourceService.proto
+++
b/services/resource-service/stub/src/main/proto/resource/ResourceService.proto
@@ -73,6 +73,18 @@ message GenericResourceCreateRequest {
org.apache.airavata.mft.resource.stubs.common.DirectoryResource
directory = 3;
}
org.apache.airavata.mft.common.AuthToken authzToken = 4;
+ enum StorageType {
+ S3 = 0;
+ SCP = 1;
+ FTP = 2;
+ LOCAL = 3;
+ BOX = 4;
+ DROPBOX = 5;
+ GCS = 6;
+ AZURE = 7;
+ }
+
+ StorageType storageType = 5;
}
message GenericResourceUpdateRequest {
diff --git a/services/resource-service/stub/src/main/proto/s3/S3Storage.proto
b/services/resource-service/stub/src/main/proto/s3/S3Storage.proto
index 4a51221..34b9ba7c 100644
--- a/services/resource-service/stub/src/main/proto/s3/S3Storage.proto
+++ b/services/resource-service/stub/src/main/proto/s3/S3Storage.proto
@@ -24,6 +24,8 @@ message S3Storage {
string storageId = 1;
string bucketName = 2;
string region = 3;
+ string endpoint = 4;
+ bool useTLS = 5;
}
message S3StorageGetRequest {
@@ -33,12 +35,17 @@ message S3StorageGetRequest {
message S3StorageCreateRequest {
string bucketName = 1;
string region = 2;
+ string storageId = 3;
+ string endpoint = 4;
+ bool useTLS = 5;
}
message S3StorageUpdateRequest {
string storageId = 1;
string bucketName = 2;
string region = 3;
+ string endpoint = 4;
+ bool useTLS = 5;
}
message S3StorageDeleteRequest {
diff --git a/services/resource-service/stub/src/main/proto/scp/SCPStorage.proto
b/services/resource-service/stub/src/main/proto/scp/SCPStorage.proto
index 4c9c531..163c0dc 100644
--- a/services/resource-service/stub/src/main/proto/scp/SCPStorage.proto
+++ b/services/resource-service/stub/src/main/proto/scp/SCPStorage.proto
@@ -34,6 +34,7 @@ message SCPStorageCreateRequest {
string host = 1;
int32 port = 2;
string user = 3;
+ string storageId = 4;
}
message SCPStorageUpdateRequest {