From 19ae7f2f661a0cc7bfa692a3cceba34996825bac Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Mon, 29 Jul 2024 16:02:57 +0200 Subject: [PATCH] - [#27898] Updated `uploadFile` and `uploadArchive` methods. They include the `fileSize` parameter --- CHANGELOG.md | 4 ++ pom.xml | 55 +++++++++++++------ .../NotificationsWorkspaceUploader.java | 1 - .../server/upload/WorkspaceUploaderMng.java | 7 ++- 4 files changed, 46 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d0f1366..7dac2b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v2.1.1-SNAPSHOT] - 2024-07-29 + +- [#27898] Updated `uploadFile` and `uploadArchive` methods. They include the `fileSize` parameter + ## [v2.1.0] - 2022-05-03 #### Enhancements diff --git a/pom.xml b/pom.xml index f571756..0ab27c8 100644 --- a/pom.xml +++ b/pom.xml @@ -1,10 +1,11 @@ - maven-parent org.gcube.tools - 1.1.0 + 1.2.0 @@ -12,7 +13,7 @@ org.gcube.portlets.widgets workspace-uploader jar - 2.1.0 + 2.1.1-SNAPSHOT Workspace Uploader Widget Workspace Uploader Widget allows your application to upload file/s in the gCube Workspace @@ -30,6 +31,7 @@ ${project.build.directory}/${project.build.finalName} UTF-8 UTF-8 + 3.7.0 @@ -37,26 +39,40 @@ org.gcube.distribution maven-portal-bom - 3.6.3 + ${maven-portal-bom} pom import + + - localRun - - - xerces - xerces - 2.4.0 - - + workspace-release-profile + + + Release + + + + 3.7.0 + + + + + workspace-snapshot-profile + + + !Release + + + + 3.8.0-SNAPSHOT + - @@ -117,7 +133,7 @@ storagehub-client-library provided - + org.gcube.common storagehub-client-wrapper @@ -131,7 +147,7 @@ json 20090211 - + commons-httpclient commons-httpclient @@ -143,6 +159,11 @@ provided + + commons-lang + commons-lang + + org.slf4j @@ -262,8 +283,8 @@ - - + + diff --git a/src/main/java/org/gcube/portlets/widgets/workspaceuploader/server/notification/NotificationsWorkspaceUploader.java b/src/main/java/org/gcube/portlets/widgets/workspaceuploader/server/notification/NotificationsWorkspaceUploader.java index 9ed67a4..479e3c8 100644 --- a/src/main/java/org/gcube/portlets/widgets/workspaceuploader/server/notification/NotificationsWorkspaceUploader.java +++ b/src/main/java/org/gcube/portlets/widgets/workspaceuploader/server/notification/NotificationsWorkspaceUploader.java @@ -3,7 +3,6 @@ */ package org.gcube.portlets.widgets.workspaceuploader.server.notification; -import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletRequest; diff --git a/src/main/java/org/gcube/portlets/widgets/workspaceuploader/server/upload/WorkspaceUploaderMng.java b/src/main/java/org/gcube/portlets/widgets/workspaceuploader/server/upload/WorkspaceUploaderMng.java index ebffe22..315c8b0 100644 --- a/src/main/java/org/gcube/portlets/widgets/workspaceuploader/server/upload/WorkspaceUploaderMng.java +++ b/src/main/java/org/gcube/portlets/widgets/workspaceuploader/server/upload/WorkspaceUploaderMng.java @@ -77,7 +77,8 @@ public class WorkspaceUploaderMng { Long startTime = WorkspaceUploadServletStream.printStartTime(); //UPLOAD - createdItem = storageWrapper.getWorkspace().uploadFile(destinationFolder.getId(), uploadFile, itemName, ""); + logger.info("calling upload file - [itemName: "+itemName+", totalBytes: "+totalBytes+"]"); + createdItem = storageWrapper.getWorkspace().uploadFile(destinationFolder.getId(), uploadFile, itemName, "", totalBytes); if(createdItem!=null){ WorkspaceUploadServletStream.printElapsedTime(startTime); @@ -199,13 +200,13 @@ public class WorkspaceUploaderMng { */ private static WorkspaceUploaderItem createWorkspaceUploaderArchive(StorageHubWrapper storageWrapper, final GCubeUser currUser, final String scopeGroupId, final WorkspaceUploaderItem workspaceUploader, final HttpServletRequest request, final InputStream uploadArchive, final String itemName, final WorkspaceFolder destinationFolder, final long totalBytes) throws InternalErrorException, IOException{ HttpSession httpSession = request.getSession(); - logger.info("calling upload archive - [itemName: "+itemName+"]"); + logger.info("calling upload archive - [itemName: "+itemName+", totalBytes: "+totalBytes+"]"); WorkspaceItem createdItem = null; try { workspaceUploader.setUploadStatus(UPLOAD_STATUS.IN_PROGRESS); workspaceUploader.setStatusDescription("Uploading "+itemName); - createdItem = storageWrapper.getWorkspace().uploadArchive(destinationFolder.getId(), uploadArchive, itemName); + createdItem = storageWrapper.getWorkspace().uploadArchive(destinationFolder.getId(), uploadArchive, itemName, totalBytes); if(createdItem!=null){ logger.debug("StorageHub"+createdItem.getName() + " with id: "+createdItem.getId() + " uploaded correctly in "+destinationFolder.getPath());