diff --git a/pom.xml b/pom.xml
index 5fab181..ae79125 100644
--- a/pom.xml
+++ b/pom.xml
@@ -33,6 +33,13 @@
common-smartgears
provided
+
+
+
+ org.gcube.core
+ common-smartgears-app
+
+
org.gcube.resources.discovery
diff --git a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/StagingJob.java b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/StagingJob.java
index 283e42c..daea422 100644
--- a/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/StagingJob.java
+++ b/src/main/java/org/gcube/dataanalysis/dataminer/poolmanager/service/StagingJob.java
@@ -18,6 +18,8 @@ import org.gcube.dataanalysis.dataminer.poolmanager.util.NotificationHelper;
import org.gcube.dataanalysis.dataminer.poolmanager.util.SVNUpdater;
import org.gcube.dataanalysis.dataminer.poolmanager.util.SendMail;
import org.gcube.dataanalysis.dataminer.poolmanager.util.ServiceConfiguration;
+import org.gcube.smartgears.ContextProvider;
+import org.gcube.smartgears.context.application.ApplicationContext;
public class StagingJob extends DMPMJob {
@@ -149,5 +151,7 @@ public class StagingJob extends DMPMJob {
"Caller VRE: "+rProtoVREName+
"Target VRE: "+rProtoVREName;
}
+
+
}
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 fd9107a..6f5c723 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
@@ -1,6 +1,8 @@
package org.gcube.dataanalysis.dataminer.poolmanager.util;
import static org.gcube.common.authorization.client.Constants.authorizationService;
+import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
+import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
import java.net.URLEncoder;
import java.util.LinkedList;
@@ -14,11 +16,18 @@ import org.apache.http.util.EntityUtils;
import org.gcube.common.authorization.client.exceptions.ObjectNotFound;
import org.gcube.common.authorization.library.AuthorizationEntry;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
+import org.gcube.common.encryption.StringEncrypter;
+import org.gcube.common.resources.gcore.GenericResource;
+import org.gcube.common.resources.gcore.ServiceEndpoint;
import org.gcube.common.scope.api.ScopeProvider;
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.resources.discovery.client.api.DiscoveryClient;
+import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
+import org.gcube.smartgears.ContextProvider;
+import org.gcube.smartgears.context.application.ApplicationContext;
import org.json.JSONArray;
import org.json.JSONObject;
@@ -138,6 +147,32 @@ public class SendMail extends StandardLocalInfraAlgorithm {
return s.toString().replace("[", "").replace("]", "");
}
+
+
+
+
+
+ public String getRootToken() throws Exception {
+
+ //ApplicationContext ctx = ContextProvider.get(); // get this info from
+ // SmartGears
+ //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) {
+ a = StringEncrypter.getEncrypter().decrypt(b.profile().accessPoints().iterator().next().password());
+ }
+ return a;
+ }
+
+
+
+
@Override
public String getDescription() {
// TODO Auto-generated method stub
@@ -169,16 +204,21 @@ public class SendMail extends StandardLocalInfraAlgorithm {
}
public static void main(String[] args) throws Exception {
- ScopeProvider.instance.set("/d4science.research-infrastructures.eu/gCubeApps/RPrototypingLab");
- SecurityTokenProvider.instance.set("3a23bfa4-4dfe-44fc-988f-194b91071dd2-843339462");
+ //ScopeProvider.instance.set("/d4science.research-infrastructures.eu/gCubeApps/RPrototypingLab");
+ //SecurityTokenProvider.instance.set("3a23bfa4-4dfe-44fc-988f-194b91071dd2-843339462");
//ScopeProvider.instance.set("/gcube/devNext");
//SecurityTokenProvider.instance.set("aa6eec71-fe07-43ab-bd1c-f03df293e430-98187548");
- NotificationHelper nh = new NotificationHelper();
+ //NotificationHelper nh = new NotificationHelper();
SendMail sm = new SendMail();
- sm.sendNotification(nh.getFailedSubject(), nh.getFailedBody("test failed"));
+
+ ScopeProvider.instance.set("/gcube/devNext/NextNext");
+ System.out.println(sm.getRootToken());
+ //sm.getGenericResourceByName("");
+
+ //sm.sendNotification(nh.getFailedSubject(), nh.getFailedBody("test failed"));
// sm.username(SecurityTokenProvider.instance.get());
//sm.retrieveAdminRole();
//sm.getAdminRoles();