diff --git a/pom.xml b/pom.xml
index a85752c..62151f0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -65,11 +65,11 @@
stringtemplate
[4.0.0, 4.1.0)
-
+
diff --git a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/ISClient.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/ISClient.java
index a4cb169..79e341c 100644
--- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/ISClient.java
+++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/clients/ISClient.java
@@ -252,43 +252,43 @@ public class ISClient ***REMOVED***
***REMOVED***
- public Set getAlgoFromIs() ***REMOVED***
-***REMOVED***
-
- Set out = new HashSet();
- SimpleQuery query = queryFor(GenericResource.class);
- query.addCondition("$resource/Profile/SecondaryType/text() eq 'StatisticalManagerAlgorithm'")
- .setResult("$resource");
- DiscoveryClient client = clientFor(GenericResource.class);
- List ds = client.submit(query);
- for (GenericResource a : ds) ***REMOVED***
- out.add(this.convertAlgo(a));
- ***REMOVED***
- return out;
+***REMOVED*** public Set getAlgoFromIs() ***REMOVED***
+***REMOVED******REMOVED***
***REMOVED***
+***REMOVED*** Set out = new HashSet();
+***REMOVED*** SimpleQuery query = queryFor(GenericResource.class);
+***REMOVED*** query.addCondition("$resource/Profile/SecondaryType/text() eq 'StatisticalManagerAlgorithm'")
+***REMOVED*** .setResult("$resource");
+***REMOVED*** DiscoveryClient client = clientFor(GenericResource.class);
+***REMOVED*** List ds = client.submit(query);
+***REMOVED*** for (GenericResource a : ds) ***REMOVED***
+***REMOVED*** out.add(this.convertAlgo(a));
+***REMOVED*** ***REMOVED***
+***REMOVED*** return out;
+***REMOVED******REMOVED***
- private Algorithm convertAlgo(GenericResource a) ***REMOVED***
- Algorithm out = new Algorithm();
-
- ***REMOVED*** out.setId(a.profile().body().getElementsByTagName("id").item(0).getTextContent());
- out.setAlgorithmType(a.profile().body().getElementsByTagName("algorithmType").item(0).getTextContent());
- out.setCategory(a.profile().body().getElementsByTagName("category").item(0).getTextContent());
- out.setClazz(a.profile().body().getElementsByTagName("clazz").item(0).getTextContent());
- out.setName(a.profile().name());
- out.setPackageURL(a.profile().body().getElementsByTagName("packageURL").item(0).getTextContent());
- out.setSkipJava(a.profile().body().getElementsByTagName("skipJava").item(0).getTextContent());
- out.setDescription(a.profile().description());
-
- Set deps = new HashSet();
- for (int i = 0; i < a.profile().body().getElementsByTagName("dependencies").getLength(); i++) ***REMOVED***
- org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency d1 = new org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency();
- d1.setName(a.profile().body().getElementsByTagName("dependencies").item(i).getTextContent());
- deps.add(d1);
- ***REMOVED***
- out.setDependencies(deps);
- return out;
+***REMOVED*** private Algorithm convertAlgo(GenericResource a) ***REMOVED***
+***REMOVED*** Algorithm out = new Algorithm();
***REMOVED***
+***REMOVED*** ***REMOVED*** out.setId(a.profile().body().getElementsByTagName("id").item(0).getTextContent());
+***REMOVED*** out.setAlgorithmType(a.profile().body().getElementsByTagName("algorithmType").item(0).getTextContent());
+***REMOVED*** out.setCategory(a.profile().body().getElementsByTagName("category").item(0).getTextContent());
+***REMOVED*** out.setClazz(a.profile().body().getElementsByTagName("clazz").item(0).getTextContent());
+***REMOVED*** out.setName(a.profile().name());
+***REMOVED*** out.setPackageURL(a.profile().body().getElementsByTagName("packageURL").item(0).getTextContent());
+***REMOVED*** out.setSkipJava(a.profile().body().getElementsByTagName("skipJava").item(0).getTextContent());
+***REMOVED*** out.setDescription(a.profile().description());
+***REMOVED***
+***REMOVED*** Set deps = new HashSet();
+***REMOVED*** for (int i = 0; i < a.profile().body().getElementsByTagName("dependencies").getLength(); i++) ***REMOVED***
+***REMOVED*** org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency d1 = new org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency();
+***REMOVED*** d1.setName(a.profile().body().getElementsByTagName("dependencies").item(i).getTextContent());
+***REMOVED*** deps.add(d1);
+***REMOVED*** ***REMOVED***
+***REMOVED*** out.setDependencies(deps);
+***REMOVED*** return out;
+***REMOVED******REMOVED***
diff --git a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/DMPMJob.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/DMPMJob.java
index 4aa36bd..9b5b6c7 100644
--- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/DMPMJob.java
+++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/DMPMJob.java
@@ -17,7 +17,6 @@ import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Dependency;
import org.gcube.dataanalysis.dataminer.poolmanager.util.SVNUpdater;
***REMOVED***
-import Jampack.Print;
public abstract class DMPMJob ***REMOVED***
diff --git a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/CheckMethod.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/CheckMethod.java
index 455cfb1..265be00 100644
--- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/CheckMethod.java
+++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/CheckMethod.java
@@ -9,9 +9,7 @@ import java.io.InputStreamReader;
***REMOVED***
import java.util.Vector;
-import javax.jms.ServerSession;
-import org.apache.activemq.transport.tcp.ExceededMaximumConnectionsException;
***REMOVED***
import com.jcraft.jsch.Channel;
diff --git a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/SendMail.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/SendMail.java
index d0e006c..8598c6c 100644
--- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/SendMail.java
+++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/util/SendMail.java
@@ -4,11 +4,17 @@ import static org.gcube.common.authorization.client.Constants.authorizationServi
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
+import java.io.BufferedReader;
+***REMOVED***
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+***REMOVED***
+***REMOVED***
+import java.net.URLConnection;
import java.net.URLEncoder;
import java.util.LinkedList;
***REMOVED***
-import org.apache.activemq.transport.stomp.Stomp.Headers.Send;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
@@ -16,14 +22,13 @@ import org.apache.http.util.EntityUtils;
***REMOVED***
import org.gcube.common.authorization.library.AuthorizationEntry;
***REMOVED***
-import org.gcube.common.encryption.StringEncrypter;
+import org.gcube.common.resources.gcore.GCoreEndpoint;
import org.gcube.common.resources.gcore.GenericResource;
import org.gcube.common.resources.gcore.ServiceEndpoint;
***REMOVED***
-import org.gcube.contentmanagement.graphtools.utils.HttpRequest;
-import org.gcube.contentmanagement.lexicalmatcher.utils.AnalysisLogger;
-import org.gcube.dataanalysis.ecoengine.interfaces.StandardLocalInfraAlgorithm;
-import org.gcube.dataanalysis.executor.util.InfraRetrieval;
+
+import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Host;
+
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
import org.gcube.smartgears.ContextProvider;
@@ -32,7 +37,7 @@ import org.json.JSONArray;
import org.json.JSONObject;
-public class SendMail extends StandardLocalInfraAlgorithm ***REMOVED***
+public class SendMail ***REMOVED***
public SendMail() ***REMOVED***
***REMOVED*** TODO Auto-generated constructor stub
@@ -40,11 +45,13 @@ public class SendMail extends StandardLocalInfraAlgorithm ***REMOVED***
public void sendNotification(String subject, String body) throws Exception ***REMOVED***
- AnalysisLogger.getLogger()
- .debug("Emailing System->Starting request of email in scope " + ScopeProvider.instance.get());
+ ***REMOVED***AnalysisLogger.getLogger().debug("Emailing System->Starting request of email in scope " + ScopeProvider.instance.get());
- String serviceAddress = InfraRetrieval.findEmailingSystemAddress(ScopeProvider.instance.get());
+ ***REMOVED***String serviceAddress = InfraRetrieval.findEmailingSystemAddress(ScopeProvider.instance.get());
+ String serviceAddress = this.getSocialService();
+
+
if (!serviceAddress.endsWith("/"))
serviceAddress = serviceAddress + "/";
@@ -52,7 +59,7 @@ public class SendMail extends StandardLocalInfraAlgorithm ***REMOVED***
+ SecurityTokenProvider.instance.get();
requestForMessage = requestForMessage.replace("http:***REMOVED***", "https:***REMOVED***").replace(":80", "");
- AnalysisLogger.getLogger().debug("Emailing System->Request url is going to be " + requestForMessage);
+ ***REMOVED***AnalysisLogger.getLogger().debug("Emailing System->Request url is going to be " + requestForMessage);
***REMOVED*** put the sender, the recipients, subject and body of the mail here
subject = URLEncoder.encode(subject, "UTF-8");
@@ -60,9 +67,9 @@ public class SendMail extends StandardLocalInfraAlgorithm ***REMOVED***
String requestParameters = "&sender=dataminer&recipients=" + this.getAdmins() + "&subject=" + subject + "&body="
+ body;
- String response = HttpRequest.sendPostRequest(requestForMessage, requestParameters);
- AnalysisLogger.getLogger().debug("Emailing System->Emailing response OK ");
-
+ String response = this.sendPostRequest(requestForMessage, requestParameters);
+ ***REMOVED***AnalysisLogger.getLogger().debug("Emailing System->Emailing response OK ");
+
if (response == null) ***REMOVED***
Exception e = new Exception("Error in email sending response");
throw e;
@@ -102,6 +109,57 @@ public class SendMail extends StandardLocalInfraAlgorithm ***REMOVED***
***REMOVED***
***REMOVED******REMOVED***
+ public String getSocialService() ***REMOVED***
+ SimpleQuery query = queryFor(GCoreEndpoint.class);
+ query.addCondition("$resource/Profile/ServiceName/text() eq 'SocialNetworking'");
+ DiscoveryClient client = clientFor(GCoreEndpoint.class);
+ List resources = client.submit(query);
+ String a = resources.get(0).profile().endpointMap().get("jersey-servlet").uri().toString();
+ return a;
+***REMOVED***
+
+
+
+ public String sendPostRequest(String endpoint, String requestParameters) ***REMOVED***
+
+ ***REMOVED*** Build parameter string
+ String data = requestParameters;
+ try ***REMOVED***
+
+ ***REMOVED*** Send the request
+ URL url = new URL(endpoint);
+ URLConnection conn = url.openConnection();
+
+ conn.setDoOutput(true);
+ OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream());
+
+ ***REMOVED*** write parameters
+ writer.write(data);
+ writer.flush();
+
+ ***REMOVED*** Get the response
+ StringBuffer answer = new StringBuffer();
+ BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+ String line;
+ while ((line = reader.readLine()) != null) ***REMOVED***
+ answer.append(line);
+ ***REMOVED***
+ writer.close();
+ reader.close();
+
+ ***REMOVED*** Output the response
+ return answer.toString();
+
+ ***REMOVED*** catch (MalformedURLException ex) ***REMOVED***
+ ex.printStackTrace();
+ ***REMOVED*** catch (IOException ex) ***REMOVED***
+ ex.printStackTrace();
+ ***REMOVED***
+***REMOVED***
+***REMOVED***
+
+
+
public String getAdminRoles() throws Exception***REMOVED***
@@ -110,7 +168,8 @@ public class SendMail extends StandardLocalInfraAlgorithm ***REMOVED***
***REMOVED***GcoreEndpointReader ep = new GcoreEndpointReader(ScopeProvider.instance.get());
- String serviceAddress = InfraRetrieval.findEmailingSystemAddress(ScopeProvider.instance.get());
+ String serviceAddress = this.getSocialService();
+ ***REMOVED***String serviceAddress = InfraRetrieval.findEmailingSystemAddress(ScopeProvider.instance.get());
***REMOVED***String serviceAddress = ep.getResourceEntyName();***REMOVED***"https:***REMOVED***socialnetworking1.d4science.org/social-networking-library-ws/rest/";
@@ -154,56 +213,27 @@ public class SendMail extends StandardLocalInfraAlgorithm ***REMOVED***
- public String getRootToken() throws Exception ***REMOVED***
-
- ***REMOVED***ApplicationContext ctx = ContextProvider.get(); ***REMOVED*** get this info from
- ***REMOVED*** SmartGears
- ***REMOVED***System.out.println(ctx.container().configuration().infrastructure());
- String a = "";
- SimpleQuery query2 = queryFor(ServiceEndpoint.class);
- query2.addCondition("$resource/Profile/Name/text() eq 'SAIService'").setResult("$resource");
-
- DiscoveryClient client2 = clientFor(ServiceEndpoint.class);
- List df = client2.submit(query2);
-
- for (ServiceEndpoint b : df) ***REMOVED***
- a = StringEncrypter.getEncrypter().decrypt(b.profile().accessPoints().iterator().next().password());
- ***REMOVED***
- return a;
+***REMOVED*** public String getRootToken() throws Exception ***REMOVED***
***REMOVED***
+***REMOVED*** ***REMOVED***ApplicationContext ctx = ContextProvider.get(); ***REMOVED*** get this info from
+***REMOVED*** ***REMOVED*** SmartGears
+***REMOVED*** ***REMOVED***System.out.println(ctx.container().configuration().infrastructure());
+***REMOVED*** String a = "";
+***REMOVED*** SimpleQuery query2 = queryFor(ServiceEndpoint.class);
+***REMOVED*** query2.addCondition("$resource/Profile/Name/text() eq 'SAIService'").setResult("$resource");
+***REMOVED***
+***REMOVED*** DiscoveryClient client2 = clientFor(ServiceEndpoint.class);
+***REMOVED*** List df = client2.submit(query2);
+***REMOVED***
+***REMOVED*** for (ServiceEndpoint b : df) ***REMOVED***
+***REMOVED*** a = StringEncrypter.getEncrypter().decrypt(b.profile().accessPoints().iterator().next().password());
+***REMOVED*** ***REMOVED***
+***REMOVED*** return a;
+***REMOVED******REMOVED***
-
-***REMOVED***
- public String getDescription() ***REMOVED***
-***REMOVED***
-***REMOVED***
-***REMOVED***
-***REMOVED***
- public void init() throws Exception ***REMOVED***
-***REMOVED***
-
-***REMOVED***
-
-***REMOVED***
- protected void process() throws Exception ***REMOVED***
-***REMOVED***
-
-***REMOVED***
-
-***REMOVED***
- protected void setInputParameters() ***REMOVED***
-***REMOVED***
-
-***REMOVED***
-
-***REMOVED***
- public void shutdown() ***REMOVED***
-***REMOVED***
-
-***REMOVED***
public static void main(String[] args) throws Exception ***REMOVED***
***REMOVED***ScopeProvider.instance.set("/d4science.research-infrastructures.eu/gCubeApps/RPrototypingLab");
@@ -216,16 +246,22 @@ public class SendMail extends StandardLocalInfraAlgorithm ***REMOVED***
SendMail sm = new SendMail();
- ScopeProvider.instance.set("/gcube/devNext/NextNext");
- System.out.println(sm.getRootToken());
+ ***REMOVED***ScopeProvider.instance.set("/gcube/devNext/NextNext");
+ ***REMOVED***SecurityTokenProvider.instance.set("***REMOVED***");
+ ***REMOVED***System.out.println(sm.getRootToken());
***REMOVED***sm.getGenericResourceByName("");
+ ScopeProvider.instance.set("/gcube/preprod/preVRE");
+ SecurityTokenProvider.instance.set("2eceaf27-0e22-4dbe-8075-e09eff199bf9-98187548");
+
+
***REMOVED***sm.sendNotification(nh.getFailedSubject(), nh.getFailedBody("test failed"));
***REMOVED*** sm.username(SecurityTokenProvider.instance.get());
***REMOVED***sm.retrieveAdminRole();
***REMOVED***sm.getAdminRoles();
+ System.out.println(sm.getAdmins());
***REMOVED***System.out.println(sm.getAdmins());
- ***REMOVED***System.out.println(sm.getAdmins());
- ***REMOVED*** sm.sendNotification("test", "test");
+ ***REMOVED***sm.sendNotification("test", "test");
+ ***REMOVED***System.out.println(sm.getSocialService());
***REMOVED***
***REMOVED***