ref 11724: SAI - Update to StorageHUB

https://support.d4science.org/issues/11724

Updated to StorageHub 

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@173917 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2018-11-02 11:02:00 +00:00
parent 5303a73d84
commit 8af7212743
1 changed files with 8 additions and 4 deletions

View File

@ -62,6 +62,7 @@ public class FilesStorage {
logger.info("getPublicLink: [user=" + user + ", itemId=" + itemId + "]");
StorageHubClient shc = new StorageHubClient();
URL url = shc.open(itemId).asFile().getPublicLink();
logger.debug("getPublicLink: "+url);
return url.toString();
} catch (Throwable e) {
@ -98,6 +99,7 @@ public class FilesStorage {
AbstractFileItem item = fileCreatedContainer.get();
ItemDescription itemDescription = new ItemDescription(item.getId(), item.getName(), item.getOwner(),
item.getPath(), getItemType(item));
logger.debug("New item copied: "+itemDescription);
return itemDescription;
} catch (Throwable e) {
logger.error("Copy item on folder on workspace: " + e.getLocalizedMessage(), e);
@ -249,7 +251,7 @@ public class FilesStorage {
ItemDescription itemDescription = new ItemDescription(folderCreated.getId(), folderCreated.getName(),
folderCreated.getOwner(), folderCreated.getPath(), getItemType(folderCreated));
logger.debug("Folder created: "+itemDescription);
return itemDescription;
} catch (Throwable e) {
logger.error("Create folder on workspace: " + e.getLocalizedMessage(), e);
@ -373,7 +375,7 @@ public class FilesStorage {
FolderContainer folderContainer = openResolver.asFolder();
folderContainer.uploadFile(inputStream, name, description);
logger.debug("Item saved");
return;
} catch (Throwable e) {
logger.error("Save item on workspace: " + e.getLocalizedMessage(), e);
@ -416,7 +418,7 @@ public class FilesStorage {
ItemDescription itemDescription = new ItemDescription(fileCreated.getId(), fileCreated.getName(),
fileCreated.getOwner(), fileCreated.getPath(), getItemType(fileCreated));
logger.debug("Item created: "+itemDescription);
return itemDescription;
} catch (Throwable e) {
logger.error("Create item on workspace: " + e.getLocalizedMessage(), e);
@ -530,6 +532,7 @@ public class FilesStorage {
item.getPath(), getItemType(item));
itemDescription.setMimeType(item.getContent().getMimeType());
itemDescription.setLenght(String.valueOf(item.getContent().getSize()));
logger.debug("File info: "+itemDescription);
return itemDescription;
} catch (Throwable e) {
@ -559,7 +562,7 @@ public class FilesStorage {
FolderItem item = openResolver.asFolder().get();
ItemDescription itemDescription = new ItemDescription(item.getId(), item.getName(), item.getOwner(),
item.getPath(), getItemType(item));
logger.debug("Folder info: "+itemDescription);
return itemDescription;
} catch (Throwable e) {
@ -863,6 +866,7 @@ public class FilesStorage {
Item item = itemContainer.get();
ItemDescription itemDescription = new ItemDescription(item.getId(), item.getName(), item.getOwner(),
item.getPath(), getItemType(item));
logger.debug("Item: "+itemDescription);
return itemDescription;
} catch (Throwable e) {
logger.error("Retrieve file info on workspace: " + e.getLocalizedMessage(), e);