From 89d265969e2911b7bf2cb0082c3cb0aa0327a85d Mon Sep 17 00:00:00 2001 From: Francesco Mangiacrapa Date: Mon, 14 Mar 2016 14:28:56 +0000 Subject: [PATCH] Updated distro as reported here: https://wiki.gcube-system.org/gcube/Maven_distro_directory_layout git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-uploader@125050 82a268e6-3cf1-43bd-a215-b396298e98cf --- distro/INSTALL | 0 distro/MAINTAINERS | 4 - distro/README | 90 +++++++++++-------- distro/svnpath.txt | 1 - pom.xml | 1 + .../server/upload/WorkspaceUploaderMng.java | 46 +++++----- 6 files changed, 77 insertions(+), 65 deletions(-) delete mode 100644 distro/INSTALL delete mode 100644 distro/MAINTAINERS delete mode 100644 distro/svnpath.txt diff --git a/distro/INSTALL b/distro/INSTALL deleted file mode 100644 index e69de29..0000000 diff --git a/distro/MAINTAINERS b/distro/MAINTAINERS deleted file mode 100644 index d43c386..0000000 --- a/distro/MAINTAINERS +++ /dev/null @@ -1,4 +0,0 @@ -Mantainers -------- - -* Francesco Mangiacrapa (francesco.mangiacrapa@isti.cnr.it), CNR Pisa, Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" diff --git a/distro/README b/distro/README index 2e54890..68303ff 100644 --- a/distro/README +++ b/distro/README @@ -1,44 +1,60 @@ -The gCube System - Workspace Uploader ------------------------------------------------------------- - -This work has been partially supported by the following European projects: DILIGENT (FP6-2003-IST-2), -D4Science (FP7-INFRA-2007-1.2.2), D4Science-II (FP7-INFRA-2008-1.2.2), iMarine (FP7-INFRASTRUCTURES-2011-2), -and EUBrazilOpenBio (FP7-ICT-2011-EU-Brazil), Parthenos (H2020-INFRADEV-1-2014-1), BlueBridge (H2020-EINFRA-2015-1) - - -Authors -------- - -* Francesco Mangiacrapa (francesco.mangiacrapa@isti.cnr.it), CNR Pisa, - Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo". - - -Version and Release Date ------------------------- - -v. 1.1.0 January 2016 +The gCube System - ${name} +-------------------------------------------------- - -Description +${description} + + +${gcube.description} + +${gcube.funding} + + +Version +-------------------------------------------------- + +${version} (${buildDate}) + +Please see the file named "changelog.xml" in this directory for the release notes. + + +Authors +-------------------------------------------------- + +* Francesco Mangiacrapa (francesco.mangiacrapa-AT-isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy). + +Maintainers ----------- - -The Workspace Uploader - + +* Francesco Mangiacrapa (francesco.mangiacrapa-AT-isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy). + Download information --------------------- - -Source code is available from SVN: - -Binaries can be downloaded from: -n/a - +-------------------------------------------------- + +Source code is available from SVN: + ${scm.url} + +Binaries can be downloaded from the gCube website: + ${gcube.website} + + +Installation +-------------------------------------------------- + Documentation -------------- -Documentation is available on-line from the Projects Documentation Wiki: - - +-------------------------------------------------- + +Documentation is available on-line in the gCube Wiki: + ${gcube.wikiRoot}/gcube/GCube_Widgets_Store#Workspace_Uploader + +Support +-------------------------------------------------- + +Bugs and support requests can be reported in the gCube issue tracking tool: + ${gcube.issueTracking} + + Licensing ---------- - +-------------------------------------------------- + This software is licensed under the terms you may find in the file named "LICENSE" in this directory. \ No newline at end of file diff --git a/distro/svnpath.txt b/distro/svnpath.txt deleted file mode 100644 index edacb04..0000000 --- a/distro/svnpath.txt +++ /dev/null @@ -1 +0,0 @@ -${scm.url} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 602c641..190a7fb 100644 --- a/pom.xml +++ b/pom.xml @@ -14,6 +14,7 @@ jar 1.1.1-SNAPSHOT Workspace Uploader Widget + Workspace Uploader Widget allows your application to upload file/s in the gCube Workspace scm:svn:http://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/${project.artifactId} scm:https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/${project.artifactId} 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 e75efb8..8a504c8 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 @@ -1,5 +1,5 @@ /** - * + * */ package org.gcube.portlets.widgets.workspaceuploader.server.upload; @@ -35,17 +35,17 @@ import org.slf4j.LoggerFactory; * Sep 2, 2015 */ public class WorkspaceUploaderMng { - + public static Logger logger = LoggerFactory.getLogger(WorkspaceUploaderMng.class); - - + + /** * Instantiates a new workspace uploader manager. */ public WorkspaceUploaderMng() { } - - + + /** * Creates the workspace uploader file. * @@ -64,11 +64,11 @@ public class WorkspaceUploaderMng { */ private static WorkspaceUploaderItem createWorkspaceUploaderFile(final WorkspaceUploaderItem workspaceUploader, final HttpSession httpSession, final boolean isOvewrite, final Workspace wa, final InputStream uploadFile, final String itemName, final WorkspaceFolder destinationFolder, final String contentType, final long totalBytes) throws InternalErrorException, IOException{ logger.debug("Creating WorkspaceUploaderFile..."); - + workspaceUploader.setUploadStatus(UPLOAD_STATUS.IN_PROGRESS); workspaceUploader.setStatusDescription("Uploading "+itemName); FolderItem createdItem = null; - + try{ Long startTime = WorkspaceUploadServletStream.printStartTime(); if(!isOvewrite){ @@ -78,7 +78,7 @@ public class WorkspaceUploaderMng { else{ createdItem = overwriteItem(wa, itemName, uploadFile, destinationFolder); //CASE OVERWRITE } - + if(createdItem!=null){ WorkspaceUploadServletStream.printElapsedTime(startTime); logger.debug("HL file: "+createdItem.getName() + " with id: "+createdItem.getId() + " uploaded correctly in "+destinationFolder.getPath()); @@ -126,7 +126,7 @@ public class WorkspaceUploaderMng { return workspaceUploader; } - + /** * Creates the workspace uploader archive. @@ -142,16 +142,16 @@ public class WorkspaceUploaderMng { * @throws IOException Signals that an I/O exception has occurred. */ private static WorkspaceUploaderItem createWorkspaceUploaderArchive(final WorkspaceUploaderItem workspaceUploader, final HttpSession httpSession, final InputStream uploadFile, final String itemName, final WorkspaceFolder destinationFolder, final long totalBytes) throws InternalErrorException, IOException{ - + logger.info("calling upload archive - [itemName: "+itemName+"]"); try { workspaceUploader.setUploadStatus(UPLOAD_STATUS.IN_PROGRESS); UnzipUtil.unzip(destinationFolder, uploadFile, itemName); - + logger.info("Archive "+itemName+ " imported correctly in "+destinationFolder.getPath()); workspaceUploader.setStatusDescription("Archive "+itemName+ " imported correctly in "+destinationFolder.getPath()); workspaceUploader.setUploadStatus(UPLOAD_STATUS.COMPLETED); - + try { WsUtil.putWorkspaceUploaderInSession(httpSession, workspaceUploader); } catch (Exception e1) { @@ -176,7 +176,7 @@ public class WorkspaceUploaderMng { } return workspaceUploader; } - + /** @@ -195,7 +195,7 @@ public class WorkspaceUploaderMng { * @throws Exception the exception */ public static WorkspaceUploaderItem uploadFile(WorkspaceUploaderItem workspaceUploader, HttpSession httpSession, Workspace wa, String itemName, InputStream file, WorkspaceFolder destinationFolder, String contentType, boolean isOverwrite, long totolaBytes) throws Exception { - + try { return createWorkspaceUploaderFile(workspaceUploader, httpSession, isOverwrite, wa, file, itemName, destinationFolder, contentType, totolaBytes); } catch (Exception e) { @@ -203,8 +203,8 @@ public class WorkspaceUploaderMng { throw new Exception("An error occurred during upload: "+itemName+". Try again"); } } - - + + /** * Upload archive. * @@ -218,16 +218,16 @@ public class WorkspaceUploaderMng { * @throws Exception the exception */ public static WorkspaceUploaderItem uploadArchive(WorkspaceUploaderItem workspaceUploader, HttpSession httpSession, String itemName, InputStream file, WorkspaceFolder destinationFolder, long totalBytes) throws Exception { - + try { return createWorkspaceUploaderArchive(workspaceUploader, httpSession, file, itemName, destinationFolder, totalBytes); - + } catch (Exception e) { logger.error("Error when uploading Archive to HL creation: ",e); throw new Exception("An error occurred during upload:: "+itemName+". Try again"); } } - + /** * Upload file status. * @@ -239,7 +239,7 @@ public class WorkspaceUploaderMng { public static WorkspaceUploaderItem uploadFileStatus(HttpSession httpSession, WorkspaceUploaderItem workspaceUploader) throws Exception { return WsUtil.getWorkspaceUploaderInSession(httpSession, workspaceUploader.getIdentifier()); } - + /** * Overwrite item. * @@ -257,7 +257,7 @@ public class WorkspaceUploaderMng { * @throws WrongDestinationException the wrong destination exception */ private static FolderItem overwriteItem(Workspace wa, String itemName, InputStream fileData, WorkspaceFolder destinationFolder) throws ItemNotFoundException, WrongItemTypeException, InternalErrorException, InsufficientPrivilegesException, WorkspaceFolderNotFoundException, ItemAlreadyExistException, WrongDestinationException{ - + FolderItem overwriteItem = null; logger.debug("case overwriting item.. "+itemName); overwriteItem = (FolderItem) wa.find(itemName, destinationFolder.getId()); @@ -265,6 +265,6 @@ public class WorkspaceUploaderMng { wa.updateItem(overwriteItem.getId(), fileData); logger.debug("updateItem with id: "+overwriteItem.getId()+ ", is completed"); return overwriteItem; - + } }