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@171664 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2018-09-25 14:51:56 +00:00
parent a23c56395b
commit 443ead033c
2 changed files with 8 additions and 14 deletions

View File

@ -76,12 +76,6 @@
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xerces</artifactId>
<version>2.4.0</version>
</dependency>
<!-- StorageHub -->
<dependency>

View File

@ -448,18 +448,18 @@ public class FilesStorage {
FolderContainer folderContainer = openResolver.asFolder();
ListResolver listResolver = folderContainer.findByName(STATISTICAL_ALGORITHM_PROJECT_FILE_NAME);
List<? extends Item> items = listResolver.getItems();
if (items == null || items.isEmpty()) {
List<ItemContainer<? extends Item>> itemsContainer = listResolver.getContainers();
if (itemsContainer == null || itemsContainer.isEmpty()) {
logger.debug("No project found in this folder!");
throw new StatAlgoImporterServiceException("No project found in this folder!");
} else {
Item item = items.get(0);
logger.debug("Item: " + item);
if (item != null) {
logger.debug("Item Id=" + item.getId());
StreamDescriptor streamDescr = shc.open(item.getId()).asFile().download();
ItemContainer<? extends Item> itemContainer = itemsContainer.get(0);
logger.debug("ItemContainer: " + itemContainer);
if (itemContainer != null) {
logger.debug("Item Id: "+itemContainer.get().getId());
StreamDescriptor streamDescr = itemContainer.download();
logger.debug("Stream Descriptor: "+streamDescr);
return streamDescr.getStream();
} else {
logger.debug("No project found in this folder!");
throw new StatAlgoImporterServiceException("No project found in this folder!");