2 * This Sample test program is useful in getting started with working with Arvados Java SDK.
3 * Please also see arvadso
8 import org.arvados.sdk.java.Arvados;
11 import java.util.HashMap;
12 import java.util.List;
15 public class ArvadosSDKJavaExample {
16 /** Make sure the following environment variables are set before using Arvados:
17 * ARVADOS_API_TOKEN, ARVADOS_API_HOST, ARVADOS_API_HOST_INSECURE
19 public static void main(String[] args) throws Exception {
20 String apiName = "arvados";
21 String apiVersion = "v1";
23 Arvados arv = new Arvados(apiName, apiVersion);
25 // Make a users.list call
26 System.out.println("Making an arvados users.list api call");
28 Map<String, Object> params = new HashMap<String, Object>();
30 Map response = arv.call("users", "list", params);
31 System.out.println("Arvados users.list:\n" + response);
33 // get uuid of the first user from the response
34 List items = (List)response.get("items");
36 Map firstUser = (Map)items.get(0);
37 String userUuid = (String)firstUser.get("uuid");
39 // Make a users.get call on the uuid obtained above
40 System.out.println("Making a users.get call for " + userUuid);
41 params = new HashMap<String, Object>();
42 params.put("uuid", userUuid);
43 response = arv.call("users", "get", params);
44 System.out.println("Arvados users.get:\n" + response);
46 // Make a pipeline_templates.list call
47 System.out.println("Making a pipeline_templates.list call.");
49 params = new HashMap<String, Object>();
50 response = arv.call("pipeline_templates", "list", params);
52 System.out.println("Arvados pipelinetempates.list:\n" + response);