diff --git a/src/main/java/org/gcube/common/storagehub/client/dsl/FolderContainer.java b/src/main/java/org/gcube/common/storagehub/client/dsl/FolderContainer.java index 1337e93..30db7dc 100644 --- a/src/main/java/org/gcube/common/storagehub/client/dsl/FolderContainer.java +++ b/src/main/java/org/gcube/common/storagehub/client/dsl/FolderContainer.java @@ -59,6 +59,21 @@ public class FolderContainer extends ItemContainer{ return new FileContainer(itemclient, itemclient.uploadFile(stream, this.itemId , filename, description)); } + /** + * + * creates a {@AbstractFileItem} inside the folder represented by this FolderContainer + * + * @param stream the file stream + * @param filename the name of the item in the workspace + * @param description the description of the item in the workspace + * @return {@FileContainer} of the Item created + * @throws {@InvalidItemException} + * @throws {@UserNotAuthorizedException} if user is not authorized to write in this folder + */ + public FileContainer uploadFile(InputStream stream, String filename, String description, long size) throws StorageHubException { + return new FileContainer(itemclient, itemclient.uploadFile(stream, this.itemId , filename, description, size)); + } + /** * * creates a {@AbstractFileItem} inside the folder represented by this FolderContainer @@ -72,6 +87,7 @@ public class FolderContainer extends ItemContainer{ public FileContainer uploadFile(File file, String description) throws StorageHubException { return new FileContainer(itemclient, itemclient.uploadFile(file, this.itemId , file.getName(), description)); } + /** * @@ -102,6 +118,20 @@ public class FolderContainer extends ItemContainer{ return new FolderContainer(itemclient, itemclient.uploadArchive(stream, this.itemId , extractionFolderName)); } + /** + * + * creates a set of {@Item} in the workspace extracting the Archive + * + * @param stream the file stream + * @param extractionFolderName the root name of the folder where the archive will be extracted (A new folder with this name will be created) + * @return {@FolderContainer} of the extraction Folder + * @throws {@InvalidItemException} + * @throws {@UserNotAuthorizedException} if user is not authorized to write in this folder + */ + public FolderContainer uploadArchive(InputStream stream, String extractionFolderName, long size) throws StorageHubException { + return new FolderContainer(itemclient, itemclient.uploadArchive(stream, this.itemId , extractionFolderName, size)); + } + /** * * create a new {@FolderItem} inside the {@FolderItem} represented by this FolderContainer diff --git a/src/main/java/org/gcube/common/storagehub/client/proxies/DefaultItemManager.java b/src/main/java/org/gcube/common/storagehub/client/proxies/DefaultItemManager.java index af878f5..9c64fa2 100644 --- a/src/main/java/org/gcube/common/storagehub/client/proxies/DefaultItemManager.java +++ b/src/main/java/org/gcube/common/storagehub/client/proxies/DefaultItemManager.java @@ -633,7 +633,7 @@ public class DefaultItemManager extends DefaultManagerClient implements ItemMana @Override public String uploadFile(InputStream stream, String parentId, String fileName, String description) throws StorageHubException { - return this.uploadFile(stream, parentId, fileName, description, 0); + return this.uploadFile(stream, parentId, fileName, description, -1); } @Override