git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngineSmartExecutor@122704 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0eec164e5c
commit
d8f7c33be7
|
@ -24,6 +24,7 @@ import org.gcube.dataanalysis.ecoengine.configuration.AlgorithmConfiguration;
|
|||
|
||||
public class StorageUtils {
|
||||
|
||||
|
||||
public static void downloadInputFile(String fileurl, String destinationFile) throws Exception{
|
||||
downloadInputFile(fileurl, destinationFile, false);
|
||||
}
|
||||
|
@ -52,6 +53,23 @@ public class StorageUtils {
|
|||
out.close();
|
||||
}
|
||||
|
||||
public static String uploadFilesOnStorage(String scope, String user, String localFolder, String remoteFolder, String file) 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);
|
||||
AnalysisLogger.getLogger().info("Loading finished");
|
||||
System.gc();
|
||||
return url;
|
||||
} catch (Exception e) {
|
||||
AnalysisLogger.getLogger().info("Error in uploading file: " + e.getLocalizedMessage());
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public static String uploadFilesOnStorage(String scope, String user, String localFolder, String file) throws Exception {
|
||||
try {
|
||||
ScopeProvider.instance.set(scope);
|
||||
|
|
Loading…
Reference in New Issue