Skip to content

Commit 934e69b

Browse files
committed
Merge branch 'feature/v3' into develop
Implement the v3 API. Fix: #4
2 parents aecf39d + b053e85 commit 934e69b

File tree

119 files changed

+10205
-5107
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+10205
-5107
lines changed

README.md

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,44 +11,62 @@ A Java client for the [AdoptOpenJDK REST API](https://api.adoptopenjdk.net/).
1111

1212
![adoptopenjdk](./src/site/resources/adoptopenjdk.jpg?raw=true)
1313

14-
Usage
15-
===
14+
## Features
15+
16+
* Efficient, type-safe access to the AdoptOpenJDK API
17+
* Clean API/implementation separation for easy API mocking in applications
18+
* [JPMS](https://openjdk.java.net/projects/jigsaw/spec/)-ready
19+
* [OSGi](https://www.osgi.org)-ready
20+
* High coverage automated test suite
21+
* Apache 2.0 license
22+
* Fully documented (JavaDOC)
23+
24+
## Usage
1625

1726
Use the following Maven dependencies:
1827

1928
```
2029
<dependency>
2130
<groupId>net.adoptopenjdk</groupId>
22-
<artifactId>net.adoptopenjdk.api</artifactId>
31+
<artifactId>net.adoptopenjdk.v3.api</artifactId>
2332
<version><!-- Insert latest version --></version>
2433
</dependency>
2534
<dependency>
2635
<groupId>net.adoptopenjdk</groupId>
27-
<artifactId>net.adoptopenjdk.v1</artifactId>
36+
<artifactId>net.adoptopenjdk.v3.vanilla</artifactId>
2837
<version><!-- Insert latest version --></version>
2938
</dependency>
3039
```
3140

3241
The first dependency specifies that you want to use the API, and the second
33-
is a basic provider for the version `1.0.0` API.
42+
is a basic provider for the version API.
3443

3544
Then:
3645

3746
```
38-
AdoptOpenJDKRequestsType requests = AdoptOpenJDK.get(1);
39-
40-
List<AOVariants> variants = requests.variants();
41-
assert variants.size() > 0;
47+
var clients = new AOV3Clients();
48+
try (var client = clients.createClient()) {
49+
var request = client.availableReleases(...);
50+
var releases = request.execute();
51+
}
52+
```
4253

43-
List<AORelease> releases =
44-
requests.releasesForVariant(variants.get(0).name());
54+
The API operates entirely synchronously and raises checked exceptions on
55+
failures.
4556

46-
List<AORelease> releases_8 =
47-
requests.releasesForVariant("openjdk8");
57+
The `net.adoptopenjdk.v3.api.AOV3ClientProviderType` interface is published
58+
both as a JPMS service and an [OSGi service](https://www.osgi.org) in order to
59+
allow for decoupling consumers from the `vanilla` implementation package:
4860

49-
List<AORelease> nightlies_9 =
50-
requests.nightlyBuildsForVariant("openjdk9");
5161
```
62+
var clients =
63+
ServiceLoader.load(AOV3ClientProviderType.class)
64+
.findFirst()
65+
.orElseThrow(() -> new IllegalStateException(
66+
String.format("No implementations of %s are available", AOV3ClientProviderType.class)));
5267
53-
The API operates entirely synchronously and raises checked exceptions on
54-
failures. Do not share values of type `AdoptOpenJDKRequestsType` across threads.
68+
try (var client = clients.createClient()) {
69+
var request = client.availableReleases(...);
70+
var releases = request.execute();
71+
}
72+
```

net.adoptopenjdk.api/pom.xml

Lines changed: 0 additions & 46 deletions
This file was deleted.

net.adoptopenjdk.api/src/main/java/net/adoptopenjdk/api/AdoptOpenJDK.java

Lines changed: 0 additions & 143 deletions
This file was deleted.

net.adoptopenjdk.checkstyle/pom.xml

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)