Gianpaolo Coro 2016-02-02 15:28:16 +00:00
parent d19d36488c
commit 97763124f3
1 changed files with 7 additions and 3 deletions

View File

@ -24,7 +24,6 @@ import org.gcube.dataanalysis.ecoengine.configuration.AlgorithmConfiguration;
public class StorageUtils {
public static void downloadInputFile(String fileurl, String destinationFile) throws Exception{
downloadInputFile(fileurl, destinationFile, false);
}
@ -53,14 +52,19 @@ public class StorageUtils {
out.close();
}
public static String uploadFilesOnStorage(String scope, String user, String localFolder, String remoteFolder, String file) throws Exception {
public static String uploadFilesOnStorage(String scope, String user, String localFolder, String remoteFolder, String file, boolean httplink) throws Exception {
try {
ScopeProvider.instance.set(scope);
AnalysisLogger.getLogger().info("Loading file on scope: " + scope);
IClient client = new StorageClient(AlgorithmConfiguration.StatisticalManagerClass, AlgorithmConfiguration.StatisticalManagerService, user, AccessType.SHARED, MemoryType.VOLATILE).getClient();
String remotef = remoteFolder+file;
client.put(true).LFile(new File(localFolder,file).getAbsolutePath()).RFile(remotef);
String url = client.getUrl().RFile(remotef);
String url = "";
if (httplink)
url = client.getHttpUrl().RFile(remotef);
else
url = client.getUrl().RFile(remotef);
AnalysisLogger.getLogger().info("Loading finished");
System.gc();
return url;