1
1
# Version 7.0: detailed changes
2
2
3
+
3
4
## HTTP client
4
5
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
+
7
10
8
11
## Configuration changes
9
12
@@ -12,11 +15,35 @@ The default communication protocol is now `HTTP2_JSON` (`HTTP/2` with `JSON` con
12
15
The default host configuration to ` 127.0.0.1:8529 ` has been removed.
13
16
14
17
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
+ ```
15
46
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 ` .
20
47
21
48
## Transitive dependencies
22
49
@@ -30,63 +57,86 @@ on `com.arangodb:jackson-dataformat-velocypack` must be provided.
30
57
31
58
When using protocol ` HTTP_JSON ` or ` HTTP2_JSON ` (default), no dependencies on ` VPACK ` libraries are required.
32
59
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 ` .
34
61
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
+
36
66
37
67
## User Data Types
38
68
39
69
Before version ` 7.0 ` the driver always parsed raw strings as JSON, but unfortunately this does not allow distinguishing
40
70
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
+ ```
42
81
43
82
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
45
84
same used for the driver protocol configuration (` JSON ` for ` HTTP_JSON ` and ` HTTP2_JSON ` , ` VPACK ` otherwise).
46
85
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
49
91
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 .
54
96
55
- ## Serialization
56
97
57
- The serialization module has been changed and is now based on the Jackson API.
98
+ ## Serialization
58
99
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
60
101
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
+
84
134
85
135
## Removed APIs
86
136
87
137
The following client APIs have been removed:
88
138
89
- - client APIs already deprecated in Java Driver version ` 6.19.0 `
139
+ - client APIs already deprecated in Java Driver version ` 6 `
90
140
- client API to interact with deprecated server APIs:
91
141
- ` MMFiles ` related APIs
92
142
- ` ArangoDatabase.executeTraversal() `
@@ -104,6 +154,7 @@ Support of data type `VPackSlice` has been removed (in favor of Jackson types: `
104
154
Support for custom initialization of
105
155
cursors (` ArangoDB._setCursorInitializer(ArangoCursorInitializer cursorInitializer) ` ) has been removed.
106
156
157
+
107
158
## API methods changes
108
159
109
160
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.
114
165
115
166
` ArangoCursor#getStats() ` returns now an untyped map.
116
167
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.
120
170
121
171
` ArangoDBException ` has been enhanced with the id of the request causing it.
122
172
173
+
123
174
## API entities
124
175
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 ` .
126
177
127
178
The replication factor is now modeled with a new interface (` ReplicationFactor ` ) with
128
179
implementations: ` NumericReplicationFactor ` and ` SatelliteReplicationFactor ` .
129
180
181
+
130
182
## Migration
131
183
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.
135
187
136
188
The deprecation notes in the related javadoc contain information about the reason of the deprecation and suggest
137
189
migration alternatives to use.
0 commit comments