14670: Tweak install instructions
[arvados.git] / doc / sdk / java-v2 / index.html.textile.liquid
1 ---
2 layout: default
3 navsection: sdk
4 navmenu: Java SDK v2
5 title: "Installation"
6 ...
7 {% comment %}
8 Copyright (C) The Arvados Authors. All rights reserved.
9
10 SPDX-License-Identifier: CC-BY-SA-3.0
11 {% endcomment %}
12
13 The Java SDK v2 provides a high level API for working with Arvados resources and files in Keep.
14
15 h2. Building the Arvados SDK
16
17 * The Java SDK requires Java 8 or later
18
19 * The Java SDK is implemented as a Gradle project. Gradle is included in the source tree.
20
21 <notextile>
22 <pre>
23 $ <code class="userinput">git clone https://github.com/curoverse/arvados.git</code>
24 $ <code class="userinput">cd arvados/sdk/java-v2</code>
25 $ <code class="userinput">./gradlew jar</code>
26   This will generate arvados sdk jar file in build/libs/arvados-java-2.0.0.jar
27 </pre>
28 </notextile>
29
30 h2. Using the SDK
31
32 h3. Logging
33
34 SLF4J is used for logging. Concrete logging framework and configuration must be provided by a client.
35
36 h3. Configuration
37
38 "TypeSafe Configuration":https://github.com/lightbend/config is used for configuring this library.
39
40 Please, have a look at java/resources/reference.conf for default values provided with this library.
41
42 * **keepweb-host** - change to host of your Keep-Web installation
43 * **keepweb-port** - change to port of your Keep-Web installation
44 * **host** - change to host of your Arvados installation
45 * **port** - change to port of your Arvados installation
46 * **token** - authenticates registered user, one must provide "token obtained from Arvados Workbench":https://doc.arvados.org/user/reference/api-tokens.html
47 * **protocol** - don't change to unless really needed
48 * **host-insecure** - insecure communication with Arvados (ignores SSL certificate verification), don't change to *true* unless really needed
49 * **split-size** - size of chunk files in megabytes
50 * **temp-dir** - temporary chunk files storage
51 * **copies** - amount of chunk files duplicates per Keep server
52 * **retries** - in case of chunk files send failure this should allow to repeat send
53   (*NOTE*: this parameter is not used at the moment but was left for future improvements)
54
55 In order to override default settings one can create application.conf file in an application.  Example: src/test/resources/application.conf.
56
57 Alternatively ExternalConfigProvider class can be used to pass configuration via code.  ExternalConfigProvider comes with a builder and all of the above values must be provided in order for it to work properly.
58
59 ArvadosFacade has two constructors, one without arguments that uses values from reference.conf and second one taking ExternalConfigProvider as an argument.
60
61 h3. API clients
62
63 All API clients inherit from BaseStandardApiClient. This class contains implementation of all common methods as described in http://doc.arvados.org/api/methods.html.
64
65 Parameters provided to common or specific methods are String UUID or fields wrapped in Java objects. For example:
66
67 {% codeblock as java %}
68 String uuid = "ardev-4zz18-rxcql7qwyakg1r1";
69
70 Collection actual = client.get(uuid);
71 {% endcodeblock %}
72
73 {% codeblock as java %}
74 ListArgument listArgument = ListArgument.builder()
75         .filters(Arrays.asList(
76                 Filter.of("owner_uuid", Operator.LIKE, "ardev%"),
77                 Filter.of("name", Operator.LIKE, "Super%"),
78                 Filter.of("portable_data_hash", Operator.IN, Lists.newArrayList("54f6d9f59065d3c009d4306660989379+65")
79             )))
80         .build();
81
82 CollectionList actual = client.list(listArgument);
83 {% endcodeblock %}
84
85 Non-standard API clients must inherit from BaseApiClient. For example: KeepServerApiClient communicates directly with Keep servers using exclusively non-common methods.
86
87 h3. Business logic
88
89 More advanced API data handling could be implemented as *Facade* classes. In current version functionalities provided by SDK are handled by *ArvadosFacade*. They include:
90
91 * **downloading single file from collection** - using Keep-Web
92 * **downloading whole collection** - using Keep-Web or Keep Server API
93 * **listing file info from certain collection** - information is returned as list of *FileTokens* providing file details
94 * **uploading single file** - to either new or existing collection
95 * **uploading list of files** - to either new or existing collection
96 * **creating an empty collection**
97 * **getting current user info**
98 * **listing current user's collections**
99 * **creating new project**
100 * **deleting certain collection**
101
102 h3. Note regarding Keep-Web
103
104 Current version requires both Keep Web and standard Keep Server API configured in order to use Keep-Web functionalities.
105
106 h3. Integration tests
107
108 In order to run integration tests all fields within following configuration file must be provided:
109
110 <code>
111 src/test/resources/integration-test-appliation.conf
112 </code>
113
114 Parameter **integration-tests.project-uuid** should contain UUID of one project available to user, whose token was provided within configuration file.
115
116 Integration tests require connection to real Arvados server.
117
118 h3. Note regarding file naming
119
120 While uploading via this SDK all uploaded files within single collection must have different names. This applies also to uploading files to already existing collection. Renaming files with duplicate names is not implemented in current version.
121
122 h3. Javadoc
123
124 See "Javadoc":javadoc.html