This commit is contained in:
Nunzio Andrea Galante 2017-04-19 15:01:13 +00:00
parent f25ac50a25
commit 8238deb146
1 changed files with 90 additions and 160 deletions

View File

@ -1,69 +1,3 @@
***REMOVED******REMOVED***
***REMOVED***
***REMOVED***import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
***REMOVED***import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
***REMOVED***
***REMOVED***import java.util.Collection;
***REMOVED******REMOVED***
***REMOVED***import java.util.Vector;
***REMOVED***
***REMOVED***import org.gcube.common.resources.gcore.ServiceEndpoint;
***REMOVED******REMOVED***
***REMOVED***import org.gcube.dataanalysis.dataminer.poolmanager.datamodel.Domain;
***REMOVED******REMOVED***
***REMOVED***import org.gcube.resources.discovery.client.api.DiscoveryClient;
***REMOVED***import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
***REMOVED***
***REMOVED***public class ISClient {
***REMOVED***
***REMOVED*** /**
***REMOVED*** * Return the list of hosts (dataminers) in a given VRE
***REMOVED*** *
***REMOVED*** * @param vreName
***REMOVED*** * @return
***REMOVED*** */
***REMOVED*** public Collection<Host> listDataminersInVRE() {
***REMOVED***
***REMOVED*** boolean remote = false;
***REMOVED***
***REMOVED*** if (!remote) {
***REMOVED*** Collection<Host> out = new Vector<>();
***REMOVED*** Host h = new Host();
***REMOVED*** ***REMOVED***h.setName("bb-dataminer.res.eng.it");
***REMOVED*** ***REMOVED***h.setName("vm101.ui.savba.sk");
***REMOVED*** h.setName("dataminer1-devnext.d4science.org");
***REMOVED*** out.add(h);
***REMOVED*** return out;
***REMOVED*** ***REMOVED*** else {
***REMOVED***
***REMOVED*** SimpleQuery query = queryFor(ServiceEndpoint.class);
***REMOVED***
***REMOVED*** ***REMOVED***old version
***REMOVED*** ***REMOVED***query.addCondition("$resource/Profile/Category/text() eq 'DataAnalysis'")
***REMOVED*** ***REMOVED***.addCondition("$resource/Profile/Name/text() eq 'DataMiner'");
***REMOVED***
***REMOVED*** query.addCondition("$resource/Profile/Platform/Name/text() eq 'DataMiner'");
***REMOVED***
***REMOVED*** DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
***REMOVED***
***REMOVED*** List<ServiceEndpoint> resources = client.submit(query);
***REMOVED***
***REMOVED*** Collection<Host> out = new Vector<>();
***REMOVED*** for (ServiceEndpoint r : resources) {
***REMOVED*** Host h = new Host();
***REMOVED*** h.setName(r.profile().runtime().hostedOn());
***REMOVED*** out.add(h);
***REMOVED*** ***REMOVED***
***REMOVED*** return out;
***REMOVED*** ***REMOVED***
***REMOVED*** ***REMOVED***
***REMOVED***
***REMOVED*** public static void main(String[] args) {
***REMOVED*** ISClient a = new ISClient();
***REMOVED*** ScopeProvider.instance.set("/gcube/devNext/NextNext");
***REMOVED*** System.out.println(a.listDataminersInVRE());
***REMOVED******REMOVED***
***REMOVED******REMOVED***
***REMOVED***
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
@ -138,113 +72,109 @@ public class ISClient {
***REMOVED***
return h;
***REMOVED***
***REMOVED*** return the HProxy hostname in the VRE
public static String getHProxy(){
Host h = new Host();
SimpleQuery query = queryFor(ServiceEndpoint.class);
query.addCondition("$resource/Profile/Platform/Name/text() eq 'DataMiner'");
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
List<ServiceEndpoint> resources = client.submit(query);
h.setName(resources.get(0).profile().runtime().hostedOn());
return h.getName();
***REMOVED*** return the HProxy hostname in the VRE
public static String getHProxy() {
Host h = new Host();
SimpleQuery query = queryFor(ServiceEndpoint.class);
query.addCondition("$resource/Profile/Platform/Name/text() eq 'DataMiner'");
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
List<ServiceEndpoint> resources = client.submit(query);
h.setName(resources.get(0).profile().runtime().hostedOn());
return h.getName();
***REMOVED***
***REMOVED***return the Cluster hostname from the IS
***REMOVED***to develop
***REMOVED***public Cluster getCluster(){
***REMOVED*** Cluster cl = new Cluster();
***REMOVED*** String HProxy = this.getHProxy();
***REMOVED*** SimpleQuery query = queryFor(ServiceEndpoint.class);
***REMOVED*** query.addCondition("$resource/Profile/Platform/Name/text() eq 'DataMiner'");
***REMOVED*** DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
***REMOVED*** List<ServiceEndpoint> resources = client.submit(query);
***REMOVED*** cl.setName(resources.get(0).profile().runtime().hostedOn());
***REMOVED*** return null;
***REMOVED***
***REMOVED******REMOVED***
***REMOVED*** return the Cluster hostname from the IS
***REMOVED*** to develop
***REMOVED*** public Cluster getCluster(){
***REMOVED*** Cluster cl = new Cluster();
***REMOVED*** String HProxy = this.getHProxy();
***REMOVED*** SimpleQuery query = queryFor(ServiceEndpoint.class);
***REMOVED*** query.addCondition("$resource/Profile/Platform/Name/text() eq
***REMOVED*** 'DataMiner'");
***REMOVED*** DiscoveryClient<ServiceEndpoint> client =
***REMOVED*** clientFor(ServiceEndpoint.class);
***REMOVED*** List<ServiceEndpoint> resources = client.submit(query);
***REMOVED*** cl.setName(resources.get(0).profile().runtime().hostedOn());
***REMOVED*** return null;
***REMOVED***
***REMOVED*** ***REMOVED***
***REMOVED***return the dataminer hostnames from the IS
***REMOVED***to develop
***REMOVED***public List<Host> getDM(){
***REMOVED*** Cluster cl = new Cluster();
***REMOVED*** String HProxy = this.getHProxy();
***REMOVED*** SimpleQuery query = queryFor(ServiceEndpoint.class);
***REMOVED*** query.addCondition("$resource/Profile/Platform/Name/text() eq 'DataMiner'");
***REMOVED*** DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
***REMOVED*** List<ServiceEndpoint> resources = client.submit(query);
***REMOVED*** cl.setName(resources.get(0).profile().runtime().hostedOn());
***REMOVED*** return null;
***REMOVED***
***REMOVED******REMOVED***
***REMOVED*** return the dataminer hostnames from the IS
***REMOVED*** to develop
***REMOVED*** public List<Host> getDM(){
***REMOVED*** Cluster cl = new Cluster();
***REMOVED*** String HProxy = this.getHProxy();
***REMOVED*** SimpleQuery query = queryFor(ServiceEndpoint.class);
***REMOVED*** query.addCondition("$resource/Profile/Platform/Name/text() eq
***REMOVED*** 'DataMiner'");
***REMOVED*** DiscoveryClient<ServiceEndpoint> client =
***REMOVED*** clientFor(ServiceEndpoint.class);
***REMOVED*** List<ServiceEndpoint> resources = client.submit(query);
***REMOVED*** cl.setName(resources.get(0).profile().runtime().hostedOn());
***REMOVED*** return null;
***REMOVED***
***REMOVED*** ***REMOVED***
/**
* Return the list of hosts (dataminers) in a given VRE
*
* @param vreName
* @return
*/
public Collection<Host> listDataminersInVRE() {
/**
* Return the list of hosts (dataminers) in a given VRE
*
* @param vreName
* @return
*/
public Collection<Host> listDataminersInVRE() {
boolean remote = false;
boolean remote = false;
if (!remote) {
Collection<Host> out = new Vector<>();
Host h = new Host();
***REMOVED*** h.setName("bb-dataminer.res.eng.it");
***REMOVED*** h.setName("vm101.ui.savba.sk");
h.setName("dataminer1-devnext.d4science.org");
out.add(h);
***REMOVED***
***REMOVED*** else {
if (!remote) {
Collection<Host> out = new Vector<>();
Host h = new Host();
***REMOVED***h.setName("bb-dataminer.res.eng.it");
***REMOVED***h.setName("vm101.ui.savba.sk");
h.setName("dataminer1-devnext.d4science.org");
out.add(h);
return out;
***REMOVED*** else {
SimpleQuery query = queryFor(ServiceEndpoint.class);
SimpleQuery query = queryFor(ServiceEndpoint.class);
***REMOVED*** old version
***REMOVED*** query.addCondition("$resource/Profile/Category/text() eq
***REMOVED*** 'DataAnalysis'")
***REMOVED*** .addCondition("$resource/Profile/Name/text() eq 'DataMiner'");
***REMOVED***old version
***REMOVED***query.addCondition("$resource/Profile/Category/text() eq 'DataAnalysis'")
***REMOVED***.addCondition("$resource/Profile/Name/text() eq 'DataMiner'");
query.addCondition("$resource/Profile/Platform/Name/text() eq 'DataMiner'");
query.addCondition("$resource/Profile/Platform/Name/text() eq 'DataMiner'");
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
List<ServiceEndpoint> resources = client.submit(query);
List<ServiceEndpoint> resources = client.submit(query);
Collection<Host> out = new Vector<>();
for (ServiceEndpoint r : resources) {
Host h = new Host();
h.setName(r.profile().runtime().hostedOn());
out.add(h);
***REMOVED***
return out;
***REMOVED***
***REMOVED***
Collection<Host> out = new Vector<>();
for (ServiceEndpoint r : resources) {
Host h = new Host();
h.setName(r.profile().runtime().hostedOn());
out.add(h);
***REMOVED***
***REMOVED***
***REMOVED***
***REMOVED***
public static void main(String[] args) throws IOException, SVNException {
ISClient a = new ISClient();
ScopeProvider.instance.set("/gcube/devNext/NextNext");
***REMOVED***System.out.println(a.getHProxy());
***REMOVED***System.out.println(a.MapCluster());
***REMOVED***System.out.println(a.listDataMinersByCluster());
***REMOVED***System.out.println(a.listDataMinersByCluster());
***REMOVED***List<Dependency> list = new LinkedList<Dependency>();
***REMOVED***Dependency aa = new Dependency();
***REMOVED***aa.setName("testnunzio");
***REMOVED***aa.setType("cran:");
***REMOVED***list.add(aa);
***REMOVED***a.checkSVNdep();
***REMOVED***System.out.println(a.getDataminer("dataminer1-devnext.d4science.org").getDomain());
***REMOVED***System.out.println(a.listDataminersInVRE());
public static void main(String[] args) throws IOException, SVNException {
ISClient a = new ISClient();
ScopeProvider.instance.set("/gcube/devNext/NextNext");
***REMOVED*** System.out.println(a.getHProxy());
***REMOVED*** System.out.println(a.MapCluster());
***REMOVED*** System.out.println(a.listDataMinersByCluster());
***REMOVED*** System.out.println(a.listDataMinersByCluster());
***REMOVED*** List<Dependency> list = new LinkedList<Dependency>();
***REMOVED*** Dependency aa = new Dependency();
***REMOVED*** aa.setName("testnunzio");
***REMOVED*** aa.setType("cran:");
***REMOVED*** list.add(aa);
***REMOVED*** a.checkSVNdep();
***REMOVED*** System.out.println(a.getDataminer("dataminer1-devnext.d4science.org").getDomain());
***REMOVED*** System.out.println(a.listDataminersInVRE());
***REMOVED***
***REMOVED***