minor fixes

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/grsf-publisher-ws@162588 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2018-01-25 13:16:15 +00:00
parent a0a567e378
commit 44055ded61
2 changed files with 10 additions and 9 deletions

View File

@ -41,7 +41,7 @@ public class CSVUtils {
}else
try{
String fileName = UPLOAD_LOCATION_LOCAL + File.separator + GRSF_SUB_PATH + File.separator + "time_series_" + System.currentTimeMillis() + CSV_EXTENSION;
String fileName = UPLOAD_LOCATION_LOCAL + File.separator + GRSF_SUB_PATH + File.separator + "time_series_" + System.nanoTime() + CSV_EXTENSION;
File file = new File(fileName);
file.getParentFile().mkdirs();
file.createNewFile();

View File

@ -201,7 +201,8 @@ public class ManageTimeSeriesThread extends Thread{
// upload this file on ckan
if(ckanResource == null)
ckanResource = uploadFileOnCatalogue(csvFile, uuidKB, catalogue, username, resourceToAttachOnCkanName, resourceToAttachOnCkanDescription, apiKeyUser, "text/csv", "text/csv");
ckanResource = uploadFileOnCatalogue(csvFile, uuidKB, catalogue, username, resourceToAttachOnCkanName, resourceToAttachOnCkanDescription,
apiKeyUser, "text/csv", "text/csv");
//upload this file on the folder of the vre (under .catalogue) and change the url of the resource
if(ckanResource != null){
@ -214,12 +215,14 @@ public class ManageTimeSeriesThread extends Thread{
String publicUrlToSetOnCkan = createdFileOnWorkspace.getPublicLink(true);
// wait for patching..
Thread.sleep(1000);
Thread.sleep(1500);
logger.debug("Going to patch the created resource with id " + ckanResource.getId() + " with url " + publicUrlToSetOnCkan);
boolean updated = catalogue.patchResource(ckanResource.getId(), publicUrlToSetOnCkan, resourceToAttachOnCkanName, resourceToAttachOnCkanDescription, "", apiKeyUser);
if(updated){
logger.info("Resource has been updated with the new url");
csvFile.delete();
break;
}else
logger.error("Error while patching resource...");
@ -228,8 +231,6 @@ public class ManageTimeSeriesThread extends Thread{
}
// delete the file
csvFile.delete();
}
}
}