This commit is contained in:
Lucio Lelii 2018-10-16 12:11:26 +00:00
parent f6b3253459
commit fdda6ce838
2 changed files with 16 additions and 16 deletions

View File

@ -196,10 +196,10 @@ public class InputsManager {
for (Map.Entry<String, List<String>> entry : map.entrySet()) { for (Map.Entry<String, List<String>> entry : map.entrySet()) {
String value = entry.getValue().toString(); String value = entry.getValue().toString();
if (value.toLowerCase().contains("filename=")){ 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=value.substring(value.indexOf("=")+1);
filename=filename.replace("\"", "").replace("]", ""); 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; break;
} }
} }
@ -235,12 +235,11 @@ public class InputsManager {
String fileNameTemp = inputNameFromHttpHeader(subfilelink); String fileNameTemp = inputNameFromHttpHeader(subfilelink);
if (fileNameTemp==null) if (fileNameTemp==null)
fileName = inputName+"_[" + computationId + "]"; fileName = String.format("%s_(%s)",inputName, computationId);
else else
fileName = fileNameTemp+ "_[" + computationId + "]."+FilenameUtils.getExtension(fileNameTemp); fileName = String.format("%s_(%s).%s",fileNameTemp, computationId, FilenameUtils.getExtension(fileNameTemp));
LOGGER.debug("Retrieving remote input in file: {}", fileName);
LOGGER.debug("Retrieving remote input in file: " + fileName); LOGGER.debug("Creating local temp file: {}", fileName);
LOGGER.debug("Creating local temp file: " + fileName);
File of = new File(config.getPersistencePath(), fileName); File of = new File(config.getPersistencePath(), fileName);
FileOutputStream fos = new FileOutputStream(of); FileOutputStream fos = new FileOutputStream(of);
IOUtils.copy(is, fos); IOUtils.copy(is, fos);
@ -249,7 +248,7 @@ public class InputsManager {
fos.close(); fos.close();
urlConnection.disconnect(); urlConnection.disconnect();
filesList.add(of); filesList.add(of);
LOGGER.debug("Created local file: " + of.getAbsolutePath()); LOGGER.debug("Created local file: {}", of.getAbsolutePath());
} }
} else { } else {
LOGGER.debug("Complex Input payload is the filelink"); LOGGER.debug("Complex Input payload is the filelink");

View File

@ -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->final file name on ws " + data.name+" description "+data.description);
LOGGER.debug("Dataspace->WS OP saving the following file on the WS " + filenameonwsString); LOGGER.debug("Dataspace->WS OP saving the following file on the WS " + filenameonwsString);
LinkedHashMap<String, String> properties = new LinkedHashMap<String, String>(); Map<String, Object> properties = new LinkedHashMap<String, Object>();
properties.put(computation_id, data.computationId); properties.put(computation_id, data.computationId);
properties.put(hostname, WPSConfig.getInstance().getWPSConfig().getServer().getHostname()); properties.put(hostname, WPSConfig.getInstance().getWPSConfig().getServer().getHostname());
@ -186,9 +186,8 @@ public class DataspaceManager implements Runnable {
properties.put(payload, url); properties.put(payload, url);
FileContainer fileContainer = destinationFolder.uploadFile(in, filenameonwsString, data.description); FileContainer fileContainer = destinationFolder.uploadFile(in, filenameonwsString, data.description);
//TODO: add proprerty to file fileContainer.setMetadata(new Metadata(properties));
//FolderItem fileItem = WorkspaceUtil.createExternalFile(wsFolder, filenameonwsString, data.description, in,properties,data.type,size);
//fileItem.getProperties().addProperties(properties);
LOGGER.debug("Dataspace->WS OP file saved on the WS " + filenameonwsString); LOGGER.debug("Dataspace->WS OP file saved on the WS " + filenameonwsString);
url = fileContainer.getPublicLink().toString(); url = fileContainer.getPublicLink().toString();
@ -371,9 +370,11 @@ public class DataspaceManager implements Runnable {
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("Dataspace->Failed creating ProvO XML file ",e); LOGGER.error("Dataspace->Failed creating ProvO XML file ",e);
} }
//List<String> scopes = new ArrayList<String>(); /*
//scopes.add(config.getGcubeScope()); List<String> scopes = new ArrayList<String>();
//ws.createGcubeItem(computation.id, computation.operatorDescription, scopes, computation.user, itemType, properties, newcomputationFolder.getId()); scopes.add(config.getGcubeScope());
ws.createGcubeItem(computation.id, computation.operatorDescription, scopes, computation.user, itemType, properties, newcomputationFolder.getId());
*/
newcomputationFolder.setMetadata(new Metadata(properties)); newcomputationFolder.setMetadata(new Metadata(properties));
@ -446,7 +447,7 @@ public class DataspaceManager implements Runnable {
gcubeItem.setDescription(computation.operatorDescription); gcubeItem.setDescription(computation.operatorDescription);
gcubeItem.setScopes(scopes.toArray(new String[scopes.size()])); gcubeItem.setScopes(scopes.toArray(new String[scopes.size()]));
gcubeItem.setItemType(itemType); gcubeItem.setItemType(itemType);
gcubeItem.setProperty(new Metadata(properties)); gcubeItem.setPropertyMap(new Metadata(properties));
gcubeItem.setCreator(AuthorizationProvider.instance.get().getClient().getId()); gcubeItem.setCreator(AuthorizationProvider.instance.get().getClient().getId());
computationsContainer.newGcubeItem(gcubeItem); computationsContainer.newGcubeItem(gcubeItem);