git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngineSmartExecutor@149385 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
92b9382eeb
commit
cd00157ca3
|
@ -3,16 +3,18 @@ package org.gcube.dataanalysis.ecoengine.interfaces;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
|
|
||||||
import org.gcube.contentmanagement.graphtools.utils.HttpRequest;
|
import org.gcube.contentmanagement.graphtools.utils.HttpRequest;
|
||||||
import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger;
|
|
||||||
import org.gcube.dataanalysis.executor.util.InfraRetrieval;
|
import org.gcube.dataanalysis.executor.util.InfraRetrieval;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public abstract class StandardLocalInfraAlgorithm extends StandardLocalExternalAlgorithm {
|
public abstract class StandardLocalInfraAlgorithm extends StandardLocalExternalAlgorithm {
|
||||||
|
|
||||||
|
private Logger LOGGER = LoggerFactory.getLogger(StandardLocalInfraAlgorithm.class);
|
||||||
|
|
||||||
|
|
||||||
public void sendNotification(String subject, String body) throws Exception {
|
public void sendNotification(String subject, String body) throws Exception {
|
||||||
|
|
||||||
AnalysisLogger.getLogger().debug("Emailing System->Starting request of email in scope "+config.getGcubeScope());
|
LOGGER.debug("Emailing System->Starting request of email in scope "+config.getGcubeScope());
|
||||||
|
|
||||||
String serviceAddress = InfraRetrieval.findEmailingSystemAddress(config.getGcubeScope());
|
String serviceAddress = InfraRetrieval.findEmailingSystemAddress(config.getGcubeScope());
|
||||||
|
|
||||||
|
@ -22,7 +24,7 @@ public abstract class StandardLocalInfraAlgorithm extends StandardLocalExternalA
|
||||||
String requestForMessage = serviceAddress + "messages/writeMessageToUsers" + "?gcube-token=" + config.getGcubeToken();
|
String requestForMessage = serviceAddress + "messages/writeMessageToUsers" + "?gcube-token=" + config.getGcubeToken();
|
||||||
requestForMessage = requestForMessage.replace("http://", "https://").replace(":80", ""); // remove the port (or set it to 443) otherwise you get an SSL error
|
requestForMessage = requestForMessage.replace("http://", "https://").replace(":80", ""); // remove the port (or set it to 443) otherwise you get an SSL error
|
||||||
|
|
||||||
AnalysisLogger.getLogger().debug("Emailing System->Request url is going to be " + requestForMessage);
|
LOGGER.debug("Emailing System->Request url is going to be " + requestForMessage);
|
||||||
|
|
||||||
// put the sender, the recipients, subject and body of the mail here
|
// put the sender, the recipients, subject and body of the mail here
|
||||||
subject=URLEncoder.encode(subject,"UTF-8");
|
subject=URLEncoder.encode(subject,"UTF-8");
|
||||||
|
@ -30,7 +32,7 @@ public abstract class StandardLocalInfraAlgorithm extends StandardLocalExternalA
|
||||||
String requestParameters = "sender=dataminer&recipients="+config.getGcubeUserName()+"&subject="+subject+"&body="+body;
|
String requestParameters = "sender=dataminer&recipients="+config.getGcubeUserName()+"&subject="+subject+"&body="+body;
|
||||||
|
|
||||||
String response = HttpRequest.sendPostRequest(requestForMessage, requestParameters);
|
String response = HttpRequest.sendPostRequest(requestForMessage, requestParameters);
|
||||||
AnalysisLogger.getLogger().debug("Emailing System->Emailing response OK ");
|
LOGGER.debug("Emailing System->Emailing response OK ");
|
||||||
|
|
||||||
if (response==null){
|
if (response==null){
|
||||||
Exception e = new Exception("Error in email sending response");
|
Exception e = new Exception("Error in email sending response");
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class DataTransferer {
|
||||||
TransferResult transferResult = null;
|
TransferResult transferResult = null;
|
||||||
if(decompress){
|
if(decompress){
|
||||||
Map<String,String> params=new HashMap<>();
|
Map<String,String> params=new HashMap<>();
|
||||||
params.put("DELETE_ARCHIVE", Boolean.FALSE.toString());
|
params.put("DELETE_ARCHIVE", Boolean.TRUE.toString());
|
||||||
if (decompressedFilefolderDestination!=null)
|
if (decompressedFilefolderDestination!=null)
|
||||||
params.put("DESTINATION", decompressedFilefolderDestination);
|
params.put("DESTINATION", decompressedFilefolderDestination);
|
||||||
transferResult = client.localFile(localFile,dest, new PluginInvocation("DECOMPRESS",params));
|
transferResult = client.localFile(localFile,dest, new PluginInvocation("DECOMPRESS",params));
|
||||||
|
|
Loading…
Reference in New Issue