3 - Using the Arvados Java SDK, you can access API server from a java program.
5 - This document highlights the details as to how to use the SDK.
7 - The Java SDK is used as a maven project. Hence, you would need a working
8 maven environment to be able to build the source code.
10 If you do not have maven setup, you may find the following link useful.
12 http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
14 - In this document <ARVADOS_HOME> is used to refer to the directory where
15 arvados code is cloned in your system.
16 For ex: <ARVADOS_HOME> = $HOME/arvados
19 == Setting up the environment
21 - The following three environment variables are required by the SDK
23 ARVADOS_API_TOKEN, ARVADOS_API_HOST, ARVADOS_API_HOST_INSECURE
26 == Building the Arvados SDK
28 - cd <ARVADOS_HOME/sdk/java
32 This will generate arvados sdk jar file the target directory
35 == Using Arvados SDK at command line
37 - This section helps understand how to use the SDK from command line
39 - cd <ARVADOS_HOME/sdk/java
43 java -cp target/java-1.0-SNAPSHOT-jar-with-dependencies.jar org.arvados.sdk.java.Arvados help
45 java -cp target/java-1.0-SNAPSHOT-jar-with-dependencies.jar org.arvados.sdk.java.Arvados help call
47 java -cp target/java-1.0-SNAPSHOT-jar-with-dependencies.jar org.arvados.sdk.java.Arvados help discover
50 - Getting the discovery document
52 java -cp target/java-1.0-SNAPSHOT-jar-with-dependencies.jar org.arvados.sdk.java.Arvados discover arvados v1
55 - Making a "call" to the API server
57 java -cp target/java-1.0-SNAPSHOT-jar-with-dependencies.jar org.arvados.sdk.java.Arvados call arvados v1 users.list
59 java -cp target/java-1.0-SNAPSHOT-jar-with-dependencies.jar org.arvados.sdk.java.Arvados call arvados v1 users.get <uuid>
61 java -cp target/java-1.0-SNAPSHOT-jar-with-dependencies.jar org.arvados.sdk.java.Arvados call arvados v1 users.create <filename>
63 java -cp target/java-1.0-SNAPSHOT-jar-with-dependencies.jar org.arvados.sdk.java.Arvados call arvados v1 pipeline_templates.list
65 java -cp target/java-1.0-SNAPSHOT-jar-with-dependencies.jar org.arvados.sdk.java.Arvados call arvados v1 pipeline_templates.get <uuid>
67 java -cp target/java-1.0-SNAPSHOT-jar-with-dependencies.jar org.arvados.sdk.java.Arvados call arvados v1 pipeline_templates.create <filename>
70 == Implementing your code to use SDK
72 - <ARVADOS_HOME>/sdk/java/ArvadosSDKJavaUser.java serves as an example
73 implementation using the java SDK. Please use this file to see how
74 you would want use the SDK from your java program.
75 The steps below use this java class name.
77 - ArvadosSDKJavaUser.java creates an instance of Arvados SDK class and
78 uses it to make various "call" requests.
80 - To compile ArvadosSDKJavaUser.java
82 javac -cp <ARVADOS_HOME>/sdk/java/target/java-1.0-SNAPSHOT-jar-with-dependencies.jar ArvadosSDKJavaUser.java
84 This results in the generation of the ArvadosSDKJavaUser.class file
85 in the same dir as the java file
87 - To run the class file
89 java -cp .:<ARVADOS_HOME>/sdk/java/target/java-1.0-SNAPSHOT-jar-with-dependencies.jar ArvadosSDKJavaUser
92 == Viewing and managing SDK logging
94 - SDK uses log4j logging
96 - The default location of the log file is
97 <ARVADOS_HOME>/sdk/java/log/arvados_sdk_java.log
99 - Update log4j.properties file to change name and location of the log file.
101 Modify the "log4j.appender.fileAppender.File" property in log4j.properties
102 file located at <ARVADOS_HOME>/sdk/java/src/main/resources
104 Rebuild by running "mvn clean package"
107 == Using the SDK in eclipse
109 - To develop in eclipse, you can use the SDK eclipse project.
111 - Install "m2eclipse" plugin in your eclipse
113 - Open the SDK project.
115 File -> Import -> Existing Projects into Workspace -> Next -> Browse
116 and select <ARVADOS_HOME>/sdk/java