57 lines
1.7 KiB
Java
57 lines
1.7 KiB
Java
package org.gcube.dataanalysys.dataminerpoolmanager.clients;
|
|
|
|
import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
|
|
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
|
|
|
|
import java.util.Collection;
|
|
***REMOVED***
|
|
import java.util.Vector;
|
|
|
|
import org.gcube.common.resources.gcore.ServiceEndpoint;
|
|
***REMOVED***
|
|
import org.gcube.dataanalysys.dataminerpoolmanager.datamodel.Cluster;
|
|
import org.gcube.dataanalysys.dataminerpoolmanager.datamodel.Host;
|
|
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
|
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
|
|
|
public class ISClient ***REMOVED***
|
|
|
|
/**
|
|
* Return the list of hosts (dataminers) in a given VRE
|
|
*
|
|
* @param vreName
|
|
* @return
|
|
*/
|
|
public Collection<Host> listDataminersInVRE() ***REMOVED***
|
|
|
|
boolean remote = false;
|
|
|
|
if (!remote) ***REMOVED***
|
|
Collection<Host> out = new Vector<>();
|
|
Host h = new Host();
|
|
h.setName("bb-dataminer.res.eng.it");
|
|
out.add(h);
|
|
return out;
|
|
***REMOVED*** else ***REMOVED***
|
|
|
|
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
|
|
|
query.addCondition("$resource/Profile/Category/text() eq 'DataAnalysis'")
|
|
.addCondition("$resource/Profile/Name/text() eq 'DataMiner'");
|
|
|
|
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
|
|
|
|
List<ServiceEndpoint> resources = client.submit(query);
|
|
|
|
Collection<Host> out = new Vector<>();
|
|
for (ServiceEndpoint r : resources) ***REMOVED***
|
|
Host h = new Host();
|
|
h.setName(r.profile().runtime().hostedOn());
|
|
out.add(h);
|
|
***REMOVED***
|
|
return out;
|
|
***REMOVED***
|
|
***REMOVED***
|
|
|
|
***REMOVED***
|