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 and ARVADOS_API_HOST_INSECURE
18 * Set ARVADOS_API_HOST_INSECURE to true if you are using self-singed
19 * certificates in development and want to bypass certificate validations.
21 * If you are not using env variables, you can pass them to Arvados constructor.
23 * Please refer to http://doc.arvados.org/api/index.html for a complete list
24 * of the available API methods.
26 public static void main(String[] args) throws Exception {
27 String apiName = "arvados";
28 String apiVersion = "v1";
30 Arvados arv = new Arvados(apiName, apiVersion);
32 // Make a users list call. Here list on users is the method being invoked.
33 // Expect a Map containing the list of users as the response.
34 System.out.println("Making an arvados users.list api call");
36 Map<String, Object> params = new HashMap<String, Object>();
38 Map response = arv.call("users", "list", params);
39 System.out.println("Arvados users.list:\n" + response);
41 // get uuid of the first user from the response
42 List items = (List)response.get("items");
44 Map firstUser = (Map)items.get(0);
45 String userUuid = (String)firstUser.get("uuid");
47 // Make a users get call on the uuid obtained above
48 System.out.println("\n\n\nMaking a users.get call for " + userUuid);
49 params = new HashMap<String, Object>();
50 params.put("uuid", userUuid);
51 response = arv.call("users", "get", params);
52 System.out.println("Arvados users.get:\n" + response);
54 // Make a pipeline_templates list call
55 System.out.println("\n\n\nMaking a pipeline_templates.list call.");
57 params = new HashMap<String, Object>();
58 response = arv.call("pipeline_templates", "list", params);
60 System.out.println("Arvados pipelinetempates.list:\n" + response);