From 7415ba5ae6d79dc71a3fd641f9d038cca3d5f0f5 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Tue, 30 Jul 2024 15:38:43 +0200 Subject: [PATCH] commented fileSize in the `uploadFile` and `uploadArchive` --- .../server/StorageHubClientService.java | 16 +++++++++++----- .../server/WorkspaceStorageHubClientService.java | 2 +- .../storagehubwrapper/server/tohl/Workspace.java | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/gcube/common/storagehubwrapper/server/StorageHubClientService.java b/src/main/java/org/gcube/common/storagehubwrapper/server/StorageHubClientService.java index 42f269a..3b86a44 100644 --- a/src/main/java/org/gcube/common/storagehubwrapper/server/StorageHubClientService.java +++ b/src/main/java/org/gcube/common/storagehubwrapper/server/StorageHubClientService.java @@ -506,11 +506,15 @@ public class StorageHubClientService { setContextProviders(scope, authorizationToken); FileContainer fileCont = null; + fileCont = shClient.open(folderId).asFolder().uploadFile(is, fileName, fileDescription); + + //TODO UNCOMMENT THIS CODE WHEN FILE SIZE IS OK + /* if (fileSize == null) fileCont = shClient.open(folderId).asFolder().uploadFile(is, fileName, fileDescription); else fileCont = shClient.open(folderId).asFolder().uploadFile(is, fileName, fileDescription, fileSize); - + */ return fileCont.get(); } @@ -571,10 +575,12 @@ public class StorageHubClientService { setContextProviders(scope, authorizationToken); FolderContainer folderCont = null; - if (fileSize == null) - folderCont = shClient.open(folderId).asFolder().uploadArchive(is, extractionFolderName); - else - folderCont = shClient.open(folderId).asFolder().uploadArchive(is, extractionFolderName, fileSize); + folderCont = shClient.open(folderId).asFolder().uploadArchive(is, extractionFolderName); + //TODO UNCOMMENT THIS CODE WHEN FILE SIZE IS OK +// if (fileSize == null) +// folderCont = shClient.open(folderId).asFolder().uploadArchive(is, extractionFolderName); +// else +// folderCont = shClient.open(folderId).asFolder().uploadArchive(is, extractionFolderName, fileSize); return folderCont.get(); } diff --git a/src/main/java/org/gcube/common/storagehubwrapper/server/WorkspaceStorageHubClientService.java b/src/main/java/org/gcube/common/storagehubwrapper/server/WorkspaceStorageHubClientService.java index 7613b5a..9228c1e 100644 --- a/src/main/java/org/gcube/common/storagehubwrapper/server/WorkspaceStorageHubClientService.java +++ b/src/main/java/org/gcube/common/storagehubwrapper/server/WorkspaceStorageHubClientService.java @@ -655,7 +655,7 @@ public final class WorkspaceStorageHubClientService implements Workspace{ */ @Override public WorkspaceItem uploadFile( - String folderId, InputStream is, String fileName, String fileDescription, long fileSize) + String folderId, InputStream is, String fileName, String fileDescription, Long fileSize) throws Exception { LOGGER.debug("called upload File"); diff --git a/src/main/java/org/gcube/common/storagehubwrapper/server/tohl/Workspace.java b/src/main/java/org/gcube/common/storagehubwrapper/server/tohl/Workspace.java index 4e19206..db27e5a 100644 --- a/src/main/java/org/gcube/common/storagehubwrapper/server/tohl/Workspace.java +++ b/src/main/java/org/gcube/common/storagehubwrapper/server/tohl/Workspace.java @@ -186,7 +186,7 @@ public interface Workspace { * @throws Exception the exception */ public WorkspaceItem uploadFile(String folderId, InputStream inputStream, String fileName, String fileDescription, - long fileSize) throws Exception; + Long fileSize) throws Exception; /** * Gets the shared folder members.