diff --git a/src/main/java/org/gcube/dataanalysis/wps/statisticalmanager/synchserver/mapping/InputsManager.java b/src/main/java/org/gcube/dataanalysis/wps/statisticalmanager/synchserver/mapping/InputsManager.java index 1c8dafb..6f2637a 100644 --- a/src/main/java/org/gcube/dataanalysis/wps/statisticalmanager/synchserver/mapping/InputsManager.java +++ b/src/main/java/org/gcube/dataanalysis/wps/statisticalmanager/synchserver/mapping/InputsManager.java @@ -196,10 +196,10 @@ public class InputsManager { for (Map.Entry> entry : map.entrySet()) { String value = entry.getValue().toString(); if (value.toLowerCase().contains("filename=")){ - LOGGER.debug("Searching in http header: found file name in header value "+value); + LOGGER.debug("Searching in http header: found file name in header value {}",value); filename=value.substring(value.indexOf("=")+1); filename=filename.replace("\"", "").replace("]", ""); - LOGGER.debug("Searching in http header: retrieved file name "+filename); + LOGGER.debug("Searching in http header: retrieved file name {}",filename); break; } } @@ -235,12 +235,11 @@ public class InputsManager { String fileNameTemp = inputNameFromHttpHeader(subfilelink); if (fileNameTemp==null) - fileName = inputName+"_[" + computationId + "]"; + fileName = String.format("%s_(%s)",inputName, computationId); else - fileName = fileNameTemp+ "_[" + computationId + "]."+FilenameUtils.getExtension(fileNameTemp); - - LOGGER.debug("Retrieving remote input in file: " + fileName); - LOGGER.debug("Creating local temp file: " + fileName); + fileName = String.format("%s_(%s).%s",fileNameTemp, computationId, FilenameUtils.getExtension(fileNameTemp)); + LOGGER.debug("Retrieving remote input in file: {}", fileName); + LOGGER.debug("Creating local temp file: {}", fileName); File of = new File(config.getPersistencePath(), fileName); FileOutputStream fos = new FileOutputStream(of); IOUtils.copy(is, fos); @@ -249,7 +248,7 @@ public class InputsManager { fos.close(); urlConnection.disconnect(); filesList.add(of); - LOGGER.debug("Created local file: " + of.getAbsolutePath()); + LOGGER.debug("Created local file: {}", of.getAbsolutePath()); } } else { LOGGER.debug("Complex Input payload is the filelink"); diff --git a/src/main/java/org/gcube/dataanalysis/wps/statisticalmanager/synchserver/mapping/dataspace/DataspaceManager.java b/src/main/java/org/gcube/dataanalysis/wps/statisticalmanager/synchserver/mapping/dataspace/DataspaceManager.java index 9ad25af..2175a02 100644 --- a/src/main/java/org/gcube/dataanalysis/wps/statisticalmanager/synchserver/mapping/dataspace/DataspaceManager.java +++ b/src/main/java/org/gcube/dataanalysis/wps/statisticalmanager/synchserver/mapping/dataspace/DataspaceManager.java @@ -172,7 +172,7 @@ public class DataspaceManager implements Runnable { // LOGGER.debug("Dataspace->final file name on ws " + data.name+" description "+data.description); LOGGER.debug("Dataspace->WS OP saving the following file on the WS " + filenameonwsString); - LinkedHashMap properties = new LinkedHashMap(); + Map properties = new LinkedHashMap(); properties.put(computation_id, data.computationId); properties.put(hostname, WPSConfig.getInstance().getWPSConfig().getServer().getHostname()); @@ -186,9 +186,8 @@ public class DataspaceManager implements Runnable { properties.put(payload, url); FileContainer fileContainer = destinationFolder.uploadFile(in, filenameonwsString, data.description); - //TODO: add proprerty to file - //FolderItem fileItem = WorkspaceUtil.createExternalFile(wsFolder, filenameonwsString, data.description, in,properties,data.type,size); - //fileItem.getProperties().addProperties(properties); + fileContainer.setMetadata(new Metadata(properties)); + LOGGER.debug("Dataspace->WS OP file saved on the WS " + filenameonwsString); url = fileContainer.getPublicLink().toString(); @@ -371,9 +370,11 @@ public class DataspaceManager implements Runnable { } catch (Exception e) { LOGGER.error("Dataspace->Failed creating ProvO XML file ",e); } - //List scopes = new ArrayList(); - //scopes.add(config.getGcubeScope()); - //ws.createGcubeItem(computation.id, computation.operatorDescription, scopes, computation.user, itemType, properties, newcomputationFolder.getId()); + /* + List scopes = new ArrayList(); + scopes.add(config.getGcubeScope()); + ws.createGcubeItem(computation.id, computation.operatorDescription, scopes, computation.user, itemType, properties, newcomputationFolder.getId()); + */ newcomputationFolder.setMetadata(new Metadata(properties)); @@ -446,7 +447,7 @@ public class DataspaceManager implements Runnable { gcubeItem.setDescription(computation.operatorDescription); gcubeItem.setScopes(scopes.toArray(new String[scopes.size()])); gcubeItem.setItemType(itemType); - gcubeItem.setProperty(new Metadata(properties)); + gcubeItem.setPropertyMap(new Metadata(properties)); gcubeItem.setCreator(AuthorizationProvider.instance.get().getClient().getId()); computationsContainer.newGcubeItem(gcubeItem);