8 Copyright (C) The Arvados Authors. All rights reserved.
10 SPDX-License-Identifier: CC-BY-SA-3.0
13 The Java SDK v2 provides a high level API for working with Arvados resources and files in Keep.
15 h2. Building the Arvados SDK
17 * The Java SDK requires Java 8 or later
19 * The Java SDK is implemented as a Gradle project. Gradle is included in the source tree.
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
34 SLF4J is used for logging. Concrete logging framework and configuration must be provided by a client.
38 "TypeSafe Configuration":https://github.com/lightbend/config is used for configuring this library.
40 Please, have a look at java/resources/reference.conf for default values provided with this library.
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)
55 In order to override default settings one can create application.conf file in an application. Example: src/test/resources/application.conf.
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.
59 ArvadosFacade has two constructors, one without arguments that uses values from reference.conf and second one taking ExternalConfigProvider as an argument.
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.
65 Parameters provided to common or specific methods are String UUID or fields wrapped in Java objects. For example:
67 {% codeblock as java %}
68 String uuid = "ardev-4zz18-rxcql7qwyakg1r1";
70 Collection actual = client.get(uuid);
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")
82 CollectionList actual = client.list(listArgument);
85 Non-standard API clients must inherit from BaseApiClient. For example: KeepServerApiClient communicates directly with Keep servers using exclusively non-common methods.
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:
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**
102 h3. Note regarding Keep-Web
104 Current version requires both Keep Web and standard Keep Server API configured in order to use Keep-Web functionalities.
106 h3. Integration tests
108 In order to run integration tests all fields within following configuration file must be provided:
111 src/test/resources/integration-test-appliation.conf
114 Parameter **integration-tests.project-uuid** should contain UUID of one project available to user, whose token was provided within configuration file.
116 Integration tests require connection to real Arvados server.
118 h3. Note regarding file naming
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.
124 See "Javadoc":javadoc.html