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
1215The default host configuration to ` 127.0.0.1:8529 ` has been removed.
1316
1417Configuration 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
3158When 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 ` .
3461The 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
3969Before version ` 7.0 ` the driver always parsed raw strings as JSON, but unfortunately this does not allow distinguishing
4070the 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
4382To 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
4584same 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
60101required, 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
87137The 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: `
104154Support for custom initialization of
105155cursors (` ArangoDB._setCursorInitializer(ArangoCursorInitializer cursorInitializer) ` ) has been removed.
106156
157+
107158## API methods changes
108159
109160Before 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
127178The replication factor is now modeled with a new interface (` ReplicationFactor ` ) with
128179implementations: ` 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
136188The deprecation notes in the related javadoc contain information about the reason of the deprecation and suggest
137189migration alternatives to use.
0 commit comments