X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/c6c3d3d23d1cca50381570d0558470d47e71fd95..2251688e66191ff1169080f50868bf57e463659c:/doc/sdk/java/index.html.textile.liquid diff --git a/doc/sdk/java/index.html.textile.liquid b/doc/sdk/java/index.html.textile.liquid index f2280d279c..27984b2fe4 100644 --- a/doc/sdk/java/index.html.textile.liquid +++ b/doc/sdk/java/index.html.textile.liquid @@ -2,8 +2,7 @@ layout: default navsection: sdk navmenu: Java -title: "Java SDK" - +title: "Installation" ... The Java SDK provides a generic set of wrappers so you can make API calls in java. @@ -11,12 +10,10 @@ The Java SDK provides a generic set of wrappers so you can make API calls in jav h3. Introdution * The Java SDK requires Java 6 or later - + * The Java SDK is implemented as a maven project. Hence, you would need a working maven environment to be able to build the source code. If you do not have maven setup, -you may find the following link useful. - -http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html +you may find the "Maven in 5 Minutes":http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html link useful. * In this document $ARVADOS_HOME is used to refer to the directory where arvados code is cloned in your system. For ex: $ARVADOS_HOME = $HOME/arvados @@ -24,27 +21,23 @@ arvados code is cloned in your system. For ex: $ARVADOS_HOME = $HOME/arvados h3. Setting up the environment -* The SDK requires a running Arvados API server. The information about the - API server needs to be passed to the SDK using environment variables or - during the construction of the Arvados instance. - -* Below are the details about the environment variables and example setup - statements for a .bashrc file. - +* The SDK requires a running Arvados API server. The following information + about the API server needs to be passed to the SDK using environment + variables or during the construction of the Arvados instance. +
 ARVADOS_API_TOKEN: API client token to be used to authorize with API server.
-$ export ARVADOS_API_TOKEN=z40gplmla6i58rsg96jhg5u41ewdl5rj4g1py2s6e2lsc3
 
 ARVADOS_API_HOST: Host name of the API server.
-$ export ARVADOS_API_HOST=localhost:3001
 
 ARVADOS_API_HOST_INSECURE: Set this to true if you are using self-signed
-certificates and would like to bypass certificate validations.
-$ export ARVADOS_API_HOST_INSECURE=true
+    certificates and would like to bypass certificate validations.
 
+* Please see "api-tokens":{{site.baseurl}}/user/reference/api-tokens.html for full details. + h3. Building the Arvados SDK @@ -52,7 +45,7 @@ h3. Building the Arvados SDK
 $ cd $ARVADOS_HOME/sdk/java
 
-$ mvn clean package
+$ mvn -Dmaven.test.skip=true clean package
   This will generate arvados sdk jar file in the target directory
 
@@ -60,34 +53,39 @@ $ mvn clean package h3. Implementing your code to use SDK -$ARVADOS_HOME/sdk/java/ArvadosSDKJavaExample.java serves as a sample -implementation using the SDK. +* The following two sample programs serve as sample implementations using the SDK. +$ARVADOS_HOME/sdk/java/ArvadosSDKJavaExample.java is a simple program + that makes a few calls to API server. +$ARVADOS_HOME/sdk/java/ArvadosSDKJavaExampleWithPrompt.java can be + used to make calls to API server interactively. -Please use this file to see how you would want use the SDK from your java program. +Please use these implementations to see how you would use the SDK from your java program. Also, refer to $ARVADOS_HOME/arvados/sdk/java/src/test/java/org/arvados/sdk/java/ArvadosTest.java for more sample API invocation examples. -Below are the steps to compile and run this java program. +Below are the steps to compile and run these java program. -* ArvadosSDKJavaExample.java creates an instance of Arvados SDK class and uses it to +* These programs create an instance of Arvados SDK class and use it to make various call requests. -* To compile ArvadosSDKJavaExample.java +* To compile the examples
-$ javac -cp $ARVADOS_HOME/sdk/java/target/arvados-sdk-1.0-jar-with-dependencies.jar \
-ArvadosSDKJavaExample.java
-This results in the generation of the ArvadosSDKJavaExample.class file
-in the same directory as the java file
+$ javac -cp $ARVADOS_HOME/sdk/java/target/arvados-sdk-1.1-jar-with-dependencies.jar \
+ArvadosSDKJavaExample*.java
+This results in the generation of the ArvadosSDKJavaExample*.class files
+in the same directory as the java files
 
-* To run the sample +* To run the samples
-$ java -cp .:$ARVADOS_HOME/sdk/java/target/arvados-sdk-1.0-jar-with-dependencies.jar \
+$ java -cp .:$ARVADOS_HOME/sdk/java/target/arvados-sdk-1.1-jar-with-dependencies.jar \
 ArvadosSDKJavaExample
+$ java -cp .:$ARVADOS_HOME/sdk/java/target/arvados-sdk-1.1-jar-with-dependencies.jar \
+ArvadosSDKJavaExampleWithPrompt
 
@@ -103,11 +101,11 @@ h3. Viewing and Managing SDK logging
-$ nano $ARVADOS_HOME/sdk/java/src/main/resources/log4j.properties
+$ nano $ARVADOS_HOME/sdk/java/src/main/resources/log4j.properties
 and modify the log4j.appender.fileAppender.File property as needed.
 
 Rebuild the SDK:
-$ mvn clean package
+$ mvn -Dmaven.test.skip=true clean package
 
@@ -116,15 +114,26 @@ h3. Using the SDK in eclipse * To develop in eclipse, you can use the provided eclipse project -* Install m2eclipse plugin in your eclipse -* Set M2_REPO in eclipse to your .m2/repository directory +* Install "m2eclipse":https://www.eclipse.org/m2e/ plugin in your eclipse + +* Set M2_REPO classpath variable in eclipse to point to your local repository. +The local repository is usually located in your home directory at $HOME/.m2/repository. -* Open the SDK project in eclipse
-File -> Import -> Existing Projects into Workspace -> Next -> Browse
-and select $ARVADOS_HOME/sdk/java
+In Eclipse IDE:
+Window -> Preferences -> Java -> Build Path -> Classpath Variables
+    Click on the "New..." button and add a new
+    M2_REPO variable and set it to your local Maven repository
 
+* Open the SDK project in eclipse + +
+In Eclipse IDE:
+File -> Import -> Existing Projects into Workspace -> Next -> Browse
+    and select $ARVADOS_HOME/sdk/java
+
+