66 lines
1.9 KiB
Java
66 lines
1.9 KiB
Java
***REMOVED***
|
|
|
|
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.dataanalysis.dataminer.poolmanager.datamodel.Domain;
|
|
***REMOVED***
|
|
import org.gcube.resources.discovery.client.api.DiscoveryClient;
|
|
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
|
|
|
|
public class ISClient {
|
|
|
|
/**
|
|
* Return the list of hosts (dataminers) in a given VRE
|
|
*
|
|
* @param vreName
|
|
* @return
|
|
*/
|
|
public Collection<Host> listDataminersInVRE() {
|
|
|
|
boolean remote = false;
|
|
|
|
if (!remote) {
|
|
Collection<Host> out = new Vector<>();
|
|
Host h = new Host();
|
|
***REMOVED***h.setName("bb-dataminer.res.eng.it");
|
|
h.setName("vm123.ui.savba.sk");
|
|
out.add(h);
|
|
return out;
|
|
***REMOVED*** else {
|
|
|
|
SimpleQuery query = queryFor(ServiceEndpoint.class);
|
|
|
|
***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'");
|
|
|
|
DiscoveryClient<ServiceEndpoint> client = clientFor(ServiceEndpoint.class);
|
|
|
|
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***
|
|
|
|
public static void main(String[] args) {
|
|
ISClient a = new ISClient();
|
|
ScopeProvider.instance.set("/gcube/devNext/NextNext");
|
|
System.out.println(a.listDataminersInVRE());
|
|
***REMOVED***
|
|
***REMOVED***
|