Skip to content

Commit 68fe1eb

Browse files
authored
[DE-322] v7 documentation (#478)
* loadpropertiesWithPrefix test * upd doc * serde doc * shaded doc * upd ChangeLog.md
1 parent 0ab2f19 commit 68fe1eb

File tree

5 files changed

+391
-84
lines changed

5 files changed

+391
-84
lines changed

ChangeLog.md

Lines changed: 42 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -10,71 +10,79 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
1010

1111
### Changed
1212

13-
- configuration properties from local files are not read automatically anymore
13+
- configuration properties from local files are not loaded automatically anymore
1414
- `ArangoDB.execute()` accepts now target deserialization type
15-
- `Request` and `Response` support now generic body type
16-
- removed default host configuration to `127.0.0.1:8529`
15+
- `Request<T>` and `Response<T>` support now generic body type
16+
- removed default host configuration (`127.0.0.1:8529`)
1717
- changed http client library to Vert.x WebClient
1818
- changed default communication protocol from `VST` to `HTTP/2`
19-
- changed default content-type encoding format from `VPACK` to `JSON`
20-
- VPACK support is now provided by the optional dependency `com.arangodb:jackson-dataformat-velocypack` as dataformat
21-
backend for Jackson
22-
- changed serialization module, which is now based on Jackson API
23-
- data objects passed as arguments to API methods are now treated as immutable and the related metadata fields are not
24-
updated anymore (updated metadata can be found anyway in the object returned by the API method)
25-
- changed some API signatures which were using unnecessary generics
19+
- changed default content-type format from `VPACK` to `JSON`
20+
- changed internal serialization, now based on Jackson API
21+
- `VPACK` support is now provided by `JacksonSerde` including the optional dependency
22+
`com.arangodb:jackson-dataformat-velocypack` (`VPACK` dataformat backend for Jackson)
23+
- data objects passed as arguments to API methods are treated as immutable and the related metadata fields are not
24+
updated in place anymore (updated metadata can be found in the returned object)
25+
- changed some API signatures which were using unnecessary generics from `ArangoCollection`, `ArangoVertexCollection` and `ArangoEdgeCollection`
2626
- changed `ArangoCursor#getStats()` to return untyped map
27-
- modeled replication factor with a new interface (`ReplicationFactor`) with
27+
- replication factor is now represented by a new interface (`ReplicationFactor`) with
2828
implementations: `NumericReplicationFactor` and `SatelliteReplicationFactor`
29-
- all data definition classes are now `final`
29+
- all data definition classes are now `final` (packages `com.arangodb.entity` and `com.arangodb.model`)
3030
- `BaseDocument` and `BaseEdgeDocument` are now `final`
3131
- `BaseDocument#getProperties()` and `BaseEdgeDocument#getProperties()` return now an unmodifiable map
32-
- changed API method signatures removing throw declarations like: `throws ArangoDBException` (unchecked exception)
33-
- removed passwords from debug level requests logs
34-
35-
### Removed
36-
37-
- removed user data custom serializer API based on `ArangoSerialization` (in favor of `ArangoSerde`)
38-
- removed user data custom serializer implementation `ArangoJack` (in favor of `JacksonSerde`)
39-
- removed support for interpreting raw strings as JSON (in favor of `RawJson`)
40-
- removed support of data type `VPackSlice` (in favor of Jackson types: `JsonNode`, `ArrayNode`, `ObjectNode`, ...)
41-
- removed client APIs already deprecated in Java Driver version `6.19.0`
42-
- removed deprecated server APIs:
43-
- `MMFiles` related APIs
44-
- `ArangoDatabase.executeTraversal()`
45-
- `ArangoDB.getLogs()`
46-
- `minReplicationFactor` in collections and graphs
47-
- `overwrite` flag in `DocumentCreateOptions`
48-
- removed `ArangoCursorInitializer`
32+
- removed `throws ArangoDBException` from API method signatures (unchecked exception)
33+
- removed passwords from debug level requests logs (#410)
34+
- JPMS: explicit automatic module name
4935

5036
### Added
5137

5238
- added `ArangoDB.Builder.loadProperties(ConfigPropertiesProvider)` to register custom configuration providers
5339
- added `FileConfigPropertiesProvider` to load properties from local files
5440
- added support to `HTTP/2` communication protocol
55-
- added transitive dependency on `io.vertx:vertx-web-client`, which can be excluded if using VST only
41+
- added optional transitive dependency on `io.vertx:vertx-web-client` (can be excluded if using VST only)
5642
- added transitive dependency on Jackson Core, Databind and Annotations
5743
- added wrapper class for raw JSON content (`RawJson`)
5844
- added wrapper class for content already encoded as byte array (`RawBytes`)
5945
- added support for Jackson types (`JsonNode`, `ArrayNode`, `ObjectNode`, ...)
6046
- added support for Jackson annotations in data types
6147
- added new user data custom serializer API based on `ArangoSerde`
62-
- added new user data custom serializer implementation based on Jackson (`JacksonSerde`)
48+
- added new user data custom serializer implementation based on Jackson (`JacksonSerde`), supporting both `JSON` and `VPACK`)
6349
- added methods and parameters targets to meta binding annotations
6450
- added overloaded methods for CRUD operations allowing specifying the return type
6551
- added API to support CRUD operations from raw data (`RawBytes` and `RawJson`) containing multiple documents
6652
- added `BaseDocument#removeAttribute(String)` and `BaseEdgeDocument#removeAttribute(String)`
6753
- added request id to `ArangoDBException`
54+
- shaded version of the driver (`com.arangodb:arangodb-java-driver-shaded`)
6855

6956
### Fixed
7057

7158
- removed `--allow-incomplete-classpath` from native image configuration (#397)
7259
- ability to control whether `null` values are included in the serialization (#389)
7360
- added support to `DocumentCreateOptions#keepNull` (#374)
7461
- allow specifying the return type on insertDocuments (#373)
75-
- removed credentials logging (#410)
62+
- credentials logging (#410)
63+
64+
### Removed
65+
66+
- removed user data custom serializer API based on `ArangoSerialization` (in favor of `ArangoSerde`)
67+
- removed user data custom serializer implementation `ArangoJack` (in favor of `JacksonSerde`)
68+
- removed support for interpreting raw strings as JSON (in favor of `RawJson`)
69+
- removed support of data type `VPackSlice` (in favor of Jackson types: `JsonNode`, `ArrayNode`, `ObjectNode`, ...)
70+
- removed client APIs already deprecated in Java Driver version `6`
71+
- removed deprecated server APIs:
72+
- `MMFiles` related APIs
73+
- `ArangoDatabase.executeTraversal()`
74+
- `ArangoDB.getLogs()`
75+
- `minReplicationFactor` in collections and graphs
76+
- `overwrite` flag in `DocumentCreateOptions`
77+
- removed `ArangoCursorInitializer`
78+
79+
## [6.20.0] - 2022-11-29
80+
81+
- ArangoSearch cache (#472)
82+
- support for `enterprise-hex-smart-vertex` shardingStrategy
83+
- deprecated `com.arangodb.Function`
7684

77-
## [6.19.0]
85+
## [6.19.0] - 2022-10-04
7886

7987
- added support for `search-alias` views (ArangoDB 3.10 #461)
8088
- added support for nested search (ArangoDB 3.10, #460)
@@ -90,6 +98,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
9098
- deprecated fulltext indexes (ArangoDB 3.10, #454)
9199
- fixed `ConsolidationPolicy` API
92100
- deprecated MMFiles collection attributes (#442)
101+
- deprecated for removal `ArangoCursorInitializer` and `GraphDocumentReadOptions#isCatchException()`
93102
- documented thead safe classes (#445)
94103

95104
## [6.18.0] - 2022-06-07

docs/v7_detailed_changes.md

Lines changed: 102 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
# Version 7.0: detailed changes
22

3+
34
## HTTP client
45

5-
The HTTP client has been changed to Vert.x WebClient. `HTTP/2` is now supported. `HTTP/2` supports multiplexing and uses
6-
`1` connection per host by default.
6+
The HTTP client has been changed to Vert.x WebClient.
7+
8+
`HTTP/2` is now supported. `HTTP/2` supports multiplexing and uses `1` connection per host by default.
9+
710

811
## Configuration changes
912

@@ -12,11 +15,35 @@ The default communication protocol is now `HTTP2_JSON` (`HTTP/2` with `JSON` con
1215
The default host configuration to `127.0.0.1:8529` has been removed.
1316

1417
Configuration properties are not read automatically from properties files anymore.
18+
A new API for loading properties has been introduced: `ArangoDB.Builder.loadProperties(ConfigPropertiesProvider)`.
19+
Implementations could supply configuration properties coming from different sources, eg. system properties, remote
20+
stores, frameworks facilities, etc.
21+
An implementation for loading properties from local files is provided by `FileConfigPropertiesProvider`.
22+
23+
Here is an example to read config properties from `arangodb.properties` file (same behavior as in version `6`):
24+
25+
```java
26+
ArangoDB adb = new ArangoDB.Builder()
27+
.loadProperties(new FileConfigPropertiesProvider())
28+
// ...
29+
.build();
30+
```
31+
32+
Here is an example to read config properties from `arangodb-with-prefix.properties` file, where the config properties
33+
are prefixed with `adb`:
34+
35+
```java
36+
// arangodb-with-prefix.properties content:
37+
//
38+
// adb.hosts=172.28.0.1:8529
39+
// adb.acquireHostList=true
40+
// ...
41+
42+
ArangoDB adb = new ArangoDB.Builder()
43+
.loadProperties(new FileConfigPropertiesProvider("adb", "arangodb-with-prefix.properties"))
44+
.build();
45+
```
1546

16-
A new configuration option for loading properties has been
17-
introduced: `ArangoDB.Builder.loadProperties(ConfigPropertiesProvider)`. Implementations could supply configuration
18-
properties coming from different sources, eg. system properties, remote stores, frameworks facilities, etc. An
19-
implementation for loading properties from local files is provided by `FileConfigPropertiesProvider`.
2047

2148
## Transitive dependencies
2249

@@ -30,63 +57,86 @@ on `com.arangodb:jackson-dataformat-velocypack` must be provided.
3057

3158
When using protocol `HTTP_JSON` or `HTTP2_JSON` (default), no dependencies on `VPACK` libraries are required.
3259

33-
Transitive dependencies on Jackson Core, Databind and Annotations have been added, using by default version `2.13`.
60+
Transitive dependencies on Jackson Core, Databind and Annotations have been added, using by default version `2.14`.
3461
The versions of such libraries can be overridden, the driver is compatible with Jackson versions: `2.10`, `2.11`, `2.12`
35-
, `2.13`.
62+
, `2.13`, `2.14`.
63+
64+
If these dependency requirements cannot be satisfied, you might need to use the [shaded version](#arangodb-java-driver-shaded) of this driver.
65+
3666

3767
## User Data Types
3868

3969
Before version `7.0` the driver always parsed raw strings as JSON, but unfortunately this does not allow distinguishing
4070
the case when the intent is to use the raw string as such, without parsing it. Since version `7.0`, strings are not
41-
interpreted as JSON anymore. To represent user data as raw JSON, the wrapper class `RawJson` has been added.
71+
interpreted as JSON anymore. To represent user data as raw JSON, the wrapper class `RawJson` has been added:
72+
73+
```java
74+
RawJson rawJsonIn = RawJson.of("""
75+
{"foo":"bar"}
76+
""");
77+
ArangoCursor<RawJson> res = adb.db().query("RETURN @v", Map.of("v", rawJsonIn), RawJson.class);
78+
RawJson rawJsonOut = res.next();
79+
String json = rawJsonOut.getValue(); // {"foo":"bar"}
80+
```
4281

4382
To represent user data already encoded as byte array, the wrapper class `RawBytes` has been added.
44-
The byte array can either represent a `JSON` string (UTF-8 encoded) or a `VPACK` value, but the encoding must be the
83+
The byte array can either represent a `JSON` string (UTF-8 encoded) or a `VPACK` value, but the format must be the
4584
same used for the driver protocol configuration (`JSON` for `HTTP_JSON` and `HTTP2_JSON`, `VPACK` otherwise).
4685

47-
`BaseDocument` and `BaseEdgeDocument` are now `final`, they have a new method `removeAttribute(String)`
48-
and `getProperties()` returns now an unmodifiable map.
86+
The following changes have been applied to `BaseDocument` and `BaseEdgeDocument`:
87+
- `final` classes
88+
- not serializable anymore (Java serialization)
89+
- new method `removeAttribute(String)`
90+
- `getProperties()` returns an unmodifiable map
4991

50-
Before version `7.0` when performing write operations, the metadata of the input data objects was updated with the
51-
metadata received in the response. Since version `7.0`, the input data objects passed as arguments to API methods are
52-
treated as immutable and the related metadata fields are not updated anymore. The updated metadata can still be found in
53-
the object returned by the API method.
92+
Before version `7.0` when performing write operations, the metadata of the input data objects was updated in place with
93+
the metadata received in the response.
94+
Since version `7.0`, the input data objects passed as arguments to API methods are treated as immutable and the related
95+
metadata fields are not updated anymore. The updated metadata can be found in the returned object.
5496

55-
## Serialization
5697

57-
The serialization module has been changed and is now based on the Jackson API.
98+
## Serialization
5899

59-
Up to version 6, the (de)serialization was always performed to/from `VPACK`. In case the JSON representation was
100+
Up to version 6, the (de)serialization was always performed to/from `VPACK`. In case the JSON format was
60101
required, the raw `VPACK` was then converted to `JSON`. Since version 7, the serialization module is a dataformat
61-
agnostic API, based on the Jackson API. By default, it reads and writes `JSON` format. `VPACK` support is provided by
62-
the optional dependency `com.arangodb:jackson-dataformat-velocypack`, which is a dataformat backend implementation for
63-
Jackson.
64-
65-
The (de)serialization of user data can be customized by registering an implementation of `ArangoSerde`
66-
via `ArangoDB.Builder#serializer()`. The default user data serializer is `JacksonSerde`, which is based on Jackson API
67-
and is available for both `JSON` and `VPACK`. It (de)serializes user data using Jackson Databind and can handle Jackson
68-
Annotations. It can be customized through `JacksonSerde#configure(Consumer<ObjectMapper>)`, i.e. registering Kotlin or
69-
Scala modules. Furthermore, meta binding annotations (`@Id`, `@Key`, `@Rev`, `@From`, `@To`) are supported for mapping
70-
documents and edges metadata fields (`_id`, `_key`, `_rev`, `_from`, `_to`).
71-
72-
`ArangoSerde` interface is not constrained to Jackson. It is instead an abstract API that can be implemented using any
73-
custom serialization library, e.g. an example of `JSON-B` implementation can be found in
74-
the [tests](../src/test/java/com/arangodb/serde/JsonbSerdeImpl.java).
75-
76-
Independently of the user data serializer, the following data types are (de)serialized with specific handlers (not
77-
customizable):
78-
79-
- `JsonNode` and its children (`ArrayNode`, `ObjectNode`, ...)
80-
- `RawJson`
81-
- `RawBytes`
82-
- `BaseDocument`
83-
- `BaseEdgeDocument`
102+
agnostic API, by default using `JSON` format.
103+
104+
Support of data type `VPackSlice` has been removed (in favor of Jackson types: `JsonNode`, `ArrayNode`, `ObjectNode`,
105+
...), for example:
106+
107+
```java
108+
JsonNode jsonNodeIn = JsonNodeFactory.instance.objectNode()
109+
.put("foo", "bar");
110+
111+
ArangoCursor<JsonNode> res = adb.db().query("RETURN @v", Map.of("v", jsonNodeIn), JsonNode.class);
112+
JsonNode jsonNodeOut = res.next();
113+
String foo = jsonNodeOut.get("foo").textValue(); // bar
114+
```
115+
116+
The dependency on `com.arangodb:velocypack` has been removed.
117+
118+
The user data custom serializer implementation `ArangoJack` has been removed in favor of `JacksonSerde`.
119+
120+
Updated reference documentation can be found [here](v7_java-reference-serialization.md).
121+
122+
123+
## ArangoDB Java Driver Shaded
124+
125+
Since version `7`, a shaded variant of the driver is also published with maven coordinates:
126+
`com.arangodb:arangodb-java-driver-shaded`.
127+
128+
It bundles and relocates the following packages from transitive dependencies:
129+
- `com.fasterxml.jackson`
130+
- `com.arangodb.jackson.dataformat.velocypack`
131+
- `io.vertx`
132+
- `io.netty`
133+
84134

85135
## Removed APIs
86136

87137
The following client APIs have been removed:
88138

89-
- client APIs already deprecated in Java Driver version `6.19.0`
139+
- client APIs already deprecated in Java Driver version `6`
90140
- client API to interact with deprecated server APIs:
91141
- `MMFiles` related APIs
92142
- `ArangoDatabase.executeTraversal()`
@@ -104,6 +154,7 @@ Support of data type `VPackSlice` has been removed (in favor of Jackson types: `
104154
Support for custom initialization of
105155
cursors (`ArangoDB._setCursorInitializer(ArangoCursorInitializer cursorInitializer)`) has been removed.
106156

157+
107158
## API methods changes
108159

109160
Before version `7.0` some CRUD API methods inferred the return type from the type of the data object passed as input.
@@ -114,24 +165,25 @@ and `RawJson`) containing multiple documents.
114165

115166
`ArangoCursor#getStats()` returns now an untyped map.
116167

117-
`Request` and `Response` classes have been refactored to support generic body
118-
type. `ArangoDB.execute(Request<T>, Class<U>): Response<U>` accepts now the target deserialization type for the response
119-
body.
168+
`Request` and `Response` classes have been refactored to support generic body type.
169+
`ArangoDB.execute(Request<T>, Class<U>): Response<U>` accepts now the target deserialization type for the response body.
120170

121171
`ArangoDBException` has been enhanced with the id of the request causing it.
122172

173+
123174
## API entities
124175

125-
All entities and options classes are now `final`.
176+
All entities and options classes (in packages `com.arangodb.model` and `com.arangodb.entity`) are now `final`.
126177

127178
The replication factor is now modeled with a new interface (`ReplicationFactor`) with
128179
implementations: `NumericReplicationFactor` and `SatelliteReplicationFactor`.
129180

181+
130182
## Migration
131183

132-
To migrate your existing project to Java Driver version `7.0`, it is recommended updating to version `6.19` first and
133-
make sure that your code does not use any deprecated API. This can be done by checking the presence of deprecation
134-
warnings in the Java compiler output.
184+
To migrate your existing project to Java Driver version `7.0`, it is recommended updating to the latest version of
185+
branch `6` and make sure that your code does not use any deprecated API.
186+
This can be done by checking the presence of deprecation warnings in the Java compiler output.
135187

136188
The deprecation notes in the related javadoc contain information about the reason of the deprecation and suggest
137189
migration alternatives to use.

0 commit comments

Comments
 (0)