diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 896069eb4..52114c15d 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -129,3 +129,46 @@ jobs:
run: mvn -version
- name: Test
run: mvn --no-transfer-progress test -DargLine="-Duser.language=${{matrix.user-language}}"
+
+ jackson-test:
+ timeout-minutes: 20
+ runs-on: ubuntu-latest
+
+ strategy:
+ fail-fast: false
+ matrix:
+ jackson-version:
+ - 2.13.3
+ - 2.12.7
+ - 2.11.4
+ - 2.10.5
+ docker-img:
+ - docker.io/arangodb/arangodb:3.9.1
+ topology:
+ - single
+ db-ext-names:
+ - false
+ java-version:
+ - 17
+ user-language:
+ - en
+
+ steps:
+ - uses: actions/checkout@v2
+ - name: Set up JDK
+ uses: actions/setup-java@v2
+ with:
+ java-version: ${{matrix.java-version}}
+ distribution: 'adopt'
+ cache: maven
+ - name: Start Database
+ run: ./docker/start_db.sh
+ env:
+ ARANGO_LICENSE_KEY: ${{ secrets.ARANGO_LICENSE_KEY }}
+ STARTER_MODE: ${{matrix.topology}}
+ DOCKER_IMAGE: ${{matrix.docker-img}}
+ DATABASE_EXTENDED_NAMES: ${{matrix.db-ext-names}}
+ - name: Info
+ run: mvn -version
+ - name: Test
+ run: mvn --no-transfer-progress test -Djackson.version=${{jackson-version}}
diff --git a/pom.xml b/pom.xml
index 649739b52..355b4c4dc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,6 +23,7 @@
UTF-8
+ 2.13.3
@@ -89,7 +90,7 @@
org.graalvm.buildtoolsnative-maven-plugin
- 0.9.11
+ 0.9.13true
@@ -102,6 +103,7 @@
+ truefalse--no-fallback
@@ -233,10 +235,6 @@
-
- com.arangodb
- velocypack
- org.slf4jslf4j-api
@@ -245,11 +243,28 @@
org.apache.httpcomponentshttpclient
+
+ com.fasterxml.jackson.core
+ jackson-databind
+
+
+ com.fasterxml.jackson.core
+ jackson-core
+
+
+ com.fasterxml.jackson.core
+ jackson-annotations
+ com.arangodbjackson-dataformat-velocypacktrue
+
+ jakarta.json.bind
+ jakarta.json.bind-api
+ 3.0.0
+ ch.qos.logbacklogback-classic
@@ -288,10 +303,23 @@
22.1.0test
+
+ org.eclipse
+ yasson
+ 3.0.0
+ test
+
+
+ com.fasterxml.jackson
+ jackson-bom
+ ${jackson.version}
+ import
+ pom
+ com.arangodbjackson-dataformat-velocypack
@@ -317,11 +345,6 @@
commons-logging1.2
-
- com.arangodb
- velocypack
- 2.5.4
- org.slf4jslf4j-api
diff --git a/src/main/java/com/arangodb/ArangoCollection.java b/src/main/java/com/arangodb/ArangoCollection.java
index 2073ff689..c77a228f4 100644
--- a/src/main/java/com/arangodb/ArangoCollection.java
+++ b/src/main/java/com/arangodb/ArangoCollection.java
@@ -35,7 +35,7 @@
* @see Documents API Documentation
*/
@SuppressWarnings("UnusedReturnValue")
-public interface ArangoCollection extends ArangoSerializationAccessor {
+public interface ArangoCollection extends ArangoSerdeAccessor {
/**
* The the handler of the database the collection is within
@@ -55,7 +55,7 @@ public interface ArangoCollection extends ArangoSerializationAccessor {
* Creates a new document from the given document, unless there is already a document with the _key given. If no
* _key is given, a new unique _key is generated automatically.
*
- * @param value A representation of a single document (POJO, VPackSlice or String for JSON)
+ * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return information about the document
* @throws ArangoDBException
* @see API
@@ -67,7 +67,7 @@ public interface ArangoCollection extends ArangoSerializationAccessor {
* Creates a new document from the given document, unless there is already a document with the _key given. If no
* _key is given, a new unique _key is generated automatically.
*
- * @param value A representation of a single document (POJO, VPackSlice or String for JSON)
+ * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return information about the document
* @throws ArangoDBException
@@ -83,7 +83,7 @@ public interface ArangoCollection extends ArangoSerializationAccessor {
* Limitations:
* - the fields having {@code null} value are always removed during serialization
*
- * @param values A List of documents (POJO, VPackSlice or String for JSON)
+ * @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return information about the documents
* @throws ArangoDBException
* @see API
@@ -98,7 +98,7 @@ public interface ArangoCollection extends ArangoSerializationAccessor {
* Limitations:
* - the fields having {@code null} value are always removed during serialization
*
- * @param values A List of documents (POJO, VPackSlice or String for JSON)
+ * @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return information about the documents
* @throws ArangoDBException
@@ -162,7 +162,7 @@ MultiDocumentEntity> insertDocuments(
* Retrieves the document with the given {@code key} from the collection.
*
* @param key The key of the document
- * @param type The type of the document (POJO class, VPackSlice or String for JSON)
+ * @param type The type of the document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return the document identified by the key
* @throws ArangoDBException
* @see API
@@ -174,7 +174,7 @@ MultiDocumentEntity> insertDocuments(
* Retrieves the document with the given {@code key} from the collection.
*
* @param key The key of the document
- * @param type The type of the document (POJO class, VPackSlice or String for JSON)
+ * @param type The type of the document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return the document identified by the key
* @throws ArangoDBException
@@ -187,7 +187,7 @@ MultiDocumentEntity> insertDocuments(
* Retrieves multiple documents with the given {@code _key} from the collection.
*
* @param keys The keys of the documents
- * @param type The type of the documents (POJO class, VPackSlice or String for JSON)
+ * @param type The type of the documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return the documents and possible errors
* @throws ArangoDBException
*/
@@ -197,7 +197,7 @@ MultiDocumentEntity> insertDocuments(
* Retrieves multiple documents with the given {@code _key} from the collection.
*
* @param keys The keys of the documents
- * @param type The type of the documents (POJO class, VPackSlice or String for JSON)
+ * @param type The type of the documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return the documents and possible errors
* @throws ArangoDBException
@@ -210,7 +210,7 @@ MultiDocumentEntity getDocuments(Collection keys, Class type,
* precondition is violated
*
* @param key The key of the document
- * @param value A representation of a single document (POJO, VPackSlice or String for JSON)
+ * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return information about the document
* @throws ArangoDBException
* @see API
@@ -223,7 +223,7 @@ MultiDocumentEntity getDocuments(Collection keys, Class type,
* precondition is violated
*
* @param key The key of the document
- * @param value A representation of a single document (POJO, VPackSlice or String for JSON)
+ * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return information about the document
* @throws ArangoDBException
@@ -240,7 +240,7 @@ DocumentUpdateEntity replaceDocument(String key, T value, DocumentReplace
* Limitations:
* - the fields having {@code null} value are always removed during serialization
*
- * @param values A List of documents (POJO, VPackSlice or String for JSON)
+ * @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return information about the documents
* @throws ArangoDBException
* @see API
@@ -255,7 +255,7 @@ DocumentUpdateEntity replaceDocument(String key, T value, DocumentReplace
* Limitations:
* - the fields having {@code null} value are always removed during serialization
*
- * @param values A List of documents (POJO, VPackSlice or String for JSON)
+ * @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return information about the documents
* @throws ArangoDBException
@@ -271,7 +271,7 @@ MultiDocumentEntity> replaceDocuments(
* they do not yet exist, and overwritten in the existing document if they do exist there.
*
* @param key The key of the document
- * @param value A representation of a single document (POJO, VPackSlice or String for JSON)
+ * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return information about the document
* @throws ArangoDBException
* @see API
@@ -285,7 +285,7 @@ MultiDocumentEntity> replaceDocuments(
* they do not yet exist, and overwritten in the existing document if they do exist there.
*
* @param key The key of the document
- * @param value A representation of a single document (POJO, VPackSlice or String for JSON)
+ * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return information about the document
* @throws ArangoDBException
@@ -301,7 +301,7 @@ DocumentUpdateEntity updateDocument(String key, T value, DocumentUpdateOp
* they do not yet exist, and overwritten in the existing document if they do exist there.
*
* @param key The key of the document
- * @param value A representation of a single document (POJO, VPackSlice or String for JSON)
+ * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @param returnType Type of the returned newDocument and/or oldDocument
* @return information about the document
@@ -318,7 +318,7 @@ DocumentUpdateEntity updateDocument(String key, T value, DocumentUpdat
* attributes from the patch documents will be added to the existing documents if they do not yet exist, and
* overwritten in the existing documents if they do exist there.
*
- * @param values A list of documents (POJO, VPackSlice or String for JSON)
+ * @param values A list of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return information about the documents
* @throws ArangoDBException
* @see API
@@ -332,7 +332,7 @@ DocumentUpdateEntity updateDocument(String key, T value, DocumentUpdat
* attributes from the patch documents will be added to the existing documents if they do not yet exist, and
* overwritten in the existing documents if they do exist there.
*
- * @param values A list of documents (POJO, VPackSlice or String for JSON)
+ * @param values A list of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return information about the documents
* @throws ArangoDBException
@@ -348,7 +348,7 @@ MultiDocumentEntity> updateDocuments(
* attributes from the patch documents will be added to the existing documents if they do not yet exist, and
* overwritten in the existing documents if they do exist there.
*
- * @param values A list of documents (POJO, VPackSlice or String for JSON)
+ * @param values A list of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @param returnType Type of the returned newDocument and/or oldDocument
* @return information about the documents
@@ -374,7 +374,7 @@ MultiDocumentEntity> updateDocuments(
* Deletes the document with the given {@code key} from the collection.
*
* @param key The key of the document
- * @param type The type of the document (POJO class, VPackSlice or String for JSON). Only necessary if
+ * @param type The type of the document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes}). Only necessary if
* options.returnOld is set to true, otherwise can be null.
* @param options Additional options, can be null
* @return information about the document
@@ -401,7 +401,7 @@ DocumentDeleteEntity deleteDocument(String key, Class type, DocumentDe
* Deletes multiple documents from the collection.
*
* @param values The keys of the documents or the documents themselves
- * @param type The type of the documents (POJO class, VPackSlice or String for JSON). Only necessary if
+ * @param type The type of the documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes}). Only necessary if
* options.returnOld is set to true, otherwise can be null.
* @param options Additional options, can be null
* @return information about the documents
diff --git a/src/main/java/com/arangodb/ArangoCursor.java b/src/main/java/com/arangodb/ArangoCursor.java
index eab1e2a88..928f14239 100644
--- a/src/main/java/com/arangodb/ArangoCursor.java
+++ b/src/main/java/com/arangodb/ArangoCursor.java
@@ -20,8 +20,8 @@
package com.arangodb;
-import com.arangodb.entity.CursorEntity.Stats;
-import com.arangodb.entity.CursorEntity.Warning;
+import com.arangodb.entity.CursorStats;
+import com.arangodb.entity.CursorWarning;
import java.io.Closeable;
import java.util.Collection;
@@ -53,12 +53,12 @@ public interface ArangoCursor extends ArangoIterable, ArangoIterator, C
* number of modified documents and the number of documents that could not be modified due to an error (if
* ignoreErrors query option is specified)
*/
- Stats getStats();
+ CursorStats getStats();
/**
* @return warnings which the query could have been produced
*/
- Collection getWarnings();
+ Collection getWarnings();
/**
* @return indicating whether the query result was served from the query cache or not
diff --git a/src/main/java/com/arangodb/ArangoDB.java b/src/main/java/com/arangodb/ArangoDB.java
index f58064a08..9b112c97e 100644
--- a/src/main/java/com/arangodb/ArangoDB.java
+++ b/src/main/java/com/arangodb/ArangoDB.java
@@ -28,22 +28,19 @@
import com.arangodb.internal.http.HttpCommunication;
import com.arangodb.internal.http.HttpConnectionFactory;
import com.arangodb.internal.net.*;
-import com.arangodb.internal.util.ArangoDeserializerImpl;
-import com.arangodb.internal.util.ArangoSerializationFactory;
-import com.arangodb.internal.util.ArangoSerializerImpl;
-import com.arangodb.internal.util.DefaultArangoSerialization;
+import com.arangodb.serde.InternalSerde;
import com.arangodb.internal.velocystream.VstCommunicationSync;
import com.arangodb.internal.velocystream.VstConnectionFactorySync;
import com.arangodb.model.DBCreateOptions;
import com.arangodb.model.LogOptions;
import com.arangodb.model.UserCreateOptions;
import com.arangodb.model.UserUpdateOptions;
+import com.arangodb.serde.DataType;
+import com.arangodb.serde.InternalSerde;
+import com.arangodb.serde.JacksonSerde;
import com.arangodb.util.ArangoCursorInitializer;
-import com.arangodb.util.ArangoDeserializer;
-import com.arangodb.util.ArangoSerialization;
-import com.arangodb.util.ArangoSerializer;
-import com.arangodb.velocypack.VPack;
-import com.arangodb.velocypack.VPackParser;
+import com.arangodb.serde.ArangoSerde;
+import com.arangodb.serde.InternalSerde;
import com.arangodb.velocystream.Request;
import com.arangodb.velocystream.Response;
import org.apache.http.client.HttpRequestRetryHandler;
@@ -73,7 +70,7 @@
* @author Michele Rastelli
*/
@SuppressWarnings("UnusedReturnValue")
-public interface ArangoDB extends ArangoSerializationAccessor {
+public interface ArangoDB extends ArangoSerdeAccessor {
/**
* Builder class to build an instance of {@link ArangoDB}.
@@ -336,7 +333,7 @@ public Builder responseQueueTimeSamples(final Integer responseQueueTimeSamples)
* @param serialization custom serializer/deserializer
* @return {@link ArangoDB.Builder}
*/
- public Builder serializer(final ArangoSerialization serialization) {
+ public Builder serializer(final ArangoSerde serialization) {
setSerializer(serialization);
return this;
}
@@ -347,25 +344,11 @@ public Builder serializer(final ArangoSerialization serialization) {
* @return {@link ArangoDB}
*/
public synchronized ArangoDB build() {
- if (customSerializer == null) {
- logger.warn("Usage of VelocyPack Java serialization is now deprecated for removal. " +
- "Future driver versions will only support Jackson serialization (for both JSON and VPACK formats). " +
- "Please configure according to: https://www.arangodb.com/docs/stable/drivers/java-reference-serialization.html");
- }
if (hosts.isEmpty()) {
hosts.add(host);
}
- final VPack vpacker = vpackBuilder.serializeNullValues(false).build();
- final VPack vpackerNull = vpackBuilder.serializeNullValues(true).build();
- final VPackParser vpackParser = vpackParserBuilder.build();
- final ArangoSerializer serializerTemp = serializer != null ? serializer
- : new ArangoSerializerImpl(vpacker, vpackerNull, vpackParser);
- final ArangoDeserializer deserializerTemp = deserializer != null ? deserializer
- : new ArangoDeserializerImpl(vpackerNull, vpackParser);
- final DefaultArangoSerialization internal = new DefaultArangoSerialization(serializerTemp,
- deserializerTemp);
- final ArangoSerialization custom = customSerializer != null ? customSerializer : internal;
- final ArangoSerializationFactory util = new ArangoSerializationFactory(internal, custom);
+ final ArangoSerde userSerde = customSerializer != null ? customSerializer : JacksonSerde.of(DataType.of(protocol));
+ final InternalSerde serde = InternalSerde.of(DataType.of(protocol), userSerde);
int protocolMaxConnections = protocol == Protocol.VST ?
ArangoDefaults.MAX_CONNECTIONS_VST_DEFAULT :
@@ -374,7 +357,7 @@ public synchronized ArangoDB build() {
final ConnectionFactory connectionFactory = (protocol == null || Protocol.VST == protocol)
? new VstConnectionFactorySync(host, timeout, connectionTtl, keepAliveInterval, useSsl, sslContext)
- : new HttpConnectionFactory(timeout, user, password, useSsl, sslContext, hostnameVerifier, custom,
+ : new HttpConnectionFactory(timeout, user, password, useSsl, sslContext, hostnameVerifier, serde,
protocol, connectionTtl, httpCookieSpec, httpRequestRetryHandler);
final Collection hostList = createHostList(max, connectionFactory);
@@ -387,7 +370,7 @@ public synchronized ArangoDB build() {
.jwt(jwt).useSsl(useSsl).sslContext(sslContext).chunksize(chunksize)
.maxConnections(maxConnections).connectionTtl(connectionTtl),
new HttpCommunication.Builder(hostHandler),
- util,
+ serde,
protocol,
hostResolver,
hostHandler,
diff --git a/src/main/java/com/arangodb/ArangoDatabase.java b/src/main/java/com/arangodb/ArangoDatabase.java
index 24146626c..58d055418 100644
--- a/src/main/java/com/arangodb/ArangoDatabase.java
+++ b/src/main/java/com/arangodb/ArangoDatabase.java
@@ -38,7 +38,7 @@
* @see Query API Documentation
*/
@SuppressWarnings("UnusedReturnValue")
-public interface ArangoDatabase extends ArangoSerializationAccessor {
+public interface ArangoDatabase extends ArangoSerdeAccessor {
/**
* Return the main entry point for the ArangoDB driver
@@ -260,7 +260,7 @@ public interface ArangoDatabase extends ArangoSerializationAccessor {
* @param query An AQL query string
* @param bindVars key/value pairs defining the variables to bind the query to
* @param options Additional options that will be passed to the query API, can be null
- * @param type The type of the result (POJO class, VPackSlice, String for JSON, or Collection/List/Map)
+ * @param type The type of the result (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return cursor of the results
* @throws ArangoDBException
* @see API
@@ -275,7 +275,7 @@ ArangoCursor query(String query, Map bindVars, AqlQueryOp
*
* @param query An AQL query string
* @param options Additional options that will be passed to the query API, can be null
- * @param type The type of the result (POJO class, VPackSlice, String for JSON, or Collection/List/Map)
+ * @param type The type of the result (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return cursor of the results
* @throws ArangoDBException
* @see API
@@ -289,7 +289,7 @@ ArangoCursor query(String query, Map bindVars, AqlQueryOp
*
* @param query An AQL query string
* @param bindVars key/value pairs defining the variables to bind the query to
- * @param type The type of the result (POJO class, VPackSlice, String for JSON, or Collection/List/Map)
+ * @param type The type of the result (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return cursor of the results
* @throws ArangoDBException
* @see API
@@ -302,7 +302,7 @@ ArangoCursor query(String query, Map bindVars, AqlQueryOp
* result list.
*
* @param query An AQL query string
- * @param type The type of the result (POJO class, VPackSlice, String for JSON, or Collection/List/Map)
+ * @param type The type of the result (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return cursor of the results
* @throws ArangoDBException
* @see API
@@ -314,7 +314,7 @@ ArangoCursor query(String query, Map bindVars, AqlQueryOp
* Return an cursor from the given cursor-ID if still existing
*
* @param cursorId The ID of the cursor
- * @param type The type of the result (POJO class, VPackSlice, String for JSON, or Collection/List/Map)
+ * @param type The type of the result (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return cursor of the results
* @throws ArangoDBException
* @see edgeDefinitions,
* Performs a server-side transaction and returns its return value.
*
* @param action A String evaluating to a JavaScript function to be executed on the server.
- * @param type The type of the result (POJO class, VPackSlice or String for JSON)
+ * @param type The type of the result (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return the result of the transaction if it succeeded
* @throws ArangoDBException
@@ -615,7 +615,7 @@ GraphEntity createGraph(String name, Collection edgeDefinitions,
* Reads a single document
*
* @param id The id of the document
- * @param type The type of the document (POJO class, VPackSlice or String for JSON)
+ * @param type The type of the document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return the document identified by the id
* @throws ArangoDBException
* @see API
@@ -627,7 +627,7 @@ GraphEntity createGraph(String name, Collection edgeDefinitions,
* Reads a single document
*
* @param id The id of the document
- * @param type The type of the document (POJO class, VPackSlice or String for JSON)
+ * @param type The type of the document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return the document identified by the id
* @throws ArangoDBException
diff --git a/src/main/java/com/arangodb/ArangoEdgeCollection.java b/src/main/java/com/arangodb/ArangoEdgeCollection.java
index 17d6d054b..0c8bbc45d 100644
--- a/src/main/java/com/arangodb/ArangoEdgeCollection.java
+++ b/src/main/java/com/arangodb/ArangoEdgeCollection.java
@@ -31,7 +31,7 @@
* @see API Documentation
*/
@SuppressWarnings("UnusedReturnValue")
-public interface ArangoEdgeCollection extends ArangoSerializationAccessor {
+public interface ArangoEdgeCollection extends ArangoSerdeAccessor {
/**
* The the handler of the named graph the edge collection is within
@@ -50,7 +50,7 @@ public interface ArangoEdgeCollection extends ArangoSerializationAccessor {
/**
* Creates a new edge in the collection
*
- * @param value A representation of a single edge (POJO, VPackSlice or String for JSON)
+ * @param value A representation of a single edge (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return information about the edge
* @throws ArangoDBException
* @see API Documentation
@@ -60,7 +60,7 @@ public interface ArangoEdgeCollection extends ArangoSerializationAccessor {
/**
* Creates a new edge in the collection
*
- * @param value A representation of a single edge (POJO, VPackSlice or String for JSON)
+ * @param value A representation of a single edge (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return information about the edge
* @throws ArangoDBException
@@ -72,7 +72,7 @@ public interface ArangoEdgeCollection extends ArangoSerializationAccessor {
* Fetches an existing edge
*
* @param key The key of the edge
- * @param type The type of the edge-document (POJO class, VPackSlice or String for JSON)
+ * @param type The type of the edge-document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return the edge identified by the key
* @throws ArangoDBException
* @see API Documentation
@@ -83,7 +83,7 @@ public interface ArangoEdgeCollection extends ArangoSerializationAccessor {
* Fetches an existing edge
*
* @param key The key of the edge
- * @param type The type of the edge-document (POJO class, VPackSlice or String for JSON)
+ * @param type The type of the edge-document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return the edge identified by the key
* @throws ArangoDBException
@@ -96,7 +96,7 @@ public interface ArangoEdgeCollection extends ArangoSerializationAccessor {
* violated
*
* @param key The key of the edge
- * @param The type of the edge-document (POJO class, VPackSlice or String for JSON)
+ * @param The type of the edge-document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return information about the edge
* @throws ArangoDBException
* @see API Documentation
@@ -108,7 +108,7 @@ public interface ArangoEdgeCollection extends ArangoSerializationAccessor {
* violated
*
* @param key The key of the edge
- * @param The type of the edge-document (POJO class, VPackSlice or String for JSON)
+ * @param The type of the edge-document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return information about the edge
* @throws ArangoDBException
@@ -122,7 +122,7 @@ public interface ArangoEdgeCollection extends ArangoSerializationAccessor {
* do not yet exist, and overwritten in the existing document if they do exist there.
*
* @param key The key of the edge
- * @param The type of the edge-document (POJO class, VPackSlice or String for JSON)
+ * @param The type of the edge-document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return information about the edge
* @throws ArangoDBException
* @see API Documentation
@@ -135,7 +135,7 @@ public interface ArangoEdgeCollection extends ArangoSerializationAccessor {
* do not yet exist, and overwritten in the existing document if they do exist there.
*
* @param key The key of the edge
- * @param The type of the edge-document (POJO class, VPackSlice or String for JSON)
+ * @param The type of the edge-document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return information about the edge
* @throws ArangoDBException
diff --git a/src/main/java/com/arangodb/ArangoGraph.java b/src/main/java/com/arangodb/ArangoGraph.java
index 873405cda..a9b562a68 100644
--- a/src/main/java/com/arangodb/ArangoGraph.java
+++ b/src/main/java/com/arangodb/ArangoGraph.java
@@ -33,7 +33,7 @@
* @author Mark Vollmary
* @see API Documentation
*/
-public interface ArangoGraph extends ArangoSerializationAccessor {
+public interface ArangoGraph extends ArangoSerdeAccessor {
/**
* The the handler of the database the named graph is within
diff --git a/src/main/java/com/arangodb/ArangoRoute.java b/src/main/java/com/arangodb/ArangoRoute.java
index fd32eb6e5..b9a393add 100644
--- a/src/main/java/com/arangodb/ArangoRoute.java
+++ b/src/main/java/com/arangodb/ArangoRoute.java
@@ -27,7 +27,7 @@
*
* @author Mark Vollmary
*/
-public interface ArangoRoute extends ArangoSerializationAccessor {
+public interface ArangoRoute extends ArangoSerdeAccessor {
/**
* Returns a new {@link ArangoRoute} instance for the given path (relative to the current route) that can be used to
@@ -57,7 +57,7 @@ public interface ArangoRoute extends ArangoSerializationAccessor {
ArangoRoute withQueryParam(String key, Object value);
/**
- * The response body. The body will be serialized to {@link com.arangodb.velocypack.VPackSlice}.
+ * The response body.
*
* @param body The request body
* @return {@link ArangoRoute}
diff --git a/src/main/java/com/arangodb/entity/Entity.java b/src/main/java/com/arangodb/ArangoSerdeAccessor.java
similarity index 58%
rename from src/main/java/com/arangodb/entity/Entity.java
rename to src/main/java/com/arangodb/ArangoSerdeAccessor.java
index 146e561ae..c3075a1b4 100644
--- a/src/main/java/com/arangodb/entity/Entity.java
+++ b/src/main/java/com/arangodb/ArangoSerdeAccessor.java
@@ -18,11 +18,28 @@
* Copyright holder is ArangoDB GmbH, Cologne, Germany
*/
-package com.arangodb.entity;
+package com.arangodb;
+
+import com.arangodb.serde.ArangoSerde;
+import com.arangodb.serde.InternalSerde;
/**
* @author Mark Vollmary
*/
-public interface Entity {
+public interface ArangoSerdeAccessor {
+
+ /**
+ * Returns driver internal serialization implementation for serializing and deserializing driver's classes.
+ *
+ * @return ArangoSerde
+ */
+ InternalSerde getSerde();
+
+ /**
+ * Returns serialization implementation for serializing and deserializing user's classes.
+ *
+ * @return ArangoSerde
+ */
+ ArangoSerde getUserSerde();
}
diff --git a/src/main/java/com/arangodb/ArangoSerializationAccessor.java b/src/main/java/com/arangodb/ArangoSerializationAccessor.java
deleted file mode 100644
index f140f054e..000000000
--- a/src/main/java/com/arangodb/ArangoSerializationAccessor.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * DISCLAIMER
- *
- * Copyright 2018 ArangoDB GmbH, Cologne, Germany
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Copyright holder is ArangoDB GmbH, Cologne, Germany
- */
-
-package com.arangodb;
-
-import com.arangodb.internal.util.ArangoSerializationFactory.Serializer;
-import com.arangodb.util.ArangoSerialization;
-
-/**
- * @author Mark Vollmary
- */
-public interface ArangoSerializationAccessor {
-
- /**
- * Returns driver internal serialization API for serializing and deserializing Java POJOs to/from {@link com.arangodb.velocypack.VPackSlice}
- *
- * @return ArangoSerialization
- */
- ArangoSerialization util();
-
- /**
- * Returns serialization API for serializing and deserializing Java POJOs to/from {@link com.arangodb.velocypack.VPackSlice} by the given
- * type
- *
- * @param serializer type of serializer
- * @return ArangoSerialization
- */
- ArangoSerialization util(Serializer serializer);
-
-}
diff --git a/src/main/java/com/arangodb/ArangoVertexCollection.java b/src/main/java/com/arangodb/ArangoVertexCollection.java
index e34705cf4..0d514a9fc 100644
--- a/src/main/java/com/arangodb/ArangoVertexCollection.java
+++ b/src/main/java/com/arangodb/ArangoVertexCollection.java
@@ -30,7 +30,7 @@
* @author Mark Vollmary
* @see API Documentation
*/
-public interface ArangoVertexCollection extends ArangoSerializationAccessor {
+public interface ArangoVertexCollection extends ArangoSerdeAccessor {
/**
* The the handler of the named graph the edge collection is within
@@ -59,7 +59,7 @@ public interface ArangoVertexCollection extends ArangoSerializationAccessor {
/**
* Creates a new vertex in the collection
*
- * @param value A representation of a single vertex (POJO, VPackSlice or String for JSON)
+ * @param value A representation of a single vertex (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return information about the vertex
* @throws ArangoDBException
* @see API Documentation
@@ -69,7 +69,7 @@ public interface ArangoVertexCollection extends ArangoSerializationAccessor {
/**
* Creates a new vertex in the collection
*
- * @param value A representation of a single vertex (POJO, VPackSlice or String for JSON)
+ * @param value A representation of a single vertex (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return information about the vertex
* @throws ArangoDBException
@@ -81,7 +81,7 @@ public interface ArangoVertexCollection extends ArangoSerializationAccessor {
* Retrieves the vertex document with the given {@code key} from the collection.
*
* @param key The key of the vertex
- * @param type The type of the vertex-document (POJO class, VPackSlice or String for JSON)
+ * @param type The type of the vertex-document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return the vertex identified by the key
* @throws ArangoDBException
* @see API Documentation
@@ -92,7 +92,7 @@ public interface ArangoVertexCollection extends ArangoSerializationAccessor {
* Retrieves the vertex document with the given {@code key} from the collection.
*
* @param key The key of the vertex
- * @param type The type of the vertex-document (POJO class, VPackSlice or String for JSON)
+ * @param type The type of the vertex-document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return the vertex identified by the key
* @throws ArangoDBException
@@ -105,7 +105,7 @@ public interface ArangoVertexCollection extends ArangoSerializationAccessor {
* violated
*
* @param key The key of the vertex
- * @param value A representation of a single vertex (POJO, VPackSlice or String for JSON)
+ * @param value A representation of a single vertex (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return information about the vertex
* @throws ArangoDBException
* @see API
@@ -118,7 +118,7 @@ public interface ArangoVertexCollection extends ArangoSerializationAccessor {
* violated
*
* @param key The key of the vertex
- * @param value A representation of a single vertex (POJO, VPackSlice or String for JSON)
+ * @param value A representation of a single vertex (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return information about the vertex
* @throws ArangoDBException
@@ -133,7 +133,7 @@ public interface ArangoVertexCollection extends ArangoSerializationAccessor {
* do not yet exist, and overwritten in the existing document if they do exist there.
*
* @param key The key of the vertex
- * @param The type of the vertex-document (POJO class, VPackSlice or String for JSON)
+ * @param The type of the vertex-document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return information about the vertex
* @throws ArangoDBException
* @see API Documentation
@@ -146,7 +146,7 @@ public interface ArangoVertexCollection extends ArangoSerializationAccessor {
* do not yet exist, and overwritten in the existing document if they do exist there.
*
* @param key The key of the vertex
- * @param The type of the vertex-document (POJO class, VPackSlice or String for JSON)
+ * @param The type of the vertex-document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return information about the vertex
* @throws ArangoDBException
diff --git a/src/main/java/com/arangodb/ArangoView.java b/src/main/java/com/arangodb/ArangoView.java
index 56a3a7995..b275d1131 100644
--- a/src/main/java/com/arangodb/ArangoView.java
+++ b/src/main/java/com/arangodb/ArangoView.java
@@ -30,7 +30,7 @@
* @since ArangoDB 3.4.0
*/
@SuppressWarnings("UnusedReturnValue")
-public interface ArangoView extends ArangoSerializationAccessor {
+public interface ArangoView extends ArangoSerdeAccessor {
/**
* The the handler of the database the collection is within
diff --git a/src/main/java/com/arangodb/async/ArangoCollectionAsync.java b/src/main/java/com/arangodb/async/ArangoCollectionAsync.java
index 91837285b..1df9efcd3 100644
--- a/src/main/java/com/arangodb/async/ArangoCollectionAsync.java
+++ b/src/main/java/com/arangodb/async/ArangoCollectionAsync.java
@@ -21,7 +21,7 @@
package com.arangodb.async;
import com.arangodb.ArangoDBException;
-import com.arangodb.ArangoSerializationAccessor;
+import com.arangodb.ArangoSerdeAccessor;
import com.arangodb.entity.*;
import com.arangodb.model.*;
@@ -36,7 +36,7 @@
* @see Documents API Documentation
*/
@SuppressWarnings("unused")
-public interface ArangoCollectionAsync extends ArangoSerializationAccessor {
+public interface ArangoCollectionAsync extends ArangoSerdeAccessor {
/**
* The the handler of the database the collection is within
@@ -56,7 +56,7 @@ public interface ArangoCollectionAsync extends ArangoSerializationAccessor {
* Creates a new document from the given document, unless there is already a document with the _key given. If no
* _key is given, a new unique _key is generated automatically.
*
- * @param value A representation of a single document (POJO, VPackSlice or String for Json)
+ * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return information about the document
* @see API
* Documentation
@@ -67,7 +67,7 @@ public interface ArangoCollectionAsync extends ArangoSerializationAccessor {
* Creates a new document from the given document, unless there is already a document with the _key given. If no
* _key is given, a new unique _key is generated automatically.
*
- * @param value A representation of a single document (POJO, VPackSlice or String for Json)
+ * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return information about the document
* @see API
@@ -79,7 +79,7 @@ public interface ArangoCollectionAsync extends ArangoSerializationAccessor {
* Creates new documents from the given documents, unless there is already a document with the _key given. If no
* _key is given, a new unique _key is generated automatically.
*
- * @param values A List of documents (POJO, VPackSlice or String for Json)
+ * @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return information about the documents
* @see API
* Documentation
@@ -90,7 +90,7 @@ public interface ArangoCollectionAsync extends ArangoSerializationAccessor {
* Creates new documents from the given documents, unless there is already a document with the _key given. If no
* _key is given, a new unique _key is generated automatically.
*
- * @param values A List of documents (POJO, VPackSlice or String for Json)
+ * @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return information about the documents
* @see API
@@ -140,7 +140,7 @@ CompletableFuture importDocuments(
* Reads a single document
*
* @param key The key of the document
- * @param type The type of the document (POJO class, VPackSlice or String for Json)
+ * @param type The type of the document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return the document identified by the key
* @see API
* Documentation
@@ -151,7 +151,7 @@ CompletableFuture importDocuments(
* Reads a single document
*
* @param key The key of the document
- * @param type The type of the document (POJO class, VPackSlice or String for Json)
+ * @param type The type of the document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return the document identified by the key
* @see API
@@ -164,7 +164,7 @@ CompletableFuture getDocument(final String key, final Class type, fina
* Reads multiple documents
*
* @param keys The keys of the documents
- * @param type The type of the documents (POJO class, VPackSlice or String for Json)
+ * @param type The type of the documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return the documents and possible errors
*/
CompletableFuture> getDocuments(final Collection keys, final Class type);
@@ -173,7 +173,7 @@ CompletableFuture getDocument(final String key, final Class type, fina
* Reads multiple documents
*
* @param keys The keys of the documents
- * @param type The type of the documents (POJO class, VPackSlice or String for Json)
+ * @param type The type of the documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return the documents and possible errors
*/
@@ -187,7 +187,7 @@ CompletableFuture> getDocuments(
* violated
*
* @param key The key of the document
- * @param value A representation of a single document (POJO, VPackSlice or String for Json)
+ * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return information about the document
* @see API
* Documentation
@@ -199,7 +199,7 @@ CompletableFuture> getDocuments(
* violated
*
* @param key The key of the document
- * @param value A representation of a single document (POJO, VPackSlice or String for Json)
+ * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return information about the document
* @see API
@@ -214,7 +214,7 @@ CompletableFuture> replaceDocument(
* Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are
* specified by the _key attributes in the documents in values.
*
- * @param values A List of documents (POJO, VPackSlice or String for Json)
+ * @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return information about the documents
* @see API
* Documentation
@@ -225,7 +225,7 @@ CompletableFuture> replaceDocument(
* Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are
* specified by the _key attributes in the documents in values.
*
- * @param values A List of documents (POJO, VPackSlice or String for Json)
+ * @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return information about the documents
* @see API
@@ -241,7 +241,7 @@ CompletableFuture>> replaceDocum
* they do not yet exist, and overwritten in the existing document if they do exist there.
*
* @param key The key of the document
- * @param value A representation of a single document (POJO, VPackSlice or String for Json)
+ * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return information about the document
* @see API
* Documentation
@@ -254,7 +254,7 @@ CompletableFuture>> replaceDocum
* they do not yet exist, and overwritten in the existing document if they do exist there.
*
* @param key The key of the document
- * @param value A representation of a single document (POJO, VPackSlice or String for Json)
+ * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return information about the document
* @see API
@@ -271,7 +271,7 @@ CompletableFuture> updateDocument(
* they do not yet exist, and overwritten in the existing document if they do exist there.
*
* @param key The key of the document
- * @param value A representation of a single document (POJO, VPackSlice or String for Json)
+ * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @param returnType Type of the returned newDocument and/or oldDocument
* @return information about the document
@@ -290,7 +290,7 @@ CompletableFuture> updateDocument(
* attributes from the patch documents will be added to the existing documents if they do not yet exist, and
* overwritten in the existing documents if they do exist there.
*
- * @param values A list of documents (POJO, VPackSlice or String for Json)
+ * @param values A list of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return information about the documents
* @see API
* Documentation
@@ -303,7 +303,7 @@ CompletableFuture> updateDocument(
* attributes from the patch documents will be added to the existing documents if they do not yet exist, and
* overwritten in the existing documents if they do exist there.
*
- * @param values A list of documents (POJO, VPackSlice or String for Json)
+ * @param values A list of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return information about the documents
* @see API
@@ -319,7 +319,7 @@ CompletableFuture>> updateDocume
* attributes from the patch documents will be added to the existing documents if they do not yet exist, and
* overwritten in the existing documents if they do exist there.
*
- * @param values A list of documents (POJO, VPackSlice or String for Json)
+ * @param values A list of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @param returnType Type of the returned newDocument and/or oldDocument
* @return information about the documents
@@ -345,7 +345,7 @@ CompletableFuture>> updateDoc
* Removes a document
*
* @param key The key of the document
- * @param type The type of the document (POJO class, VPackSlice or String for Json). Only necessary if
+ * @param type The type of the document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes}). Only necessary if
* options.returnOld is set to true, otherwise can be null.
* @param options Additional options, can be null
* @return information about the document
@@ -372,7 +372,7 @@ CompletableFuture> deleteDocument(
* Removes multiple document
*
* @param values The keys of the documents or the documents themselves
- * @param type The type of the documents (POJO class, VPackSlice or String for Json). Only necessary if
+ * @param type The type of the documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes}). Only necessary if
* options.returnOld is set to true, otherwise can be null.
* @param options Additional options, can be null
* @return information about the documents
diff --git a/src/main/java/com/arangodb/async/ArangoDBAsync.java b/src/main/java/com/arangodb/async/ArangoDBAsync.java
index 8b3b0b75d..77a3bdabd 100644
--- a/src/main/java/com/arangodb/async/ArangoDBAsync.java
+++ b/src/main/java/com/arangodb/async/ArangoDBAsync.java
@@ -31,20 +31,17 @@
import com.arangodb.internal.net.ConnectionFactory;
import com.arangodb.internal.net.HostHandler;
import com.arangodb.internal.net.HostResolver;
-import com.arangodb.internal.util.ArangoDeserializerImpl;
-import com.arangodb.internal.util.ArangoSerializationFactory;
-import com.arangodb.internal.util.ArangoSerializerImpl;
-import com.arangodb.internal.util.DefaultArangoSerialization;
+import com.arangodb.serde.InternalSerde;
import com.arangodb.internal.velocystream.VstCommunicationSync;
import com.arangodb.internal.velocystream.VstConnectionFactorySync;
import com.arangodb.model.DBCreateOptions;
import com.arangodb.model.LogOptions;
import com.arangodb.model.UserCreateOptions;
import com.arangodb.model.UserUpdateOptions;
-import com.arangodb.util.ArangoDeserializer;
-import com.arangodb.util.ArangoSerialization;
-import com.arangodb.util.ArangoSerializer;
-import com.arangodb.velocypack.*;
+import com.arangodb.serde.DataType;
+import com.arangodb.serde.InternalSerde;
+import com.arangodb.serde.JacksonSerde;
+import com.arangodb.serde.ArangoSerde;
import com.arangodb.velocystream.Request;
import com.arangodb.velocystream.Response;
import org.slf4j.Logger;
@@ -69,7 +66,7 @@
*
* @author Mark Vollmary
*/
-public interface ArangoDBAsync extends ArangoSerializationAccessor {
+public interface ArangoDBAsync extends ArangoSerdeAccessor {
void shutdown() throws ArangoDBException;
@@ -497,7 +494,7 @@ public Builder loadBalancingStrategy(final LoadBalancingStrategy loadBalancingSt
* @param serialization custom serializer/deserializer
* @return {@link ArangoDBAsync.Builder}
*/
- public Builder serializer(final ArangoSerialization serialization) {
+ public Builder serializer(final ArangoSerde serialization) {
setSerializer(serialization);
return this;
}
@@ -508,25 +505,11 @@ public Builder serializer(final ArangoSerialization serialization) {
* @return {@link ArangoDBAsync}
*/
public synchronized ArangoDBAsync build() {
- if (customSerializer == null) {
- logger.warn("Usage of VelocyPack Java serialization is now deprecated for removal. " +
- "Future driver versions will only support Jackson serialization (for both JSON and VPACK formats). " +
- "Please configure according to: https://www.arangodb.com/docs/stable/drivers/java-reference-serialization.html");
- }
if (hosts.isEmpty()) {
hosts.add(host);
}
- final VPack vpacker = vpackBuilder.serializeNullValues(false).build();
- final VPack vpackerNull = vpackBuilder.serializeNullValues(true).build();
- final VPackParser vpackParser = vpackParserBuilder.build();
- final ArangoSerializer serializerTemp = serializer != null ? serializer
- : new ArangoSerializerImpl(vpacker, vpackerNull, vpackParser);
- final ArangoDeserializer deserializerTemp = deserializer != null ? deserializer
- : new ArangoDeserializerImpl(vpackerNull, vpackParser);
- final DefaultArangoSerialization internal = new DefaultArangoSerialization(serializerTemp,
- deserializerTemp);
- final ArangoSerialization custom = customSerializer != null ? customSerializer : internal;
- final ArangoSerializationFactory util = new ArangoSerializationFactory(internal, custom);
+ final ArangoSerde userSerde = customSerializer != null ? customSerializer : JacksonSerde.of(DataType.VPACK);
+ final InternalSerde serde = InternalSerde.of(DataType.VPACK, userSerde);
final int max = maxConnections != null ? Math.max(1, maxConnections)
: ArangoDefaults.MAX_CONNECTIONS_VST_DEFAULT;
@@ -542,7 +525,7 @@ public synchronized ArangoDBAsync build() {
final HostHandler asyncHostHandler = createHostHandler(asyncHostResolver);
return new ArangoDBAsyncImpl(
asyncBuilder(asyncHostHandler),
- util,
+ serde,
syncBuilder(syncHostHandler),
asyncHostResolver,
syncHostResolver,
diff --git a/src/main/java/com/arangodb/async/ArangoDatabaseAsync.java b/src/main/java/com/arangodb/async/ArangoDatabaseAsync.java
index d3ed12c32..4f525c838 100644
--- a/src/main/java/com/arangodb/async/ArangoDatabaseAsync.java
+++ b/src/main/java/com/arangodb/async/ArangoDatabaseAsync.java
@@ -21,7 +21,7 @@
package com.arangodb.async;
import com.arangodb.ArangoDBException;
-import com.arangodb.ArangoSerializationAccessor;
+import com.arangodb.ArangoSerdeAccessor;
import com.arangodb.DbName;
import com.arangodb.entity.*;
import com.arangodb.entity.arangosearch.analyzer.SearchAnalyzer;
@@ -41,7 +41,7 @@
* @see Query API Documentation
*/
@SuppressWarnings("unused")
-public interface ArangoDatabaseAsync extends ArangoSerializationAccessor {
+public interface ArangoDatabaseAsync extends ArangoSerdeAccessor {
/**
* Return the main entry point for the ArangoDB driver
@@ -249,7 +249,7 @@ public interface ArangoDatabaseAsync extends ArangoSerializationAccessor {
* @param query contains the query string to be executed
* @param bindVars key/value pairs representing the bind parameters
* @param options Additional options, can be null
- * @param type The type of the result (POJO class, VPackSlice, String for Json, or Collection/List/Map)
+ * @param type The type of the result (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return cursor of the results
* @see API
* Documentation
@@ -266,7 +266,7 @@ CompletableFuture> query(
*
* @param query contains the query string to be executed
* @param options Additional options, can be null
- * @param type The type of the result (POJO class, VPackSlice, String for Json, or Collection/List/Map)
+ * @param type The type of the result (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return cursor of the results
* @see API
* Documentation
@@ -282,7 +282,7 @@ CompletableFuture> query(
*
* @param query contains the query string to be executed
* @param bindVars key/value pairs representing the bind parameters
- * @param type The type of the result (POJO class, VPackSlice, String for Json, or Collection/List/Map)
+ * @param type The type of the result (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return cursor of the results
* @see API
* Documentation
@@ -297,7 +297,7 @@ CompletableFuture> query(
* result list.
*
* @param query contains the query string to be executed
- * @param type The type of the result (POJO class, VPackSlice, String for Json, or Collection/List/Map)
+ * @param type The type of the result (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return cursor of the results
* @see API
* Documentation
@@ -308,7 +308,7 @@ CompletableFuture> query(
* Return an cursor from the given cursor-ID if still existing
*
* @param cursorId The ID of the cursor
- * @param type The type of the result (POJO class, VPackSlice, String for Json, or Collection/List/Map)
+ * @param type The type of the result (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return cursor of the results
* @see API
@@ -523,7 +523,7 @@ CompletableFuture createGraph(
* Execute a server-side transaction
*
* @param action the actual transaction operations to be executed, in the form of stringified JavaScript code
- * @param type The type of the result (POJO class, VPackSlice or String for Json)
+ * @param type The type of the result (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return the result of the transaction if it succeeded
* @see API
@@ -595,7 +595,7 @@ CompletableFuture createGraph(
* Reads a single document
*
* @param id The id of the document
- * @param type The type of the document (POJO class, VPackSlice or String for Json)
+ * @param type The type of the document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return the document identified by the id
* @see API
* Documentation
@@ -606,7 +606,7 @@ CompletableFuture createGraph(
* Reads a single document
*
* @param id The id of the document
- * @param type The type of the document (POJO class, VPackSlice or String for Json)
+ * @param type The type of the document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return the document identified by the id
* @see API
diff --git a/src/main/java/com/arangodb/async/ArangoEdgeCollectionAsync.java b/src/main/java/com/arangodb/async/ArangoEdgeCollectionAsync.java
index 2dea8807c..39a8a3a0d 100644
--- a/src/main/java/com/arangodb/async/ArangoEdgeCollectionAsync.java
+++ b/src/main/java/com/arangodb/async/ArangoEdgeCollectionAsync.java
@@ -20,7 +20,7 @@
package com.arangodb.async;
-import com.arangodb.ArangoSerializationAccessor;
+import com.arangodb.ArangoSerdeAccessor;
import com.arangodb.entity.EdgeEntity;
import com.arangodb.entity.EdgeUpdateEntity;
import com.arangodb.model.*;
@@ -34,7 +34,7 @@
* @see API Documentation
*/
@SuppressWarnings("unused")
-public interface ArangoEdgeCollectionAsync extends ArangoSerializationAccessor {
+public interface ArangoEdgeCollectionAsync extends ArangoSerdeAccessor {
/**
* The the handler of the named graph the edge collection is within
@@ -53,7 +53,7 @@ public interface ArangoEdgeCollectionAsync extends ArangoSerializationAccessor {
/**
* Creates a new edge in the collection
*
- * @param value A representation of a single edge (POJO, VPackSlice or String for Json)
+ * @param value A representation of a single edge (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return information about the edge
* @see API Documentation
*/
@@ -62,7 +62,7 @@ public interface ArangoEdgeCollectionAsync extends ArangoSerializationAccessor {
/**
* Creates a new edge in the collection
*
- * @param value A representation of a single edge (POJO, VPackSlice or String for Json)
+ * @param value A representation of a single edge (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return information about the edge
* @see API Documentation
@@ -73,7 +73,7 @@ public interface ArangoEdgeCollectionAsync extends ArangoSerializationAccessor {
* Fetches an existing edge
*
* @param key The key of the edge
- * @param type The type of the edge-document (POJO class, VPackSlice or String for Json)
+ * @param type The type of the edge-document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return the edge identified by the key
* @see API Documentation
*/
@@ -83,7 +83,7 @@ public interface ArangoEdgeCollectionAsync extends ArangoSerializationAccessor {
* Fetches an existing edge
*
* @param key The key of the edge
- * @param type The type of the edge-document (POJO class, VPackSlice or String for Json)
+ * @param type The type of the edge-document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return the edge identified by the key
* @see API Documentation
diff --git a/src/main/java/com/arangodb/async/ArangoGraphAsync.java b/src/main/java/com/arangodb/async/ArangoGraphAsync.java
index 17cb45a95..0fae79e0b 100644
--- a/src/main/java/com/arangodb/async/ArangoGraphAsync.java
+++ b/src/main/java/com/arangodb/async/ArangoGraphAsync.java
@@ -20,7 +20,7 @@
package com.arangodb.async;
-import com.arangodb.ArangoSerializationAccessor;
+import com.arangodb.ArangoSerdeAccessor;
import com.arangodb.entity.EdgeDefinition;
import com.arangodb.entity.GraphEntity;
import com.arangodb.model.GraphCreateOptions;
@@ -36,7 +36,7 @@
* @see API Documentation
*/
@SuppressWarnings("unused")
-public interface ArangoGraphAsync extends ArangoSerializationAccessor {
+public interface ArangoGraphAsync extends ArangoSerdeAccessor {
/**
* The the handler of the database the named graph is within
diff --git a/src/main/java/com/arangodb/async/ArangoRouteAsync.java b/src/main/java/com/arangodb/async/ArangoRouteAsync.java
index ab384f99b..e79d9ca13 100644
--- a/src/main/java/com/arangodb/async/ArangoRouteAsync.java
+++ b/src/main/java/com/arangodb/async/ArangoRouteAsync.java
@@ -20,7 +20,7 @@
package com.arangodb.async;
-import com.arangodb.ArangoSerializationAccessor;
+import com.arangodb.ArangoSerdeAccessor;
import com.arangodb.velocystream.Response;
import java.util.concurrent.CompletableFuture;
@@ -31,7 +31,7 @@
* @author Mark Vollmary
*/
@SuppressWarnings("unused")
-public interface ArangoRouteAsync extends ArangoSerializationAccessor {
+public interface ArangoRouteAsync extends ArangoSerdeAccessor {
/**
* Returns a new {@link ArangoRouteAsync} instance for the given path (relative to the current route) that can be
@@ -61,7 +61,7 @@ public interface ArangoRouteAsync extends ArangoSerializationAccessor {
ArangoRouteAsync withQueryParam(String key, Object value);
/**
- * The response body. The body will be serialized to {@link com.arangodb.velocypack.VPackSlice}.
+ * The response body.
*
* @param body The response body
* @return {@link ArangoRouteAsync}
diff --git a/src/main/java/com/arangodb/async/ArangoVertexCollectionAsync.java b/src/main/java/com/arangodb/async/ArangoVertexCollectionAsync.java
index b610a9796..38eb462cd 100644
--- a/src/main/java/com/arangodb/async/ArangoVertexCollectionAsync.java
+++ b/src/main/java/com/arangodb/async/ArangoVertexCollectionAsync.java
@@ -20,7 +20,7 @@
package com.arangodb.async;
-import com.arangodb.ArangoSerializationAccessor;
+import com.arangodb.ArangoSerdeAccessor;
import com.arangodb.entity.VertexEntity;
import com.arangodb.entity.VertexUpdateEntity;
import com.arangodb.model.*;
@@ -34,7 +34,7 @@
* @see API Documentation
*/
@SuppressWarnings("unused")
-public interface ArangoVertexCollectionAsync extends ArangoSerializationAccessor {
+public interface ArangoVertexCollectionAsync extends ArangoSerdeAccessor {
/**
* The the handler of the named graph the edge collection is within
@@ -63,7 +63,7 @@ public interface ArangoVertexCollectionAsync extends ArangoSerializationAccessor
/**
* Creates a new vertex in the collection
*
- * @param value A representation of a single vertex (POJO, VPackSlice or String for Json)
+ * @param value A representation of a single vertex (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return information about the vertex
* @see API Documentation
*/
@@ -72,7 +72,7 @@ public interface ArangoVertexCollectionAsync extends ArangoSerializationAccessor
/**
* Creates a new vertex in the collection
*
- * @param value A representation of a single vertex (POJO, VPackSlice or String for Json)
+ * @param value A representation of a single vertex (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return information about the vertex
* @see API Documentation
@@ -83,7 +83,7 @@ public interface ArangoVertexCollectionAsync extends ArangoSerializationAccessor
* Fetches an existing vertex
*
* @param key The key of the vertex
- * @param type The type of the vertex-document (POJO class, VPackSlice or String for Json)
+ * @param type The type of the vertex-document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @return the vertex identified by the key
* @see API Documentation
*/
@@ -93,7 +93,7 @@ public interface ArangoVertexCollectionAsync extends ArangoSerializationAccessor
* Fetches an existing vertex
*
* @param key The key of the vertex
- * @param type The type of the vertex-document (POJO class, VPackSlice or String for Json)
+ * @param type The type of the vertex-document (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
* @param options Additional options, can be null
* @return the vertex identified by the key
* @see API Documentation
diff --git a/src/main/java/com/arangodb/async/ArangoViewAsync.java b/src/main/java/com/arangodb/async/ArangoViewAsync.java
index fed3da081..c06289cee 100644
--- a/src/main/java/com/arangodb/async/ArangoViewAsync.java
+++ b/src/main/java/com/arangodb/async/ArangoViewAsync.java
@@ -20,7 +20,7 @@
package com.arangodb.async;
-import com.arangodb.ArangoSerializationAccessor;
+import com.arangodb.ArangoSerdeAccessor;
import com.arangodb.entity.ViewEntity;
import java.util.concurrent.CompletableFuture;
@@ -33,7 +33,7 @@
* @since ArangoDB 3.4.0
*/
@SuppressWarnings("unused")
-public interface ArangoViewAsync extends ArangoSerializationAccessor {
+public interface ArangoViewAsync extends ArangoSerdeAccessor {
/**
* The the handler of the database the collection is within
diff --git a/src/main/java/com/arangodb/async/internal/ArangoCollectionAsyncImpl.java b/src/main/java/com/arangodb/async/internal/ArangoCollectionAsyncImpl.java
index b5be30c1c..7f444ad9e 100644
--- a/src/main/java/com/arangodb/async/internal/ArangoCollectionAsyncImpl.java
+++ b/src/main/java/com/arangodb/async/internal/ArangoCollectionAsyncImpl.java
@@ -106,14 +106,13 @@ public CompletableFuture getDocument(final String key, final Class typ
}
@Override
- @SuppressWarnings("unchecked")
public CompletableFuture getDocument(
final String key,
final Class type,
final DocumentReadOptions options) throws ArangoDBException {
DocumentUtil.validateDocumentKey(key);
boolean isCatchException = options != null ? options.isCatchException() : new DocumentReadOptions().isCatchException();
- return (CompletableFuture) executor.execute(getDocumentRequest(key, options), type)
+ return executor.execute(getDocumentRequest(key, options), getDocumentResponseDeserializer(type))
.exceptionally(ExceptionUtil.catchGetDocumentExceptions(isCatchException));
}
diff --git a/src/main/java/com/arangodb/async/internal/ArangoCursorAsyncImpl.java b/src/main/java/com/arangodb/async/internal/ArangoCursorAsyncImpl.java
index 14988eca3..284a576b8 100644
--- a/src/main/java/com/arangodb/async/internal/ArangoCursorAsyncImpl.java
+++ b/src/main/java/com/arangodb/async/internal/ArangoCursorAsyncImpl.java
@@ -21,7 +21,7 @@
package com.arangodb.async.internal;
import com.arangodb.async.ArangoCursorAsync;
-import com.arangodb.entity.CursorEntity;
+import com.arangodb.internal.cursor.entity.InternalCursorEntity;
import com.arangodb.internal.ArangoCursorExecute;
import com.arangodb.internal.InternalArangoDatabase;
import com.arangodb.internal.cursor.ArangoCursorImpl;
@@ -37,7 +37,7 @@
public class ArangoCursorAsyncImpl extends ArangoCursorImpl implements ArangoCursorAsync {
ArangoCursorAsyncImpl(final InternalArangoDatabase, ?> db, final ArangoCursorExecute execute,
- final Class type, final CursorEntity result) {
+ final Class type, final InternalCursorEntity result) {
super(db, execute, type, result);
}
diff --git a/src/main/java/com/arangodb/async/internal/ArangoDBAsyncImpl.java b/src/main/java/com/arangodb/async/internal/ArangoDBAsyncImpl.java
index 23cf6af31..e6a56e137 100644
--- a/src/main/java/com/arangodb/async/internal/ArangoDBAsyncImpl.java
+++ b/src/main/java/com/arangodb/async/internal/ArangoDBAsyncImpl.java
@@ -31,8 +31,7 @@
import com.arangodb.internal.net.CommunicationProtocol;
import com.arangodb.internal.net.HostHandler;
import com.arangodb.internal.net.HostResolver;
-import com.arangodb.internal.util.ArangoSerializationFactory;
-import com.arangodb.internal.util.ArangoSerializationFactory.Serializer;
+import com.arangodb.serde.InternalSerde;
import com.arangodb.internal.velocystream.VstCommunication;
import com.arangodb.internal.velocystream.VstCommunicationSync;
import com.arangodb.internal.velocystream.VstProtocol;
@@ -63,7 +62,7 @@ public class ArangoDBAsyncImpl extends InternalArangoDB imp
public ArangoDBAsyncImpl(
final VstCommunicationAsync.Builder asyncCommBuilder,
- final ArangoSerializationFactory util,
+ final InternalSerde util,
final VstCommunicationSync.Builder syncCommBuilder,
final HostResolver asyncHostResolver,
final HostResolver syncHostResolver,
@@ -74,10 +73,10 @@ public ArangoDBAsyncImpl(
final int timeoutMs
) {
- super(new ArangoExecutorAsync(asyncCommBuilder.build(util.get(Serializer.INTERNAL)), util, new DocumentCache(),
+ super(new ArangoExecutorAsync(asyncCommBuilder.build(util), util, new DocumentCache(),
new QueueTimeMetricsImpl(responseQueueTimeSamples), timeoutMs), util, context);
- final VstCommunication cacheCom = syncCommBuilder.build(util.get(Serializer.INTERNAL));
+ final VstCommunication cacheCom = syncCommBuilder.build(util);
cp = new VstProtocol(cacheCom);
this.asyncHostHandler = asyncHostHandler;
@@ -85,8 +84,8 @@ public ArangoDBAsyncImpl(
ArangoExecutorSync arangoExecutorSync = new ArangoExecutorSync(cp, util, new DocumentCache(),
new QueueTimeMetricsImpl(responseQueueTimeSamples), timeoutMs);
- asyncHostResolver.init(arangoExecutorSync, util.get(Serializer.INTERNAL));
- syncHostResolver.init(arangoExecutorSync, util.get(Serializer.INTERNAL));
+ asyncHostResolver.init(arangoExecutorSync, util);
+ syncHostResolver.init(arangoExecutorSync, util);
}
diff --git a/src/main/java/com/arangodb/async/internal/ArangoDatabaseAsyncImpl.java b/src/main/java/com/arangodb/async/internal/ArangoDatabaseAsyncImpl.java
index 224d80d7c..0e390e736 100644
--- a/src/main/java/com/arangodb/async/internal/ArangoDatabaseAsyncImpl.java
+++ b/src/main/java/com/arangodb/async/internal/ArangoDatabaseAsyncImpl.java
@@ -22,34 +22,19 @@
import com.arangodb.ArangoDBException;
import com.arangodb.DbName;
-import com.arangodb.async.ArangoCollectionAsync;
-import com.arangodb.async.ArangoCursorAsync;
-import com.arangodb.async.ArangoDatabaseAsync;
-import com.arangodb.async.ArangoGraphAsync;
-import com.arangodb.async.ArangoRouteAsync;
-import com.arangodb.async.ArangoSearchAsync;
-import com.arangodb.async.ArangoViewAsync;
+import com.arangodb.async.*;
import com.arangodb.entity.*;
import com.arangodb.entity.arangosearch.analyzer.SearchAnalyzer;
import com.arangodb.internal.ArangoCursorExecute;
import com.arangodb.internal.ArangoErrors;
import com.arangodb.internal.InternalArangoDatabase;
+import com.arangodb.internal.cursor.entity.InternalCursorEntity;
import com.arangodb.internal.net.HostHandle;
import com.arangodb.internal.util.DocumentUtil;
-import com.arangodb.model.AqlFunctionCreateOptions;
-import com.arangodb.model.AqlFunctionDeleteOptions;
-import com.arangodb.model.AqlFunctionGetOptions;
-import com.arangodb.model.AqlQueryExplainOptions;
-import com.arangodb.model.AqlQueryOptions;
-import com.arangodb.model.CollectionCreateOptions;
-import com.arangodb.model.CollectionsReadOptions;
-import com.arangodb.model.DocumentReadOptions;
-import com.arangodb.model.GraphCreateOptions;
-import com.arangodb.model.StreamTransactionOptions;
-import com.arangodb.model.TransactionOptions;
+import com.arangodb.model.*;
import com.arangodb.model.arangosearch.AnalyzerDeleteOptions;
import com.arangodb.model.arangosearch.ArangoSearchCreateOptions;
-import com.arangodb.velocypack.Type;
+import com.arangodb.serde.SerdeUtils;
import com.arangodb.velocystream.Request;
import java.util.Collection;
@@ -194,7 +179,7 @@ public CompletableFuture> query(
final Class type) {
final Request request = queryRequest(query, bindVars, options);
final HostHandle hostHandle = new HostHandle();
- final CompletableFuture execution = executor.execute(request, CursorEntity.class, hostHandle);
+ final CompletableFuture execution = executor.execute(request, InternalCursorEntity.class, hostHandle);
return execution.thenApply(result -> createCursor(result, type, options, hostHandle));
}
@@ -222,20 +207,20 @@ public CompletableFuture> query(final String query, fin
@Override
public CompletableFuture> cursor(final String cursorId, final Class type) {
final HostHandle hostHandle = new HostHandle();
- final CompletableFuture execution = executor.execute(queryNextRequest(cursorId, null, null), CursorEntity.class, hostHandle);
+ final CompletableFuture execution = executor.execute(queryNextRequest(cursorId, null, null), InternalCursorEntity.class, hostHandle);
return execution.thenApply(result -> createCursor(result, type, null, hostHandle));
}
private ArangoCursorAsync createCursor(
- final CursorEntity result,
+ final InternalCursorEntity result,
final Class type,
final AqlQueryOptions options,
final HostHandle hostHandle) {
return new ArangoCursorAsyncImpl<>(this, new ArangoCursorExecute() {
@Override
- public CursorEntity next(final String id, Map meta) {
- final CompletableFuture result = executor.execute(queryNextRequest(id, options, meta),
- CursorEntity.class, hostHandle);
+ public InternalCursorEntity next(final String id, Map meta) {
+ final CompletableFuture result = executor.execute(queryNextRequest(id, options, meta),
+ InternalCursorEntity.class, hostHandle);
try {
return result.get();
} catch (InterruptedException | ExecutionException e) {
@@ -296,14 +281,14 @@ public CompletableFuture setQueryTrackingProperti
@Override
public CompletableFuture> getCurrentlyRunningQueries() {
- return executor.execute(getCurrentlyRunningQueriesRequest(), new Type>() {
- }.getType());
+ return executor.execute(getCurrentlyRunningQueriesRequest(),
+ SerdeUtils.INSTANCE.constructListType(QueryEntity.class));
}
@Override
public CompletableFuture> getSlowQueries() {
- return executor.execute(getSlowQueriesRequest(), new Type>() {
- }.getType());
+ return executor.execute(getSlowQueriesRequest(),
+ SerdeUtils.INSTANCE.constructListType(QueryEntity.class));
}
@Override
diff --git a/src/main/java/com/arangodb/async/internal/ArangoExecutorAsync.java b/src/main/java/com/arangodb/async/internal/ArangoExecutorAsync.java
index 58d7659c5..fc7372da9 100644
--- a/src/main/java/com/arangodb/async/internal/ArangoExecutorAsync.java
+++ b/src/main/java/com/arangodb/async/internal/ArangoExecutorAsync.java
@@ -26,7 +26,7 @@
import com.arangodb.internal.DocumentCache;
import com.arangodb.internal.QueueTimeMetricsImpl;
import com.arangodb.internal.net.HostHandle;
-import com.arangodb.internal.util.ArangoSerializationFactory;
+import com.arangodb.serde.InternalSerde;
import com.arangodb.velocystream.Request;
import java.io.IOException;
@@ -44,18 +44,18 @@ public class ArangoExecutorAsync extends ArangoExecutor {
private final VstCommunicationAsync communication;
private final ExecutorService outgoingExecutor = Executors.newSingleThreadExecutor();
- public ArangoExecutorAsync(final VstCommunicationAsync communication, final ArangoSerializationFactory util,
+ public ArangoExecutorAsync(final VstCommunicationAsync communication, final InternalSerde util,
final DocumentCache documentCache, final QueueTimeMetricsImpl qtMetrics, final int timeoutMs) {
super(util, documentCache, qtMetrics, timeoutMs);
this.communication = communication;
}
public CompletableFuture execute(final Request request, final Type type) {
- return execute(request, (response) -> createResult(type, response));
+ return execute(request, response -> createResult(type, response));
}
public CompletableFuture execute(final Request request, final Type type, final HostHandle hostHandle) {
- return execute(request, (response) -> createResult(type, response), hostHandle);
+ return execute(request, response -> createResult(type, response), hostHandle);
}
public CompletableFuture execute(final Request request, final ResponseDeserializer responseDeserializer) {
@@ -68,7 +68,7 @@ private CompletableFuture execute(
final HostHandle hostHandle) {
return CompletableFuture.completedFuture(null)
- .thenComposeAsync((it) -> communication.execute(interceptRequest(request), hostHandle), outgoingExecutor)
+ .thenComposeAsync(it -> communication.execute(interceptRequest(request), hostHandle), outgoingExecutor)
.thenApplyAsync(response -> {
interceptResponse(response);
return responseDeserializer.deserialize(response);
diff --git a/src/main/java/com/arangodb/async/internal/velocystream/VstCommunicationAsync.java b/src/main/java/com/arangodb/async/internal/velocystream/VstCommunicationAsync.java
index 38acb45be..410b8dc9a 100644
--- a/src/main/java/com/arangodb/async/internal/velocystream/VstCommunicationAsync.java
+++ b/src/main/java/com/arangodb/async/internal/velocystream/VstCommunicationAsync.java
@@ -30,7 +30,7 @@
import com.arangodb.internal.velocystream.internal.AuthenticationRequest;
import com.arangodb.internal.velocystream.internal.JwtAuthenticationRequest;
import com.arangodb.internal.velocystream.internal.Message;
-import com.arangodb.util.ArangoSerialization;
+import com.arangodb.serde.InternalSerde;
import com.arangodb.velocypack.exception.VPackException;
import com.arangodb.velocypack.exception.VPackParserException;
import com.arangodb.velocystream.Request;
@@ -50,7 +50,7 @@ public class VstCommunicationAsync extends VstCommunicationAPI Documentation
*/
-public class AqlExecutionExplainEntity implements Entity {
+public final class AqlExecutionExplainEntity {
- public static class ExecutionPlan {
+ public static final class ExecutionPlan {
private Collection nodes;
private Collection rules;
private Collection collections;
@@ -61,7 +61,7 @@ public Integer getEstimatedNrItems() {
}
}
- public static class ExecutionNode {
+ public static final class ExecutionNode {
private String type;
private Collection dependencies;
private Long id;
@@ -179,7 +179,7 @@ public Boolean getReverse() {
}
}
- public static class ExecutionVariable {
+ public static final class ExecutionVariable {
private Long id;
private String name;
@@ -192,7 +192,7 @@ public String getName() {
}
}
- public static class ExecutionExpression {
+ public static final class ExecutionExpression {
private String type;
private String name;
private Long id;
@@ -235,7 +235,7 @@ public Collection getSubNodes() {
}
}
- public static class ExecutionCollection {
+ public static final class ExecutionCollection {
private String name;
private String type;
@@ -248,7 +248,7 @@ public String getType() {
}
}
- public static class ExecutionStats {
+ public static final class ExecutionStats {
private Integer rulesExecuted;
private Integer rulesSkipped;
private Integer plansCreated;
diff --git a/src/main/java/com/arangodb/entity/AqlFunctionEntity.java b/src/main/java/com/arangodb/entity/AqlFunctionEntity.java
index 57f5d78c4..cd0d52f5f 100644
--- a/src/main/java/com/arangodb/entity/AqlFunctionEntity.java
+++ b/src/main/java/com/arangodb/entity/AqlFunctionEntity.java
@@ -26,7 +26,7 @@
* "https://www.arangodb.com/docs/stable/http/aql-user-functions.html#return-registered-aql-user-functions">API
* Documentation
*/
-public class AqlFunctionEntity implements Entity {
+public final class AqlFunctionEntity {
private String name;
private String code;
diff --git a/src/main/java/com/arangodb/entity/AqlParseEntity.java b/src/main/java/com/arangodb/entity/AqlParseEntity.java
index f5f16e059..9047a23e7 100644
--- a/src/main/java/com/arangodb/entity/AqlParseEntity.java
+++ b/src/main/java/com/arangodb/entity/AqlParseEntity.java
@@ -26,9 +26,9 @@
* @author Mark Vollmary
* @see API Documentation
*/
-public class AqlParseEntity implements Entity {
+public final class AqlParseEntity {
- public static class AstNode {
+ public static final class AstNode {
private String type;
private Collection subNodes;
private String name;
diff --git a/src/main/java/com/arangodb/entity/ArangoDBEngine.java b/src/main/java/com/arangodb/entity/ArangoDBEngine.java
index 37ea0bfc8..0cd2898d3 100644
--- a/src/main/java/com/arangodb/entity/ArangoDBEngine.java
+++ b/src/main/java/com/arangodb/entity/ArangoDBEngine.java
@@ -25,7 +25,7 @@
* @see API
* Documentation
*/
-public class ArangoDBEngine implements Entity {
+public final class ArangoDBEngine {
public enum StorageEngineName {
mmfiles, rocksdb
diff --git a/src/main/java/com/arangodb/entity/ArangoDBVersion.java b/src/main/java/com/arangodb/entity/ArangoDBVersion.java
index db339bd88..878980e32 100644
--- a/src/main/java/com/arangodb/entity/ArangoDBVersion.java
+++ b/src/main/java/com/arangodb/entity/ArangoDBVersion.java
@@ -25,7 +25,7 @@
* @see API
* Documentation
*/
-public class ArangoDBVersion implements Entity {
+public final class ArangoDBVersion {
private String server;
private String version;
diff --git a/src/main/java/com/arangodb/entity/BaseDocument.java b/src/main/java/com/arangodb/entity/BaseDocument.java
index 2d6fe1967..1946afda1 100644
--- a/src/main/java/com/arangodb/entity/BaseDocument.java
+++ b/src/main/java/com/arangodb/entity/BaseDocument.java
@@ -21,6 +21,9 @@
package com.arangodb.entity;
import com.arangodb.internal.DocumentFields;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import java.util.HashMap;
@@ -92,6 +95,8 @@ public void setRevision(final String revision) {
this.revision = revision;
}
+ @JsonInclude
+ @JsonAnyGetter
public Map getProperties() {
return properties;
}
@@ -100,6 +105,8 @@ public void setProperties(final Map properties) {
this.properties = properties;
}
+ @JsonInclude
+ @JsonAnySetter
public void addAttribute(final String key, final Object value) {
properties.put(key, value);
}
diff --git a/src/main/java/com/arangodb/entity/BaseEdgeDocument.java b/src/main/java/com/arangodb/entity/BaseEdgeDocument.java
index c76831b0a..9a82420da 100644
--- a/src/main/java/com/arangodb/entity/BaseEdgeDocument.java
+++ b/src/main/java/com/arangodb/entity/BaseEdgeDocument.java
@@ -27,7 +27,7 @@
/**
* @author Mark Vollmary
*/
-public class BaseEdgeDocument extends BaseDocument {
+public final class BaseEdgeDocument extends BaseDocument {
private static final long serialVersionUID = 6904923804449368783L;
diff --git a/src/main/java/com/arangodb/entity/CollectionEntity.java b/src/main/java/com/arangodb/entity/CollectionEntity.java
index 72530c808..6f9fff3aa 100644
--- a/src/main/java/com/arangodb/entity/CollectionEntity.java
+++ b/src/main/java/com/arangodb/entity/CollectionEntity.java
@@ -26,7 +26,7 @@
* @author Mark Vollmary
* @see API Documentation
*/
-public class CollectionEntity implements Entity {
+public class CollectionEntity {
private String id;
private String name;
diff --git a/src/main/java/com/arangodb/entity/CollectionPropertiesEntity.java b/src/main/java/com/arangodb/entity/CollectionPropertiesEntity.java
index 73f55d758..9e9388bc3 100644
--- a/src/main/java/com/arangodb/entity/CollectionPropertiesEntity.java
+++ b/src/main/java/com/arangodb/entity/CollectionPropertiesEntity.java
@@ -27,20 +27,19 @@
* @see API
* Documentation
*/
-public class CollectionPropertiesEntity extends CollectionEntity {
+public final class CollectionPropertiesEntity extends CollectionEntity {
private KeyOptions keyOptions;
private Long count;
private Integer numberOfShards;
private Collection shardKeys;
- private final ReplicationFactor replicationFactor;
+ private ReplicationFactor replicationFactor;
private Integer writeConcern;
private String shardingStrategy; // cluster option
private String smartJoinAttribute; // enterprise option
public CollectionPropertiesEntity() {
super();
- replicationFactor = new ReplicationFactor();
}
public KeyOptions getKeyOptions() {
@@ -82,12 +81,12 @@ public void setShardKeys(final Collection shardKeys) {
this.shardKeys = shardKeys;
}
- public Integer getReplicationFactor() {
- return replicationFactor.getReplicationFactor();
+ public ReplicationFactor getReplicationFactor() {
+ return replicationFactor;
}
- public void setReplicationFactor(final Integer replicationFactor) {
- this.replicationFactor.setReplicationFactor(replicationFactor);
+ public void setReplicationFactor(final ReplicationFactor replicationFactor) {
+ this.replicationFactor = replicationFactor;
}
public Integer getWriteConcern() {
@@ -98,17 +97,6 @@ public void setWriteConcern(final Integer writeConcern) {
this.writeConcern = writeConcern;
}
- /**
- * @return whether the collection is a satellite collection. Only in an enterprise cluster setup (else returning null).
- */
- public Boolean getSatellite() {
- return this.replicationFactor.getSatellite();
- }
-
- public void setSatellite(final Boolean satellite) {
- this.replicationFactor.setSatellite(satellite);
- }
-
public String getShardingStrategy() {
return shardingStrategy;
}
diff --git a/src/main/java/com/arangodb/entity/CollectionRevisionEntity.java b/src/main/java/com/arangodb/entity/CollectionRevisionEntity.java
index d04ec000d..a65db6d7a 100644
--- a/src/main/java/com/arangodb/entity/CollectionRevisionEntity.java
+++ b/src/main/java/com/arangodb/entity/CollectionRevisionEntity.java
@@ -25,7 +25,7 @@
* @see API
* Documentation
*/
-public class CollectionRevisionEntity extends CollectionEntity {
+public final class CollectionRevisionEntity extends CollectionEntity {
private String revision;
diff --git a/src/main/java/com/arangodb/entity/CursorStats.java b/src/main/java/com/arangodb/entity/CursorStats.java
new file mode 100644
index 000000000..2bf822561
--- /dev/null
+++ b/src/main/java/com/arangodb/entity/CursorStats.java
@@ -0,0 +1,44 @@
+package com.arangodb.entity;
+
+public final class CursorStats {
+ private Long writesExecuted;
+ private Long writesIgnored;
+ private Long scannedFull;
+ private Long scannedIndex;
+ private Long filtered;
+ private Long fullCount;
+ private Double executionTime;
+ private Long peakMemoryUsage;
+
+ public Long getWritesExecuted() {
+ return writesExecuted;
+ }
+
+ public Long getWritesIgnored() {
+ return writesIgnored;
+ }
+
+ public Long getScannedFull() {
+ return scannedFull;
+ }
+
+ public Long getScannedIndex() {
+ return scannedIndex;
+ }
+
+ public Long getFiltered() {
+ return filtered;
+ }
+
+ public Long getFullCount() {
+ return fullCount;
+ }
+
+ public Double getExecutionTime() {
+ return executionTime;
+ }
+
+ public Long getPeakMemoryUsage() {
+ return peakMemoryUsage;
+ }
+}
diff --git a/src/main/java/com/arangodb/entity/CursorWarning.java b/src/main/java/com/arangodb/entity/CursorWarning.java
new file mode 100644
index 000000000..72dc8ff1c
--- /dev/null
+++ b/src/main/java/com/arangodb/entity/CursorWarning.java
@@ -0,0 +1,16 @@
+package com.arangodb.entity;
+
+public final class CursorWarning {
+
+ private Integer code;
+ private String message;
+
+ public Integer getCode() {
+ return code;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+}
diff --git a/src/main/java/com/arangodb/entity/DatabaseEntity.java b/src/main/java/com/arangodb/entity/DatabaseEntity.java
index 975065f50..3b996d033 100644
--- a/src/main/java/com/arangodb/entity/DatabaseEntity.java
+++ b/src/main/java/com/arangodb/entity/DatabaseEntity.java
@@ -24,19 +24,18 @@
* @author Mark Vollmary
* @see API Documentation
*/
-public class DatabaseEntity implements Entity {
+public final class DatabaseEntity {
private String id;
private String name;
private String path;
private Boolean isSystem;
- private final ReplicationFactor replicationFactor;
+ private ReplicationFactor replicationFactor;
private Integer writeConcern;
private String sharding;
public DatabaseEntity() {
super();
- replicationFactor = new ReplicationFactor();
}
/**
@@ -71,8 +70,8 @@ public Boolean getIsSystem() {
* @return the default replication factor for collections in this database
* @since ArangoDB 3.6.0
*/
- public Integer getReplicationFactor() {
- return replicationFactor.getReplicationFactor();
+ public ReplicationFactor getReplicationFactor() {
+ return replicationFactor;
}
/**
@@ -87,14 +86,6 @@ public Integer getWriteConcern() {
return writeConcern;
}
- /**
- * @return whether the collection is a satellite collection. Only in an enterprise cluster setup (else returning null).
- * @since ArangoDB 3.6.0
- */
- public Boolean getSatellite() {
- return this.replicationFactor.getSatellite();
- }
-
/**
* @return information about the default sharding method for collections created in this database
* @since ArangoDB 3.6.0
diff --git a/src/main/java/com/arangodb/entity/DocumentCreateEntity.java b/src/main/java/com/arangodb/entity/DocumentCreateEntity.java
index 9469325bf..c2d07bc8c 100644
--- a/src/main/java/com/arangodb/entity/DocumentCreateEntity.java
+++ b/src/main/java/com/arangodb/entity/DocumentCreateEntity.java
@@ -20,18 +20,16 @@
package com.arangodb.entity;
-import com.arangodb.velocypack.annotations.Expose;
+import com.arangodb.serde.UserData;
/**
* @author Mark Vollmary
* @see API
* Documentation
*/
-public class DocumentCreateEntity extends DocumentEntity {
+public final class DocumentCreateEntity extends DocumentEntity {
- @Expose(deserialize = false)
private T newDocument;
- @Expose(deserialize = false)
private T oldDocument;
public DocumentCreateEntity() {
@@ -45,6 +43,7 @@ public T getNew() {
return newDocument;
}
+ @UserData
public void setNew(final T newDocument) {
this.newDocument = newDocument;
}
@@ -57,6 +56,7 @@ public T getOld() {
return oldDocument;
}
+ @UserData
public void setOld(final T oldDocument) {
this.oldDocument = oldDocument;
}
diff --git a/src/main/java/com/arangodb/entity/DocumentDeleteEntity.java b/src/main/java/com/arangodb/entity/DocumentDeleteEntity.java
index 336ec53c1..46fa34c56 100644
--- a/src/main/java/com/arangodb/entity/DocumentDeleteEntity.java
+++ b/src/main/java/com/arangodb/entity/DocumentDeleteEntity.java
@@ -20,16 +20,15 @@
package com.arangodb.entity;
-import com.arangodb.velocypack.annotations.Expose;
+import com.arangodb.serde.UserData;
/**
* @author Mark Vollmary
* @see API
* Documentation
*/
-public class DocumentDeleteEntity extends DocumentEntity {
+public final class DocumentDeleteEntity extends DocumentEntity {
- @Expose(deserialize = false)
private T oldDocument;
public DocumentDeleteEntity() {
@@ -44,6 +43,7 @@ public T getOld() {
return oldDocument;
}
+ @UserData
public void setOld(final T oldDocument) {
this.oldDocument = oldDocument;
}
diff --git a/src/main/java/com/arangodb/entity/DocumentEntity.java b/src/main/java/com/arangodb/entity/DocumentEntity.java
index 1b973e32d..fe3ddda5b 100644
--- a/src/main/java/com/arangodb/entity/DocumentEntity.java
+++ b/src/main/java/com/arangodb/entity/DocumentEntity.java
@@ -23,7 +23,7 @@
/**
* @author Mark Vollmary
*/
-public class DocumentEntity implements Entity {
+public class DocumentEntity {
@Key
private String key;
diff --git a/src/main/java/com/arangodb/entity/DocumentImportEntity.java b/src/main/java/com/arangodb/entity/DocumentImportEntity.java
index bd57c65fc..b4f6a469f 100644
--- a/src/main/java/com/arangodb/entity/DocumentImportEntity.java
+++ b/src/main/java/com/arangodb/entity/DocumentImportEntity.java
@@ -26,7 +26,7 @@
/**
* @author Mark Vollmary
*/
-public class DocumentImportEntity implements Entity {
+public final class DocumentImportEntity {
private Integer created;
private Integer errors;
diff --git a/src/main/java/com/arangodb/entity/DocumentUpdateEntity.java b/src/main/java/com/arangodb/entity/DocumentUpdateEntity.java
index 009468000..61b9b1f62 100644
--- a/src/main/java/com/arangodb/entity/DocumentUpdateEntity.java
+++ b/src/main/java/com/arangodb/entity/DocumentUpdateEntity.java
@@ -20,8 +20,8 @@
package com.arangodb.entity;
-import com.arangodb.velocypack.annotations.Expose;
-import com.arangodb.velocypack.annotations.SerializedName;
+import com.arangodb.serde.UserData;
+import com.fasterxml.jackson.annotation.JsonProperty;
/**
* @param
@@ -29,13 +29,11 @@
* @see API
* Documentation
*/
-public class DocumentUpdateEntity extends DocumentEntity {
+public final class DocumentUpdateEntity extends DocumentEntity {
- @SerializedName("_oldRev")
+ @JsonProperty("_oldRev")
private String oldRev;
- @Expose(deserialize = false)
private T newDocument;
- @Expose(deserialize = false)
private T oldDocument;
public DocumentUpdateEntity() {
@@ -53,6 +51,7 @@ public T getNew() {
return newDocument;
}
+ @UserData
public void setNew(final T newDocument) {
this.newDocument = newDocument;
}
@@ -65,6 +64,7 @@ public T getOld() {
return oldDocument;
}
+ @UserData
public void setOld(final T oldDocument) {
this.oldDocument = oldDocument;
}
diff --git a/src/main/java/com/arangodb/entity/EdgeDefinition.java b/src/main/java/com/arangodb/entity/EdgeDefinition.java
index 140e01567..cd39c9a3b 100644
--- a/src/main/java/com/arangodb/entity/EdgeDefinition.java
+++ b/src/main/java/com/arangodb/entity/EdgeDefinition.java
@@ -22,17 +22,18 @@
import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
/**
* @author Mark Vollmary
* @see API Documentation
*/
-public class EdgeDefinition {
+public final class EdgeDefinition {
private String collection;
private Collection from;
private Collection to;
- private Options options;
+ private final Options options = new Options();
public String getCollection() {
return collection;
@@ -65,6 +66,10 @@ public Collection getSatellites() {
return options.satellites;
}
+ public Options getOptions() {
+ return options;
+ }
+
/**
* @param satellites collection names that will be used to create SatelliteCollections
* for a Hybrid (Disjoint) SmartGraph (Enterprise Edition only). Each array element
@@ -73,12 +78,15 @@ public Collection getSatellites() {
* @since ArangoDB 3.9.0
*/
public EdgeDefinition satellites(final String... satellites) {
- options = new Options();
options.satellites = Arrays.asList(satellites);
return this;
}
- public static class Options {
- private Collection satellites;
+ public static final class Options {
+ private Collection satellites = Collections.emptyList();
+
+ public Collection getSatellites() {
+ return satellites;
+ }
}
}
diff --git a/src/main/java/com/arangodb/entity/EdgeEntity.java b/src/main/java/com/arangodb/entity/EdgeEntity.java
index c62f7d131..48107a1e1 100644
--- a/src/main/java/com/arangodb/entity/EdgeEntity.java
+++ b/src/main/java/com/arangodb/entity/EdgeEntity.java
@@ -23,7 +23,7 @@
/**
* @author Mark Vollmary
*/
-public class EdgeEntity extends DocumentEntity {
+public final class EdgeEntity extends DocumentEntity {
public EdgeEntity() {
super();
diff --git a/src/main/java/com/arangodb/entity/EdgeUpdateEntity.java b/src/main/java/com/arangodb/entity/EdgeUpdateEntity.java
index f872666a3..67b72e76b 100644
--- a/src/main/java/com/arangodb/entity/EdgeUpdateEntity.java
+++ b/src/main/java/com/arangodb/entity/EdgeUpdateEntity.java
@@ -20,15 +20,15 @@
package com.arangodb.entity;
-import com.arangodb.velocypack.annotations.SerializedName;
+import com.fasterxml.jackson.annotation.JsonProperty;
/**
* @author Mark Vollmary
* @see API Documentation
*/
-public class EdgeUpdateEntity extends DocumentEntity {
+public final class EdgeUpdateEntity extends DocumentEntity {
- @SerializedName("_oldRev")
+ @JsonProperty("_oldRev")
private String oldRev;
public EdgeUpdateEntity() {
diff --git a/src/main/java/com/arangodb/entity/ErrorEntity.java b/src/main/java/com/arangodb/entity/ErrorEntity.java
index 48a1c582b..5677d2301 100644
--- a/src/main/java/com/arangodb/entity/ErrorEntity.java
+++ b/src/main/java/com/arangodb/entity/ErrorEntity.java
@@ -25,7 +25,7 @@
/**
* @author Mark Vollmary
*/
-public class ErrorEntity implements Serializable, Entity {
+public final class ErrorEntity implements Serializable {
private static final long serialVersionUID = -5918898261563691261L;
diff --git a/src/main/java/com/arangodb/entity/From.java b/src/main/java/com/arangodb/entity/From.java
index 056c1e1c6..4d3b63ca0 100644
--- a/src/main/java/com/arangodb/entity/From.java
+++ b/src/main/java/com/arangodb/entity/From.java
@@ -4,6 +4,8 @@
import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
+import jakarta.json.bind.annotation.JsonbAnnotation;
+import jakarta.json.bind.annotation.JsonbProperty;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -19,5 +21,7 @@
@JacksonAnnotationsInside
@JsonProperty(DocumentFields.FROM)
@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonbAnnotation
+@JsonbProperty("_from")
public @interface From {
}
diff --git a/src/main/java/com/arangodb/entity/GraphEntity.java b/src/main/java/com/arangodb/entity/GraphEntity.java
index 151979131..07145ee60 100644
--- a/src/main/java/com/arangodb/entity/GraphEntity.java
+++ b/src/main/java/com/arangodb/entity/GraphEntity.java
@@ -26,7 +26,7 @@
* @author Mark Vollmary
* @see API Documentation
*/
-public class GraphEntity implements Entity {
+public final class GraphEntity {
private String name;
/**
@@ -66,12 +66,8 @@ public Integer getNumberOfShards() {
return numberOfShards;
}
- public Integer getReplicationFactor() {
- return replicationFactor.getReplicationFactor();
- }
-
- public Boolean getSatellite() {
- return this.replicationFactor.getSatellite();
+ public ReplicationFactor getReplicationFactor() {
+ return replicationFactor;
}
public Integer getWriteConcern() {
diff --git a/src/main/java/com/arangodb/entity/Id.java b/src/main/java/com/arangodb/entity/Id.java
index f4333438d..5ebd39d46 100644
--- a/src/main/java/com/arangodb/entity/Id.java
+++ b/src/main/java/com/arangodb/entity/Id.java
@@ -4,6 +4,8 @@
import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
+import jakarta.json.bind.annotation.JsonbAnnotation;
+import jakarta.json.bind.annotation.JsonbProperty;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -19,5 +21,7 @@
@JacksonAnnotationsInside
@JsonProperty(DocumentFields.ID)
@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonbAnnotation
+@JsonbProperty("_id")
public @interface Id {
}
diff --git a/src/main/java/com/arangodb/entity/IndexEntity.java b/src/main/java/com/arangodb/entity/IndexEntity.java
index b359a5146..a379ed161 100644
--- a/src/main/java/com/arangodb/entity/IndexEntity.java
+++ b/src/main/java/com/arangodb/entity/IndexEntity.java
@@ -25,7 +25,7 @@
/**
* @author Mark Vollmary
*/
-public class IndexEntity implements Entity {
+public final class IndexEntity {
private String id;
private String name;
diff --git a/src/main/java/com/arangodb/entity/Key.java b/src/main/java/com/arangodb/entity/Key.java
index f510a2c65..2afc552a3 100644
--- a/src/main/java/com/arangodb/entity/Key.java
+++ b/src/main/java/com/arangodb/entity/Key.java
@@ -4,6 +4,8 @@
import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
+import jakarta.json.bind.annotation.JsonbAnnotation;
+import jakarta.json.bind.annotation.JsonbProperty;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -19,5 +21,7 @@
@JacksonAnnotationsInside
@JsonProperty(DocumentFields.KEY)
@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonbAnnotation
+@JsonbProperty("_key")
public @interface Key {
}
diff --git a/src/main/java/com/arangodb/entity/KeyOptions.java b/src/main/java/com/arangodb/entity/KeyOptions.java
index 261450638..65bd435e5 100644
--- a/src/main/java/com/arangodb/entity/KeyOptions.java
+++ b/src/main/java/com/arangodb/entity/KeyOptions.java
@@ -23,7 +23,7 @@
/**
* @author Mark Vollmary
*/
-public class KeyOptions {
+public final class KeyOptions {
private Boolean allowUserKeys;
private KeyType type;
diff --git a/src/main/java/com/arangodb/entity/License.java b/src/main/java/com/arangodb/entity/License.java
index 053b2ca64..92803eed4 100644
--- a/src/main/java/com/arangodb/entity/License.java
+++ b/src/main/java/com/arangodb/entity/License.java
@@ -20,11 +20,17 @@
package com.arangodb.entity;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
/**
* @author Axel Becker
*/
public enum License {
- ENTERPRISE, COMMUNITY
+ @JsonProperty("enterprise")
+ ENTERPRISE,
+
+ @JsonProperty("community")
+ COMMUNITY
}
diff --git a/src/main/java/com/arangodb/entity/LogEntriesEntity.java b/src/main/java/com/arangodb/entity/LogEntriesEntity.java
index 43d0954b5..e43d44713 100644
--- a/src/main/java/com/arangodb/entity/LogEntriesEntity.java
+++ b/src/main/java/com/arangodb/entity/LogEntriesEntity.java
@@ -28,7 +28,7 @@
* Documentation
* @since ArangoDB 3.8
*/
-public class LogEntriesEntity implements Entity {
+public final class LogEntriesEntity {
private Long total;
private List messages;
@@ -41,7 +41,7 @@ public List getMessages() {
return messages;
}
- public static class Message {
+ public static final class Message {
Long id;
String topic;
String level;
diff --git a/src/main/java/com/arangodb/entity/LogLevelEntity.java b/src/main/java/com/arangodb/entity/LogLevelEntity.java
index adcc1b393..a6e9ae702 100644
--- a/src/main/java/com/arangodb/entity/LogLevelEntity.java
+++ b/src/main/java/com/arangodb/entity/LogLevelEntity.java
@@ -23,7 +23,7 @@
/**
* @author Mark Vollmary
*/
-public class LogLevelEntity implements Entity {
+public final class LogLevelEntity {
public enum LogLevel {
FATAL, ERROR, WARNING, INFO, DEBUG, TRACE, DEFAULT
@@ -53,6 +53,10 @@ public LogLevelEntity() {
super();
}
+ public LogLevel getAll() {
+ return all;
+ }
+
public void setAll(final LogLevel all) {
this.all = all;
}
diff --git a/src/main/java/com/arangodb/entity/MultiDocumentEntity.java b/src/main/java/com/arangodb/entity/MultiDocumentEntity.java
index bd619c4f9..edf154696 100644
--- a/src/main/java/com/arangodb/entity/MultiDocumentEntity.java
+++ b/src/main/java/com/arangodb/entity/MultiDocumentEntity.java
@@ -25,7 +25,7 @@
/**
* @author Mark Vollmary
*/
-public class MultiDocumentEntity implements Entity {
+public final class MultiDocumentEntity {
private Collection documents;
private Collection errors;
diff --git a/src/main/java/com/arangodb/entity/Permissions.java b/src/main/java/com/arangodb/entity/Permissions.java
index 774f36c42..73f8b8105 100644
--- a/src/main/java/com/arangodb/entity/Permissions.java
+++ b/src/main/java/com/arangodb/entity/Permissions.java
@@ -20,6 +20,8 @@
package com.arangodb.entity;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
/**
* @author Mark Vollmary
*/
@@ -28,11 +30,16 @@ public enum Permissions {
/**
* read and write access
*/
+ @JsonProperty("rw")
RW,
+
/**
* read-only access
*/
+ @JsonProperty("ro")
RO,
+
+ @JsonProperty("none")
NONE
}
diff --git a/src/main/java/com/arangodb/entity/QueryCachePropertiesEntity.java b/src/main/java/com/arangodb/entity/QueryCachePropertiesEntity.java
index d820aa0c9..67000290e 100644
--- a/src/main/java/com/arangodb/entity/QueryCachePropertiesEntity.java
+++ b/src/main/java/com/arangodb/entity/QueryCachePropertiesEntity.java
@@ -26,7 +26,7 @@
* "https://www.arangodb.com/docs/stable/http/aql-query-cache.html">API
* Documentation
*/
-public class QueryCachePropertiesEntity implements Entity {
+public final class QueryCachePropertiesEntity {
public enum CacheMode {
off, on, demand
diff --git a/src/main/java/com/arangodb/entity/QueryEntity.java b/src/main/java/com/arangodb/entity/QueryEntity.java
index 2e78b1ed4..04cff2fe0 100644
--- a/src/main/java/com/arangodb/entity/QueryEntity.java
+++ b/src/main/java/com/arangodb/entity/QueryEntity.java
@@ -26,7 +26,7 @@
/**
* @author Mark Vollmary
*/
-public class QueryEntity implements Entity {
+public final class QueryEntity {
public static final String PROPERTY_STARTED = "started";
diff --git a/src/main/java/com/arangodb/entity/QueryExecutionState.java b/src/main/java/com/arangodb/entity/QueryExecutionState.java
index 75e75df87..987044880 100644
--- a/src/main/java/com/arangodb/entity/QueryExecutionState.java
+++ b/src/main/java/com/arangodb/entity/QueryExecutionState.java
@@ -20,19 +20,42 @@
package com.arangodb.entity;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
/**
* @author Mark Vollmary
*/
public enum QueryExecutionState {
+ @JsonProperty("initializing")
INITIALIZING,
+
+ @JsonProperty("parsing")
PARSING,
+
+ @JsonProperty("optimizing ast")
OPTIMIZING_AST,
+
+ @JsonProperty("loading collections")
LOADING_COLLECTIONS,
+
+ @JsonProperty("instantiating plan")
INSTANTIATING_PLAN,
+
+ @JsonProperty("optimizing plan")
OPTIMIZING_PLAN,
+
+ @JsonProperty("executing")
EXECUTING,
+
+ @JsonProperty("finalizing")
FINALIZING,
+
+ @JsonProperty("finished")
FINISHED,
+
+ @JsonProperty("killed")
KILLED,
+
+ @JsonProperty("invalid")
INVALID
}
diff --git a/src/main/java/com/arangodb/entity/QueryTrackingPropertiesEntity.java b/src/main/java/com/arangodb/entity/QueryTrackingPropertiesEntity.java
index dc82e447d..f8054ec32 100644
--- a/src/main/java/com/arangodb/entity/QueryTrackingPropertiesEntity.java
+++ b/src/main/java/com/arangodb/entity/QueryTrackingPropertiesEntity.java
@@ -23,7 +23,7 @@
/**
* @author Mark Vollmary
*/
-public class QueryTrackingPropertiesEntity implements Entity {
+public final class QueryTrackingPropertiesEntity {
private Boolean enabled;
private Boolean trackSlowQueries;
diff --git a/src/main/java/com/arangodb/entity/ReplicationFactor.java b/src/main/java/com/arangodb/entity/ReplicationFactor.java
index b228f3f66..853aad4bb 100644
--- a/src/main/java/com/arangodb/entity/ReplicationFactor.java
+++ b/src/main/java/com/arangodb/entity/ReplicationFactor.java
@@ -20,32 +20,41 @@
package com.arangodb.entity;
-/**
- * @author Mark Vollmary
- */
-public class ReplicationFactor {
+import com.fasterxml.jackson.annotation.JsonValue;
- private Integer replicationFactor;
- private Boolean satellite;
+public interface ReplicationFactor {
- public ReplicationFactor() {
- super();
+ static NumericReplicationFactor of(int value) {
+ return new NumericReplicationFactor(value);
}
- public Integer getReplicationFactor() {
- return replicationFactor;
+ static SatelliteReplicationFactor ofSatellite() {
+ return SatelliteReplicationFactor.INSTANCE;
}
- public void setReplicationFactor(final Integer replicationFactor) {
- this.replicationFactor = replicationFactor;
- }
+ @JsonValue
+ Object getValue();
- public Boolean getSatellite() {
- return satellite;
- }
+ final class NumericReplicationFactor implements ReplicationFactor {
+
+ private Integer value;
- public void setSatellite(final Boolean satellite) {
- this.satellite = satellite;
+ public NumericReplicationFactor(Integer value) {
+ this.value = value;
+ }
+
+ @Override
+ public Integer getValue() {
+ return value;
+ }
}
+ enum SatelliteReplicationFactor implements ReplicationFactor {
+ INSTANCE;
+
+ @Override
+ public String getValue() {
+ return "satellite";
+ }
+ }
}
diff --git a/src/main/java/com/arangodb/entity/Rev.java b/src/main/java/com/arangodb/entity/Rev.java
index bd5aa7600..08dfa5c22 100644
--- a/src/main/java/com/arangodb/entity/Rev.java
+++ b/src/main/java/com/arangodb/entity/Rev.java
@@ -4,6 +4,8 @@
import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
+import jakarta.json.bind.annotation.JsonbAnnotation;
+import jakarta.json.bind.annotation.JsonbProperty;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -19,5 +21,7 @@
@JacksonAnnotationsInside
@JsonProperty(DocumentFields.REV)
@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonbAnnotation
+@JsonbProperty("_rev")
public @interface Rev {
}
diff --git a/src/main/java/com/arangodb/entity/ShardEntity.java b/src/main/java/com/arangodb/entity/ShardEntity.java
index deeb49db3..8b853a623 100644
--- a/src/main/java/com/arangodb/entity/ShardEntity.java
+++ b/src/main/java/com/arangodb/entity/ShardEntity.java
@@ -23,7 +23,7 @@
/**
* @author Michele Rastelli
*/
-public class ShardEntity implements Entity {
+public final class ShardEntity {
private String shardId;
diff --git a/src/main/java/com/arangodb/entity/StreamTransactionEntity.java b/src/main/java/com/arangodb/entity/StreamTransactionEntity.java
index b7fee3817..4dbafa475 100644
--- a/src/main/java/com/arangodb/entity/StreamTransactionEntity.java
+++ b/src/main/java/com/arangodb/entity/StreamTransactionEntity.java
@@ -26,7 +26,7 @@
* "https://www.arangodb.com/docs/stable/http/transaction-stream-transaction.html">API Documentation
* @since ArangoDB 3.5.0
*/
-public class StreamTransactionEntity implements Entity {
+public final class StreamTransactionEntity {
private String id;
private StreamTransactionStatus status;
diff --git a/src/main/java/com/arangodb/entity/To.java b/src/main/java/com/arangodb/entity/To.java
index a58db8604..deb60769c 100644
--- a/src/main/java/com/arangodb/entity/To.java
+++ b/src/main/java/com/arangodb/entity/To.java
@@ -4,6 +4,8 @@
import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
+import jakarta.json.bind.annotation.JsonbAnnotation;
+import jakarta.json.bind.annotation.JsonbProperty;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -19,5 +21,7 @@
@JacksonAnnotationsInside
@JsonProperty(DocumentFields.TO)
@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonbAnnotation
+@JsonbProperty("_to")
public @interface To {
}
diff --git a/src/main/java/com/arangodb/entity/TransactionEntity.java b/src/main/java/com/arangodb/entity/TransactionEntity.java
index a700541f2..f9925927d 100644
--- a/src/main/java/com/arangodb/entity/TransactionEntity.java
+++ b/src/main/java/com/arangodb/entity/TransactionEntity.java
@@ -26,7 +26,7 @@
* "https://www.arangodb.com/docs/stable/http/transaction-stream-transaction.html#list-currently-ongoing-transactions
* @since ArangoDB 3.5.0
*/
-public class TransactionEntity implements Entity {
+public final class TransactionEntity {
private String id;
private StreamTransactionStatus state;
@@ -35,7 +35,7 @@ public String getId() {
return id;
}
- public StreamTransactionStatus getStatus() {
+ public StreamTransactionStatus getState() {
return state;
}
diff --git a/src/main/java/com/arangodb/entity/UserEntity.java b/src/main/java/com/arangodb/entity/UserEntity.java
index fa082c5c7..244da2d55 100644
--- a/src/main/java/com/arangodb/entity/UserEntity.java
+++ b/src/main/java/com/arangodb/entity/UserEntity.java
@@ -26,7 +26,7 @@
* @author Mark Vollmary
* @see API Documentation
*/
-public class UserEntity implements Entity {
+public final class UserEntity {
private String user;
private Boolean active;
diff --git a/src/main/java/com/arangodb/entity/VertexEntity.java b/src/main/java/com/arangodb/entity/VertexEntity.java
index 161ed9fd4..e8348336a 100644
--- a/src/main/java/com/arangodb/entity/VertexEntity.java
+++ b/src/main/java/com/arangodb/entity/VertexEntity.java
@@ -23,7 +23,7 @@
/**
* @author Mark Vollmary
*/
-public class VertexEntity extends DocumentEntity {
+public final class VertexEntity extends DocumentEntity {
public VertexEntity() {
super();
diff --git a/src/main/java/com/arangodb/entity/VertexUpdateEntity.java b/src/main/java/com/arangodb/entity/VertexUpdateEntity.java
index 22d2d1078..c5e8f0ff2 100644
--- a/src/main/java/com/arangodb/entity/VertexUpdateEntity.java
+++ b/src/main/java/com/arangodb/entity/VertexUpdateEntity.java
@@ -20,14 +20,14 @@
package com.arangodb.entity;
-import com.arangodb.velocypack.annotations.SerializedName;
+import com.fasterxml.jackson.annotation.JsonProperty;
/**
* @author Mark Vollmary
*/
-public class VertexUpdateEntity extends DocumentEntity {
+public final class VertexUpdateEntity extends DocumentEntity {
- @SerializedName("_oldRev")
+ @JsonProperty("_oldRev")
private String oldRev;
public VertexUpdateEntity() {
diff --git a/src/main/java/com/arangodb/entity/ViewEntity.java b/src/main/java/com/arangodb/entity/ViewEntity.java
index 07da45f88..e5eb28299 100644
--- a/src/main/java/com/arangodb/entity/ViewEntity.java
+++ b/src/main/java/com/arangodb/entity/ViewEntity.java
@@ -23,7 +23,7 @@
/**
* @author Mark Vollmary
*/
-public class ViewEntity implements Entity {
+public class ViewEntity {
private String id;
private String name;
diff --git a/src/main/java/com/arangodb/entity/ViewType.java b/src/main/java/com/arangodb/entity/ViewType.java
index 21c039906..4844fe560 100644
--- a/src/main/java/com/arangodb/entity/ViewType.java
+++ b/src/main/java/com/arangodb/entity/ViewType.java
@@ -20,11 +20,14 @@
package com.arangodb.entity;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
/**
* @author Mark Vollmary
*/
public enum ViewType {
+ @JsonProperty("arangosearch")
ARANGO_SEARCH
}
diff --git a/src/main/java/com/arangodb/entity/arangosearch/ArangoSearchProperties.java b/src/main/java/com/arangodb/entity/arangosearch/ArangoSearchProperties.java
deleted file mode 100644
index 7353cba66..000000000
--- a/src/main/java/com/arangodb/entity/arangosearch/ArangoSearchProperties.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * DISCLAIMER
- *
- * Copyright 2018 ArangoDB GmbH, Cologne, Germany
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * Copyright holder is ArangoDB GmbH, Cologne, Germany
- */
-
-package com.arangodb.entity.arangosearch;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-
-/**
- * @author Mark Vollmary
- * @author Heiko Kernbach
- * @author Michele Rastelli
- * @see API Documentation
- */
-public class ArangoSearchProperties {
-
- private Long consolidationIntervalMsec;
- private Long commitIntervalMsec;
- private Long cleanupIntervalStep;
- private ConsolidationPolicy consolidationPolicy;
- private final Collection primarySorts;
- private final Collection links;
- private ArangoSearchCompression primarySortCompression;
- private final Collection storedValues;
-
- public ArangoSearchProperties() {
- super();
- links = new ArrayList<>();
- primarySorts = new ArrayList<>();
- storedValues = new ArrayList<>();
- }
-
- public Long getCommitIntervalMsec() {
- return commitIntervalMsec;
- }
-
- public void setCommitIntervalMsec(final Long commitIntervalMsec) {
- this.commitIntervalMsec = commitIntervalMsec;
- }
-
- public Long getConsolidationIntervalMsec() {
- return consolidationIntervalMsec;
- }
-
- public void setConsolidationIntervalMsec(final Long consolidationIntervalMsec) {
- this.consolidationIntervalMsec = consolidationIntervalMsec;
- }
-
- public Long getCleanupIntervalStep() {
- return cleanupIntervalStep;
- }
-
- public void setCleanupIntervalStep(final Long cleanupIntervalStep) {
- this.cleanupIntervalStep = cleanupIntervalStep;
- }
-
- public ConsolidationPolicy getConsolidationPolicy() {
- return consolidationPolicy;
- }
-
- public void setConsolidationPolicy(final ConsolidationPolicy consolidationPolicy) {
- this.consolidationPolicy = consolidationPolicy;
- }
-
- public Collection getLinks() {
- return links;
- }
-
- public void addLink(final CollectionLink... links) {
- this.links.addAll(Arrays.asList(links));
- }
-
- public Collection getPrimarySort() {
- return primarySorts;
- }
-
- public void addPrimarySort(final PrimarySort... primarySorts) {
- this.primarySorts.addAll(Arrays.asList(primarySorts));
- }
-
- /**
- * @return Defines how to compress the primary sort data (introduced in v3.7.0). ArangoDB v3.5 and v3.6 always
- * compress the index using LZ4.
- * @since ArangoDB 3.7
- */
- public ArangoSearchCompression getPrimarySortCompression() {
- return primarySortCompression;
- }
-
- public void setPrimarySortCompression(ArangoSearchCompression primarySortCompression) {
- this.primarySortCompression = primarySortCompression;
- }
-
- /**
- * @return An array of objects to describe which document attributes to store in the View index. It can then cover
- * search queries, which means the data can be taken from the index directly and accessing the storage engine can be
- * avoided.
- * @since ArangoDB 3.7
- */
- public Collection getStoredValues() {
- return storedValues;
- }
-
- public void addStoredValues(final StoredValue... storedValues) {
- this.storedValues.addAll(Arrays.asList(storedValues));
- }
-
-}
diff --git a/src/main/java/com/arangodb/entity/arangosearch/ArangoSearchPropertiesEntity.java b/src/main/java/com/arangodb/entity/arangosearch/ArangoSearchPropertiesEntity.java
index 55c6d9afe..4c5f3073b 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/ArangoSearchPropertiesEntity.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/ArangoSearchPropertiesEntity.java
@@ -21,7 +21,8 @@
package com.arangodb.entity.arangosearch;
import com.arangodb.entity.ViewEntity;
-import com.arangodb.entity.ViewType;
+import com.arangodb.serde.InternalDeserializers;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import java.util.Collection;
@@ -30,26 +31,16 @@
* @author Michele Rastelli
* @see API Documentation
*/
-public class ArangoSearchPropertiesEntity extends ViewEntity {
+public final class ArangoSearchPropertiesEntity extends ViewEntity {
- private final ArangoSearchProperties properties;
-
- public ArangoSearchPropertiesEntity(final String id, final String name, final ViewType type,
- final ArangoSearchProperties properties) {
- super(id, name, type);
- this.properties = properties;
- }
-
- /**
- * @return Wait at least this many milliseconds between committing index data changes and making them visible to
- * queries (default: 60000, to disable use: 0). For the case where there are a lot of inserts/updates, a
- * lower value, until commit, will cause the index not to account for them and memory usage would continue
- * to grow. For the case where there are a few inserts/updates, a higher value will impact performance and
- * waste disk space for each commit call without any added benefits.
- */
- public Long getConsolidationIntervalMsec() {
- return properties.getConsolidationIntervalMsec();
- }
+ private Long consolidationIntervalMsec;
+ private Long commitIntervalMsec;
+ private Long cleanupIntervalStep;
+ private ConsolidationPolicy consolidationPolicy;
+ private Collection primarySort;
+ private Collection links;
+ private ArangoSearchCompression primarySortCompression;
+ private Collection storedValues;
/**
* @return Wait at least this many milliseconds between committing view data store changes and making documents
@@ -65,7 +56,18 @@ public Long getConsolidationIntervalMsec() {
* continue to return a repeatable-read state.
*/
public Long getCommitIntervalMsec() {
- return properties.getCommitIntervalMsec();
+ return commitIntervalMsec;
+ }
+
+ /**
+ * @return Wait at least this many milliseconds between committing index data changes and making them visible to
+ * queries (default: 60000, to disable use: 0). For the case where there are a lot of inserts/updates, a
+ * lower value, until commit, will cause the index not to account for them and memory usage would continue
+ * to grow. For the case where there are a few inserts/updates, a higher value will impact performance and
+ * waste disk space for each commit call without any added benefits.
+ */
+ public Long getConsolidationIntervalMsec() {
+ return consolidationIntervalMsec;
}
/**
@@ -76,25 +78,26 @@ public Long getCommitIntervalMsec() {
* performance without any added benefits.
*/
public Long getCleanupIntervalStep() {
- return properties.getCleanupIntervalStep();
+ return cleanupIntervalStep;
}
public ConsolidationPolicy getConsolidationPolicy() {
- return properties.getConsolidationPolicy();
+ return consolidationPolicy;
}
/**
* @return A list of linked collections
*/
+ @JsonDeserialize(using = InternalDeserializers.CollectionLinksDeserializer.class)
public Collection getLinks() {
- return properties.getLinks();
+ return links;
}
/**
* @return A list of primary sort objects
*/
public Collection getPrimarySort() {
- return properties.getPrimarySort();
+ return primarySort;
}
/**
@@ -103,7 +106,7 @@ public Collection getPrimarySort() {
* @since ArangoDB 3.7
*/
public ArangoSearchCompression getPrimarySortCompression() {
- return properties.getPrimarySortCompression();
+ return primarySortCompression;
}
/**
@@ -113,7 +116,7 @@ public ArangoSearchCompression getPrimarySortCompression() {
* @since ArangoDB 3.7
*/
public Collection getStoredValues() {
- return properties.getStoredValues();
+ return storedValues;
}
}
diff --git a/src/main/java/com/arangodb/entity/arangosearch/CollectionLink.java b/src/main/java/com/arangodb/entity/arangosearch/CollectionLink.java
index adf57d9da..d358e24d0 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/CollectionLink.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/CollectionLink.java
@@ -20,27 +20,32 @@
package com.arangodb.entity.arangosearch;
-import java.util.ArrayList;
+import com.arangodb.serde.InternalDeserializers;
+import com.arangodb.serde.InternalSerializers;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
import java.util.Arrays;
import java.util.Collection;
/**
* @author Mark Vollmary
*/
-public class CollectionLink {
+public final class CollectionLink {
private final String name;
- private final Collection analyzers;
+ private Collection analyzers;
private Boolean includeAllFields;
private Boolean trackListPositions;
private StoreValuesType storeValues;
- private final Collection fields;
+ private Collection fields;
private CollectionLink(final String name) {
super();
this.name = name;
- fields = new ArrayList<>();
- analyzers = new ArrayList<>();
}
/**
@@ -49,7 +54,8 @@ private CollectionLink(final String name) {
* @param name Name of a collection
* @return new instance of {@code CollectionLink}
*/
- public static CollectionLink on(final String name) {
+ @JsonCreator
+ public static CollectionLink on(@JsonProperty("name") final String name) {
return new CollectionLink(name);
}
@@ -58,7 +64,7 @@ public static CollectionLink on(final String name) {
* @return link
*/
public CollectionLink analyzers(final String... analyzers) {
- this.analyzers.addAll(Arrays.asList(analyzers));
+ this.analyzers = Arrays.asList(analyzers);
return this;
}
@@ -95,11 +101,13 @@ public CollectionLink storeValues(final StoreValuesType storeValues) {
* @param fields A list of linked fields
* @return link
*/
+ @JsonDeserialize(using = InternalDeserializers.FieldLinksDeserializer.class)
public CollectionLink fields(final FieldLink... fields) {
- this.fields.addAll(Arrays.asList(fields));
+ this.fields = Arrays.asList(fields);
return this;
}
+ @JsonIgnore
public String getName() {
return name;
}
@@ -120,6 +128,7 @@ public StoreValuesType getStoreValues() {
return storeValues;
}
+ @JsonSerialize(using = InternalSerializers.FieldLinksSerializer.class)
public Collection getFields() {
return fields;
}
diff --git a/src/main/java/com/arangodb/entity/arangosearch/ConsolidationPolicy.java b/src/main/java/com/arangodb/entity/arangosearch/ConsolidationPolicy.java
index b0cb50a0a..63bf7483c 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/ConsolidationPolicy.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/ConsolidationPolicy.java
@@ -23,7 +23,7 @@
/**
* @author Mark Vollmary
*/
-public class ConsolidationPolicy {
+public final class ConsolidationPolicy {
private ConsolidationType type;
private Double threshold;
diff --git a/src/main/java/com/arangodb/entity/arangosearch/ConsolidationType.java b/src/main/java/com/arangodb/entity/arangosearch/ConsolidationType.java
index 978a6a0d5..9ab2da72a 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/ConsolidationType.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/ConsolidationType.java
@@ -1,7 +1,13 @@
package com.arangodb.entity.arangosearch;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
public enum ConsolidationType {
- BYTES_ACCUM, TIER
+ @JsonProperty("bytes_accum")
+ BYTES_ACCUM,
+
+ @JsonProperty("tier")
+ TIER
}
\ No newline at end of file
diff --git a/src/main/java/com/arangodb/entity/arangosearch/FieldLink.java b/src/main/java/com/arangodb/entity/arangosearch/FieldLink.java
index d6bf26381..cb3a851dc 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/FieldLink.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/FieldLink.java
@@ -1,23 +1,26 @@
package com.arangodb.entity.arangosearch;
-import java.util.ArrayList;
+import com.arangodb.serde.InternalSerializers;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+
import java.util.Arrays;
import java.util.Collection;
-public class FieldLink {
+public final class FieldLink {
private final String name;
- private final Collection analyzers;
+ private Collection analyzers;
private Boolean includeAllFields;
private Boolean trackListPositions;
private StoreValuesType storeValues;
- private final Collection fields;
+ private Collection fields;
private FieldLink(final String name) {
super();
this.name = name;
- fields = new ArrayList<>();
- analyzers = new ArrayList<>();
}
/**
@@ -26,7 +29,8 @@ private FieldLink(final String name) {
* @param name Name of a field
* @return new instance of {@code FieldLink}
*/
- public static FieldLink on(final String name) {
+ @JsonCreator
+ public static FieldLink on(@JsonProperty("name") final String name) {
return new FieldLink(name);
}
@@ -35,7 +39,7 @@ public static FieldLink on(final String name) {
* @return link
*/
public FieldLink analyzers(final String... analyzers) {
- this.analyzers.addAll(Arrays.asList(analyzers));
+ this.analyzers = Arrays.asList(analyzers);
return this;
}
@@ -73,10 +77,11 @@ public FieldLink storeValues(final StoreValuesType storeValues) {
* @return link
*/
public FieldLink fields(final FieldLink... fields) {
- this.fields.addAll(Arrays.asList(fields));
+ this.fields = Arrays.asList(fields);
return this;
}
+ @JsonIgnore
public String getName() {
return name;
}
@@ -97,6 +102,7 @@ public StoreValuesType getStoreValues() {
return storeValues;
}
+ @JsonSerialize(using = InternalSerializers.FieldLinksSerializer.class)
public Collection getFields() {
return fields;
}
diff --git a/src/main/java/com/arangodb/entity/arangosearch/PrimarySort.java b/src/main/java/com/arangodb/entity/arangosearch/PrimarySort.java
index 32c3a34a3..ab0d7c872 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/PrimarySort.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/PrimarySort.java
@@ -23,7 +23,7 @@
/**
* @author Heiko Kernbach
*/
-public class PrimarySort {
+public final class PrimarySort {
private final String fieldName;
private Boolean ascending;
diff --git a/src/main/java/com/arangodb/entity/arangosearch/StoreValuesType.java b/src/main/java/com/arangodb/entity/arangosearch/StoreValuesType.java
index 3630e903a..23577a4f8 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/StoreValuesType.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/StoreValuesType.java
@@ -20,6 +20,8 @@
package com.arangodb.entity.arangosearch;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
/**
* @author Mark Vollmary
*/
@@ -28,11 +30,13 @@ public enum StoreValuesType {
/**
* Do not track values by the view
*/
+ @JsonProperty("none")
NONE,
/**
* Track only value presence, to allow use of the EXISTS() function.
*/
+ @JsonProperty("id")
ID
}
diff --git a/src/main/java/com/arangodb/entity/arangosearch/StoredValue.java b/src/main/java/com/arangodb/entity/arangosearch/StoredValue.java
index 5d3c2bd36..d44df7a6d 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/StoredValue.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/StoredValue.java
@@ -21,6 +21,9 @@
package com.arangodb.entity.arangosearch;
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
import java.util.List;
/**
@@ -28,12 +31,13 @@
* @see API Documentation
* @since ArangoDB 3.7
*/
-public class StoredValue {
+public final class StoredValue {
private final List fields;
private final ArangoSearchCompression compression;
- public StoredValue(List fields, ArangoSearchCompression compression) {
+ @JsonCreator
+ public StoredValue(@JsonProperty("fields") List fields, @JsonProperty("compression") ArangoSearchCompression compression) {
this.fields = fields;
this.compression = compression;
}
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/AQLAnalyzer.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/AQLAnalyzer.java
index 2677d0de4..4f453cdf2 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/AQLAnalyzer.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/AQLAnalyzer.java
@@ -32,7 +32,7 @@
* @see API Documentation
* @since ArangoDB 3.8
*/
-public class AQLAnalyzer extends SearchAnalyzer {
+public final class AQLAnalyzer extends SearchAnalyzer {
public AQLAnalyzer() {
setType(AnalyzerType.aql);
}
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/AQLAnalyzerProperties.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/AQLAnalyzerProperties.java
index 6118d2c3b..aaa497dd6 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/AQLAnalyzerProperties.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/AQLAnalyzerProperties.java
@@ -27,7 +27,7 @@
/**
* @author Michele Rastelli
*/
-public class AQLAnalyzerProperties {
+public final class AQLAnalyzerProperties {
private String queryString;
private Boolean collapsePositions;
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/CollationAnalyzer.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/CollationAnalyzer.java
index e07d820a3..47a588dc0 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/CollationAnalyzer.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/CollationAnalyzer.java
@@ -33,7 +33,7 @@
* @see API Documentation
* @since ArangoDB 3.9
*/
-public class CollationAnalyzer extends SearchAnalyzer {
+public final class CollationAnalyzer extends SearchAnalyzer {
public CollationAnalyzer() {
setType(AnalyzerType.collation);
}
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/CollationAnalyzerProperties.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/CollationAnalyzerProperties.java
index d056dbaa2..bbfb0581b 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/CollationAnalyzerProperties.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/CollationAnalyzerProperties.java
@@ -27,7 +27,7 @@
* @author Michele Rastelli
* @since ArangoDB 3.9
*/
-public class CollationAnalyzerProperties {
+public final class CollationAnalyzerProperties {
private String locale;
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/DelimiterAnalyzer.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/DelimiterAnalyzer.java
index 764096619..78306f0c1 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/DelimiterAnalyzer.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/DelimiterAnalyzer.java
@@ -31,7 +31,7 @@
* @author Michele Rastelli
* @see API Documentation
*/
-public class DelimiterAnalyzer extends SearchAnalyzer {
+public final class DelimiterAnalyzer extends SearchAnalyzer {
public DelimiterAnalyzer() {
setType(AnalyzerType.delimiter);
}
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/DelimiterAnalyzerProperties.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/DelimiterAnalyzerProperties.java
index c67f05428..21c8ef741 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/DelimiterAnalyzerProperties.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/DelimiterAnalyzerProperties.java
@@ -26,7 +26,7 @@
/**
* @author Michele Rastelli
*/
-public class DelimiterAnalyzerProperties {
+public final class DelimiterAnalyzerProperties {
private String delimiter;
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/EdgeNgram.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/EdgeNgram.java
index 018fc2eac..35c4536da 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/EdgeNgram.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/EdgeNgram.java
@@ -26,7 +26,7 @@
/**
* @author Michele Rastelli
*/
-public class EdgeNgram {
+public final class EdgeNgram {
private long min;
private long max;
private boolean preserveOriginal;
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/GeoAnalyzerOptions.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/GeoAnalyzerOptions.java
index 5b48d1c69..a6a2f6762 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/GeoAnalyzerOptions.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/GeoAnalyzerOptions.java
@@ -27,7 +27,7 @@
/**
* @author Michele Rastelli
*/
-public class GeoAnalyzerOptions {
+public final class GeoAnalyzerOptions {
private Integer maxCells;
private Integer minLevel;
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/GeoJSONAnalyzer.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/GeoJSONAnalyzer.java
index a5005b676..ea8fc9a70 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/GeoJSONAnalyzer.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/GeoJSONAnalyzer.java
@@ -33,7 +33,7 @@
* @see API Documentation
* @since ArangoDB 3.8
*/
-public class GeoJSONAnalyzer extends SearchAnalyzer {
+public final class GeoJSONAnalyzer extends SearchAnalyzer {
public GeoJSONAnalyzer() {
setType(AnalyzerType.geojson);
}
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/GeoJSONAnalyzerProperties.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/GeoJSONAnalyzerProperties.java
index 7c2289666..3ef1cfb7f 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/GeoJSONAnalyzerProperties.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/GeoJSONAnalyzerProperties.java
@@ -26,7 +26,7 @@
/**
* @author Michele Rastelli
*/
-public class GeoJSONAnalyzerProperties {
+public final class GeoJSONAnalyzerProperties {
public enum GeoJSONAnalyzerType {
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/GeoPointAnalyzer.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/GeoPointAnalyzer.java
index e4ead1855..af1890582 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/GeoPointAnalyzer.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/GeoPointAnalyzer.java
@@ -33,7 +33,7 @@
* @see API Documentation
* @since ArangoDB 3.8
*/
-public class GeoPointAnalyzer extends SearchAnalyzer {
+public final class GeoPointAnalyzer extends SearchAnalyzer {
public GeoPointAnalyzer() {
setType(AnalyzerType.geopoint);
}
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/GeoPointAnalyzerProperties.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/GeoPointAnalyzerProperties.java
index f90953421..a0c148216 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/GeoPointAnalyzerProperties.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/GeoPointAnalyzerProperties.java
@@ -27,7 +27,7 @@
/**
* @author Michele Rastelli
*/
-public class GeoPointAnalyzerProperties {
+public final class GeoPointAnalyzerProperties {
private String[] latitude;
private String[] longitude;
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/IdentityAnalyzer.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/IdentityAnalyzer.java
index ad096e669..e658ea327 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/IdentityAnalyzer.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/IdentityAnalyzer.java
@@ -29,7 +29,7 @@
* @author Michele Rastelli
* @see API Documentation
*/
-public class IdentityAnalyzer extends SearchAnalyzer {
+public final class IdentityAnalyzer extends SearchAnalyzer {
public IdentityAnalyzer() {
setType(AnalyzerType.identity);
}
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/NGramAnalyzer.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/NGramAnalyzer.java
index 7e76429fd..83125fa0f 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/NGramAnalyzer.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/NGramAnalyzer.java
@@ -36,7 +36,7 @@
* @author Michele Rastelli
* @see API Documentation
*/
-public class NGramAnalyzer extends SearchAnalyzer {
+public final class NGramAnalyzer extends SearchAnalyzer {
public NGramAnalyzer() {
setType(AnalyzerType.ngram);
}
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/NGramAnalyzerProperties.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/NGramAnalyzerProperties.java
index 534c38916..90b577225 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/NGramAnalyzerProperties.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/NGramAnalyzerProperties.java
@@ -34,7 +34,7 @@
* @author Michele Rastelli
* @see API Documentation
*/
-public class NGramAnalyzerProperties {
+public final class NGramAnalyzerProperties {
private long min;
private long max;
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/NormAnalyzer.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/NormAnalyzer.java
index 4673ccb1b..43ac0a335 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/NormAnalyzer.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/NormAnalyzer.java
@@ -31,7 +31,7 @@
* @author Michele Rastelli
* @see API Documentation
*/
-public class NormAnalyzer extends SearchAnalyzer {
+public final class NormAnalyzer extends SearchAnalyzer {
public NormAnalyzer() {
setType(AnalyzerType.norm);
}
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/NormAnalyzerProperties.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/NormAnalyzerProperties.java
index cb1bcfbb8..72258ea83 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/NormAnalyzerProperties.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/NormAnalyzerProperties.java
@@ -21,20 +21,20 @@
package com.arangodb.entity.arangosearch.analyzer;
-import com.arangodb.velocypack.annotations.SerializedName;
+import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
/**
* @author Michele Rastelli
*/
-public class NormAnalyzerProperties {
+public final class NormAnalyzerProperties {
private String locale;
private boolean accent;
- @SerializedName("case")
+ @JsonProperty("case")
private SearchAnalyzerCase analyzerCase;
/**
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/PipelineAnalyzer.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/PipelineAnalyzer.java
index 6616d3845..9319f38e6 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/PipelineAnalyzer.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/PipelineAnalyzer.java
@@ -36,7 +36,7 @@
* @see API Documentation
* @since ArangoDB 3.8
*/
-public class PipelineAnalyzer extends SearchAnalyzer {
+public final class PipelineAnalyzer extends SearchAnalyzer {
public PipelineAnalyzer() {
setType(AnalyzerType.pipeline);
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/PipelineAnalyzerProperties.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/PipelineAnalyzerProperties.java
index 5cc686d9f..bdcf4a91d 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/PipelineAnalyzerProperties.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/PipelineAnalyzerProperties.java
@@ -28,7 +28,7 @@
/**
* @author Michele Rastelli
*/
-public class PipelineAnalyzerProperties {
+public final class PipelineAnalyzerProperties {
private List pipeline = new LinkedList<>();
/**
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/SearchAnalyzer.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/SearchAnalyzer.java
index 2155a39a8..8963a365f 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/SearchAnalyzer.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/SearchAnalyzer.java
@@ -21,9 +21,11 @@
package com.arangodb.entity.arangosearch.analyzer;
-import com.arangodb.entity.Entity;
import com.arangodb.entity.arangosearch.AnalyzerFeature;
import com.arangodb.entity.arangosearch.AnalyzerType;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
import java.util.Collection;
import java.util.HashSet;
@@ -33,7 +35,23 @@
/**
* @author Michele Rastelli
*/
-public abstract class SearchAnalyzer implements Entity {
+@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.EXTERNAL_PROPERTY, property = "type")
+@JsonSubTypes({
+ @JsonSubTypes.Type(name = "identity", value = IdentityAnalyzer.class),
+ @JsonSubTypes.Type(name = "delimiter", value = DelimiterAnalyzer.class),
+ @JsonSubTypes.Type(name = "stem", value = StemAnalyzer.class),
+ @JsonSubTypes.Type(name = "norm", value = NormAnalyzer.class),
+ @JsonSubTypes.Type(name = "ngram", value = NGramAnalyzer.class),
+ @JsonSubTypes.Type(name = "text", value = TextAnalyzer.class),
+ @JsonSubTypes.Type(name = "pipeline", value = PipelineAnalyzer.class),
+ @JsonSubTypes.Type(name = "stopwords", value = StopwordsAnalyzer.class),
+ @JsonSubTypes.Type(name = "aql", value = AQLAnalyzer.class),
+ @JsonSubTypes.Type(name = "geojson", value = GeoJSONAnalyzer.class),
+ @JsonSubTypes.Type(name = "geopoint", value = GeoPointAnalyzer.class),
+ @JsonSubTypes.Type(name = "segmentation", value = SegmentationAnalyzer.class),
+ @JsonSubTypes.Type(name = "collation", value = CollationAnalyzer.class)
+})
+public abstract class SearchAnalyzer {
private String name;
private AnalyzerType type;
private Collection features;
@@ -52,6 +70,7 @@ public void setName(String name) {
/**
* @return The Analyzer type.
*/
+ @JsonIgnore
public AnalyzerType getType() {
return type;
}
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/SegmentationAnalyzer.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/SegmentationAnalyzer.java
index 70ce2f4cf..6b2f449b3 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/SegmentationAnalyzer.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/SegmentationAnalyzer.java
@@ -35,7 +35,7 @@
* @see API Documentation
* @since ArangoDB 3.9
*/
-public class SegmentationAnalyzer extends SearchAnalyzer {
+public final class SegmentationAnalyzer extends SearchAnalyzer {
public SegmentationAnalyzer() {
setType(AnalyzerType.segmentation);
}
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/SegmentationAnalyzerProperties.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/SegmentationAnalyzerProperties.java
index 221cda81e..a98b39b76 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/SegmentationAnalyzerProperties.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/SegmentationAnalyzerProperties.java
@@ -21,7 +21,7 @@
package com.arangodb.entity.arangosearch.analyzer;
-import com.arangodb.velocypack.annotations.SerializedName;
+import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Objects;
@@ -29,12 +29,12 @@
* @author Michele Rastelli
* @since ArangoDB 3.9
*/
-public class SegmentationAnalyzerProperties {
+public final class SegmentationAnalyzerProperties {
- @SerializedName("break")
+ @JsonProperty("break")
private BreakMode breakMode;
- @SerializedName("case")
+ @JsonProperty("case")
private SearchAnalyzerCase analyzerCase;
public BreakMode getBreakMode() {
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/StemAnalyzer.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/StemAnalyzer.java
index 6e3166c64..0e4fb9cb0 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/StemAnalyzer.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/StemAnalyzer.java
@@ -31,7 +31,7 @@
* @author Michele Rastelli
* @see API Documentation
*/
-public class StemAnalyzer extends SearchAnalyzer {
+public final class StemAnalyzer extends SearchAnalyzer {
public StemAnalyzer() {
setType(AnalyzerType.stem);
}
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/StemAnalyzerProperties.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/StemAnalyzerProperties.java
index b58634f6a..600ffa5a1 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/StemAnalyzerProperties.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/StemAnalyzerProperties.java
@@ -26,7 +26,7 @@
/**
* @author Michele Rastelli
*/
-public class StemAnalyzerProperties {
+public final class StemAnalyzerProperties {
private String locale;
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/StopwordsAnalyzer.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/StopwordsAnalyzer.java
index 264b48d54..c1041e293 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/StopwordsAnalyzer.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/StopwordsAnalyzer.java
@@ -32,7 +32,7 @@
* @see API Documentation
* @since ArangoDB 3.8
*/
-public class StopwordsAnalyzer extends SearchAnalyzer {
+public final class StopwordsAnalyzer extends SearchAnalyzer {
public StopwordsAnalyzer() {
setType(AnalyzerType.stopwords);
}
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/StopwordsAnalyzerProperties.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/StopwordsAnalyzerProperties.java
index 8b094e709..b6f570267 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/StopwordsAnalyzerProperties.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/StopwordsAnalyzerProperties.java
@@ -21,6 +21,8 @@
package com.arangodb.entity.arangosearch.analyzer;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@@ -29,7 +31,7 @@
/**
* @author Michele Rastelli
*/
-public class StopwordsAnalyzerProperties {
+public final class StopwordsAnalyzerProperties {
private static String stringToHex(String str) {
final StringBuilder hex = new StringBuilder();
@@ -57,9 +59,14 @@ public StopwordsAnalyzerProperties() {
private final List stopwords;
private final boolean hex;
+ public List getStopwords() {
+ return stopwords;
+ }
+
/**
* @return list of verbatim strings that describe the tokens to be discarded.
*/
+ @JsonIgnore
public List getStopwordsAsStringList() {
if (hex) {
return stopwords.stream()
@@ -73,6 +80,7 @@ public List getStopwordsAsStringList() {
/**
* @return list of hex-encoded strings that describe the tokens to be discarded.
*/
+ @JsonIgnore
public List getStopwordsAsHexList() {
if (hex) {
return stopwords;
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/TextAnalyzer.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/TextAnalyzer.java
index edc70b858..8bde16668 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/TextAnalyzer.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/TextAnalyzer.java
@@ -32,7 +32,7 @@
* @author Michele Rastelli
* @see API Documentation
*/
-public class TextAnalyzer extends SearchAnalyzer {
+public final class TextAnalyzer extends SearchAnalyzer {
public TextAnalyzer() {
setType(AnalyzerType.text);
}
diff --git a/src/main/java/com/arangodb/entity/arangosearch/analyzer/TextAnalyzerProperties.java b/src/main/java/com/arangodb/entity/arangosearch/analyzer/TextAnalyzerProperties.java
index b22f7bc34..38cbebe89 100644
--- a/src/main/java/com/arangodb/entity/arangosearch/analyzer/TextAnalyzerProperties.java
+++ b/src/main/java/com/arangodb/entity/arangosearch/analyzer/TextAnalyzerProperties.java
@@ -21,7 +21,7 @@
package com.arangodb.entity.arangosearch.analyzer;
-import com.arangodb.velocypack.annotations.SerializedName;
+import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Collections;
import java.util.List;
@@ -30,7 +30,7 @@
/**
* @author Michele Rastelli
*/
-public class TextAnalyzerProperties {
+public final class TextAnalyzerProperties {
public TextAnalyzerProperties() {
stopwords = Collections.emptyList();
@@ -40,7 +40,7 @@ public TextAnalyzerProperties() {
private boolean accent;
- @SerializedName("case")
+ @JsonProperty("case")
private SearchAnalyzerCase analyzerCase;
private boolean stemming;
diff --git a/src/main/java/com/arangodb/internal/ArangoCollectionImpl.java b/src/main/java/com/arangodb/internal/ArangoCollectionImpl.java
index 6dded7789..a97bd4955 100644
--- a/src/main/java/com/arangodb/internal/ArangoCollectionImpl.java
+++ b/src/main/java/com/arangodb/internal/ArangoCollectionImpl.java
@@ -25,7 +25,6 @@
import com.arangodb.entity.*;
import com.arangodb.internal.util.DocumentUtil;
import com.arangodb.model.*;
-import com.arangodb.velocypack.VPackSlice;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -102,7 +101,7 @@ public T getDocument(final String key, final Class type, final DocumentRe
throws ArangoDBException {
DocumentUtil.validateDocumentKey(key);
try {
- return executor.execute(getDocumentRequest(key, options), type);
+ return executor.execute(getDocumentRequest(key, options), getDocumentResponseDeserializer(type));
} catch (final ArangoDBException e) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(e.getMessage(), e);
@@ -232,7 +231,7 @@ public Boolean documentExists(final String key) {
@Override
public Boolean documentExists(final String key, final DocumentExistsOptions options) throws ArangoDBException {
try {
- executor.execute(documentExistsRequest(key, options), VPackSlice.class);
+ executor.execute(documentExistsRequest(key, options), Void.class);
return true;
} catch (final ArangoDBException e) {
diff --git a/src/main/java/com/arangodb/internal/ArangoCursorExecute.java b/src/main/java/com/arangodb/internal/ArangoCursorExecute.java
index 455844113..8e501d66a 100644
--- a/src/main/java/com/arangodb/internal/ArangoCursorExecute.java
+++ b/src/main/java/com/arangodb/internal/ArangoCursorExecute.java
@@ -21,7 +21,7 @@
package com.arangodb.internal;
import com.arangodb.ArangoDBException;
-import com.arangodb.entity.CursorEntity;
+import com.arangodb.internal.cursor.entity.InternalCursorEntity;
import java.util.Map;
@@ -30,7 +30,7 @@
*/
public interface ArangoCursorExecute {
- CursorEntity next(String id, Map meta) throws ArangoDBException;
+ InternalCursorEntity next(String id, Map meta) throws ArangoDBException;
void close(String id, Map meta) throws ArangoDBException;
diff --git a/src/main/java/com/arangodb/internal/ArangoDBImpl.java b/src/main/java/com/arangodb/internal/ArangoDBImpl.java
index ea980dede..cdefb0d3a 100644
--- a/src/main/java/com/arangodb/internal/ArangoDBImpl.java
+++ b/src/main/java/com/arangodb/internal/ArangoDBImpl.java
@@ -28,8 +28,7 @@
import com.arangodb.internal.net.HostHandle;
import com.arangodb.internal.net.HostHandler;
import com.arangodb.internal.net.HostResolver;
-import com.arangodb.internal.util.ArangoSerializationFactory;
-import com.arangodb.internal.util.ArangoSerializationFactory.Serializer;
+import com.arangodb.serde.InternalSerde;
import com.arangodb.internal.velocystream.VstCommunicationSync;
import com.arangodb.internal.velocystream.VstProtocol;
import com.arangodb.model.DBCreateOptions;
@@ -37,7 +36,7 @@
import com.arangodb.model.UserCreateOptions;
import com.arangodb.model.UserUpdateOptions;
import com.arangodb.util.ArangoCursorInitializer;
-import com.arangodb.util.ArangoSerialization;
+import com.arangodb.serde.InternalSerde;
import com.arangodb.velocystream.Request;
import com.arangodb.velocystream.Response;
import org.slf4j.Logger;
@@ -60,11 +59,11 @@ public class ArangoDBImpl extends InternalArangoDB implement
private final HostHandler hostHandler;
public ArangoDBImpl(final VstCommunicationSync.Builder vstBuilder, final HttpCommunication.Builder httpBuilder,
- final ArangoSerializationFactory util, final Protocol protocol, final HostResolver hostResolver,
+ final InternalSerde util, final Protocol protocol, final HostResolver hostResolver,
final HostHandler hostHandler, final ArangoContext context, int responseQueueTimeSamples, final int timeoutMs) {
super(new ArangoExecutorSync(
- createProtocol(vstBuilder, httpBuilder, util.get(Serializer.INTERNAL), protocol),
+ createProtocol(vstBuilder, httpBuilder, util, protocol),
util,
new DocumentCache(), new QueueTimeMetricsImpl(responseQueueTimeSamples), timeoutMs),
util,
@@ -73,11 +72,11 @@ public ArangoDBImpl(final VstCommunicationSync.Builder vstBuilder, final HttpCom
cp = createProtocol(
new VstCommunicationSync.Builder(vstBuilder).maxConnections(1),
new HttpCommunication.Builder(httpBuilder),
- util.get(Serializer.INTERNAL),
+ util,
protocol);
this.hostHandler = hostHandler;
- hostResolver.init(this.executor(), util());
+ hostResolver.init(this.executor(), getSerde());
LOGGER.debug("ArangoDB Client is ready to use");
@@ -86,7 +85,7 @@ public ArangoDBImpl(final VstCommunicationSync.Builder vstBuilder, final HttpCom
private static CommunicationProtocol createProtocol(
final VstCommunicationSync.Builder vstBuilder,
final HttpCommunication.Builder httpBuilder,
- final ArangoSerialization util,
+ final InternalSerde util,
final Protocol protocol) {
return (protocol == null || Protocol.VST == protocol) ? createVST(vstBuilder, util)
@@ -95,13 +94,13 @@ private static CommunicationProtocol createProtocol(
private static CommunicationProtocol createVST(
final VstCommunicationSync.Builder builder,
- final ArangoSerialization util) {
+ final InternalSerde util) {
return new VstProtocol(builder.build(util));
}
private static CommunicationProtocol createHTTP(
final HttpCommunication.Builder builder,
- final ArangoSerialization util) {
+ final InternalSerde util) {
return new HttpProtocol(builder.build(util));
}
diff --git a/src/main/java/com/arangodb/internal/ArangoDatabaseImpl.java b/src/main/java/com/arangodb/internal/ArangoDatabaseImpl.java
index e73fa0fa0..f02e8c516 100644
--- a/src/main/java/com/arangodb/internal/ArangoDatabaseImpl.java
+++ b/src/main/java/com/arangodb/internal/ArangoDatabaseImpl.java
@@ -24,13 +24,14 @@
import com.arangodb.entity.*;
import com.arangodb.entity.arangosearch.analyzer.SearchAnalyzer;
import com.arangodb.internal.cursor.ArangoCursorImpl;
+import com.arangodb.internal.cursor.entity.InternalCursorEntity;
import com.arangodb.internal.net.HostHandle;
import com.arangodb.internal.util.DocumentUtil;
import com.arangodb.model.*;
import com.arangodb.model.arangosearch.AnalyzerDeleteOptions;
import com.arangodb.model.arangosearch.ArangoSearchCreateOptions;
+import com.arangodb.serde.SerdeUtils;
import com.arangodb.util.ArangoCursorInitializer;
-import com.arangodb.velocypack.Type;
import com.arangodb.velocystream.Request;
import java.util.Collection;
@@ -167,7 +168,7 @@ public ArangoCursor query(
final Request request = queryRequest(query, bindVars, options);
final HostHandle hostHandle = new HostHandle();
- final CursorEntity result = executor.execute(request, CursorEntity.class, hostHandle);
+ final InternalCursorEntity result = executor.execute(request, InternalCursorEntity.class, hostHandle);
return createCursor(result, type, options, hostHandle);
@@ -193,21 +194,21 @@ public ArangoCursor query(final String query, final Class type) throws
@Override
public ArangoCursor cursor(final String cursorId, final Class type) throws ArangoDBException {
final HostHandle hostHandle = new HostHandle();
- final CursorEntity result = executor
- .execute(queryNextRequest(cursorId, null, null), CursorEntity.class, hostHandle);
+ final InternalCursorEntity result = executor
+ .execute(queryNextRequest(cursorId, null, null), InternalCursorEntity.class, hostHandle);
return createCursor(result, type, null, hostHandle);
}
private ArangoCursor createCursor(
- final CursorEntity result,
+ final InternalCursorEntity result,
final Class type,
final AqlQueryOptions options,
final HostHandle hostHandle) {
final ArangoCursorExecute execute = new ArangoCursorExecute() {
@Override
- public CursorEntity next(final String id, Map meta) {
- return executor.execute(queryNextRequest(id, options, meta), CursorEntity.class, hostHandle);
+ public InternalCursorEntity next(final String id, Map meta) {
+ return executor.execute(queryNextRequest(id, options, meta), InternalCursorEntity.class, hostHandle);
}
@Override
@@ -262,14 +263,14 @@ public QueryTrackingPropertiesEntity setQueryTrackingProperties(final QueryTrack
@Override
public Collection getCurrentlyRunningQueries() throws ArangoDBException {
- return executor.execute(getCurrentlyRunningQueriesRequest(), new Type>() {
- }.getType());
+ return executor.execute(getCurrentlyRunningQueriesRequest(),
+ SerdeUtils.INSTANCE.constructListType(QueryEntity.class));
}
@Override
public Collection getSlowQueries() throws ArangoDBException {
- return executor.execute(getSlowQueriesRequest(), new Type>() {
- }.getType());
+ return executor.execute(getSlowQueriesRequest(),
+ SerdeUtils.INSTANCE.constructListType(QueryEntity.class));
}
@Override
diff --git a/src/main/java/com/arangodb/internal/ArangoExecuteable.java b/src/main/java/com/arangodb/internal/ArangoExecuteable.java
index dc58fe914..e56d0bc51 100644
--- a/src/main/java/com/arangodb/internal/ArangoExecuteable.java
+++ b/src/main/java/com/arangodb/internal/ArangoExecuteable.java
@@ -20,11 +20,11 @@
package com.arangodb.internal;
+import com.arangodb.ArangoSerdeAccessor;
import com.arangodb.DbName;
-import com.arangodb.internal.util.ArangoSerializationFactory;
-import com.arangodb.internal.util.ArangoSerializationFactory.Serializer;
import com.arangodb.internal.util.EncodeUtils;
-import com.arangodb.util.ArangoSerialization;
+import com.arangodb.serde.ArangoSerde;
+import com.arangodb.serde.InternalSerde;
import com.arangodb.velocystream.Request;
import com.arangodb.velocystream.RequestType;
@@ -33,18 +33,18 @@
/**
* @author Mark Vollmary
*/
-public abstract class ArangoExecuteable {
+public abstract class ArangoExecuteable implements ArangoSerdeAccessor {
private static final String SLASH = "/";
protected final E executor;
- protected final ArangoSerializationFactory util;
+ protected final InternalSerde serde;
protected final ArangoContext context;
- protected ArangoExecuteable(final E executor, final ArangoSerializationFactory util, final ArangoContext context) {
+ protected ArangoExecuteable(final E executor, final InternalSerde serde, final ArangoContext context) {
super();
this.executor = executor;
- this.util = util;
+ this.serde = serde;
this.context = context;
}
@@ -52,12 +52,14 @@ protected E executor() {
return executor;
}
- public ArangoSerialization util() {
- return util.get(Serializer.INTERNAL);
+ @Override
+ public InternalSerde getSerde() {
+ return serde;
}
- public ArangoSerialization util(final Serializer serializer) {
- return util.get(serializer);
+ @Override
+ public ArangoSerde getUserSerde() {
+ return serde.getUserSerde();
}
protected Request request(final DbName dbName, final RequestType requestType, final String... path) {
diff --git a/src/main/java/com/arangodb/internal/ArangoExecutor.java b/src/main/java/com/arangodb/internal/ArangoExecutor.java
index 1dff75c10..8a0555009 100644
--- a/src/main/java/com/arangodb/internal/ArangoExecutor.java
+++ b/src/main/java/com/arangodb/internal/ArangoExecutor.java
@@ -21,66 +21,32 @@
package com.arangodb.internal;
import com.arangodb.QueueTimeMetrics;
-import com.arangodb.entity.Entity;
-import com.arangodb.internal.util.ArangoSerializationFactory;
-import com.arangodb.internal.util.ArangoSerializationFactory.Serializer;
-import com.arangodb.velocypack.exception.VPackException;
+import com.arangodb.serde.InternalSerde;
import com.arangodb.velocystream.Request;
import com.arangodb.velocystream.Response;
-import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
-import java.util.Map;
/**
* @author Mark Vollmary
*/
public abstract class ArangoExecutor {
- @SuppressWarnings("unchecked")
protected T createResult(final Type type, final Response response) {
- if (type != Void.class && response.getBody() != null) {
- if (isInternal(type)) {
- return (T) util.get(Serializer.INTERNAL).deserialize(response.getBody(), type);
- } else {
- return (T) util.get(Serializer.CUSTOM).deserialize(response.getBody(), type);
- }
- } else {
- return null;
- }
- }
-
- private boolean isInternal(final Type type) {
- if (type instanceof ParameterizedType) {
- ParameterizedType pType = ((ParameterizedType) type);
- Type rawType = pType.getRawType();
-
- if (rawType instanceof Class> && (
- Map.class.isAssignableFrom((Class>) rawType) || Iterable.class.isAssignableFrom((Class>) rawType)
- )) {
- for (Type arg : pType.getActualTypeArguments()) {
- if (!isInternal(arg)) {
- return false;
- }
- }
- return true;
- }
- }
-
- return type instanceof Class> && Entity.class.isAssignableFrom((Class>) type);
+ return serde.deserialize(response.getBody(), type);
}
private final DocumentCache documentCache;
private final QueueTimeMetricsImpl qtMetrics;
- private final ArangoSerializationFactory util;
+ private final InternalSerde serde;
private final String timeoutS;
- protected ArangoExecutor(final ArangoSerializationFactory util, final DocumentCache documentCache,
+ protected ArangoExecutor(final InternalSerde serde, final DocumentCache documentCache,
final QueueTimeMetricsImpl qtMetrics, final int timeoutMs) {
super();
this.documentCache = documentCache;
this.qtMetrics = qtMetrics;
- this.util = util;
+ this.serde = serde;
timeoutS = timeoutMs >= 1000 ? Integer.toString(timeoutMs / 1000) : null;
}
@@ -89,7 +55,7 @@ public DocumentCache documentCache() {
}
public interface ResponseDeserializer {
- T deserialize(Response response) throws VPackException;
+ T deserialize(Response response);
}
protected final void interceptResponse(Response response) {
diff --git a/src/main/java/com/arangodb/internal/ArangoExecutorSync.java b/src/main/java/com/arangodb/internal/ArangoExecutorSync.java
index 2f60d2b56..4d9d5875d 100644
--- a/src/main/java/com/arangodb/internal/ArangoExecutorSync.java
+++ b/src/main/java/com/arangodb/internal/ArangoExecutorSync.java
@@ -24,8 +24,7 @@
import com.arangodb.entity.MetaAware;
import com.arangodb.internal.net.CommunicationProtocol;
import com.arangodb.internal.net.HostHandle;
-import com.arangodb.internal.util.ArangoSerializationFactory;
-import com.arangodb.velocypack.exception.VPackException;
+import com.arangodb.serde.InternalSerde;
import com.arangodb.velocystream.Request;
import com.arangodb.velocystream.Response;
import org.slf4j.Logger;
@@ -43,7 +42,7 @@ public class ArangoExecutorSync extends ArangoExecutor {
private final CommunicationProtocol protocol;
- public ArangoExecutorSync(final CommunicationProtocol protocol, final ArangoSerializationFactory util,
+ public ArangoExecutorSync(final CommunicationProtocol protocol, final InternalSerde util,
final DocumentCache documentCache, final QueueTimeMetricsImpl qtMetrics, final int timeoutMs) {
super(util, documentCache, qtMetrics, timeoutMs);
this.protocol = protocol;
@@ -66,22 +65,16 @@ public T execute(
final ResponseDeserializer responseDeserializer,
final HostHandle hostHandle) throws ArangoDBException {
- try {
-
- final Response response = protocol.execute(interceptRequest(request), hostHandle);
- interceptResponse(response);
- T deserialize = responseDeserializer.deserialize(response);
-
- if (deserialize instanceof MetaAware) {
- LOG.debug("Response is MetaAware " + deserialize.getClass().getName());
- ((MetaAware) deserialize).setMeta(response.getMeta());
- }
+ final Response response = protocol.execute(interceptRequest(request), hostHandle);
+ interceptResponse(response);
+ T deserialize = responseDeserializer.deserialize(response);
- return deserialize;
-
- } catch (final VPackException e) {
- throw new ArangoDBException(e);
+ if (deserialize instanceof MetaAware) {
+ LOG.debug("Response is MetaAware {}", deserialize.getClass().getName());
+ ((MetaAware) deserialize).setMeta(response.getMeta());
}
+
+ return deserialize;
}
public void disconnect() {
diff --git a/src/main/java/com/arangodb/internal/ArangoResponseField.java b/src/main/java/com/arangodb/internal/ArangoResponseField.java
index 846774a3e..5ce43feda 100644
--- a/src/main/java/com/arangodb/internal/ArangoResponseField.java
+++ b/src/main/java/com/arangodb/internal/ArangoResponseField.java
@@ -29,7 +29,7 @@ private ArangoResponseField() {
super();
}
- public static final String ERROR = "error";
- public static final String RESULT = "result";
+ public static final String ERROR_FIELD_NAME = "error";
+ public static final String RESULT_JSON_POINTER = "/result";
}
diff --git a/src/main/java/com/arangodb/internal/DocumentCache.java b/src/main/java/com/arangodb/internal/DocumentCache.java
index 63254a6be..61bef4676 100644
--- a/src/main/java/com/arangodb/internal/DocumentCache.java
+++ b/src/main/java/com/arangodb/internal/DocumentCache.java
@@ -92,7 +92,7 @@ private void findAnnotation(
for (Annotation annotation : field.getAnnotations()) {
if (annotation != null && !field.isSynthetic() && !Modifier.isStatic(field.getModifiers())
- && String.class.isAssignableFrom(field.getType())) {
+ && String.class.equals(field.getType())) {
String value = null;
if (annotation instanceof Id) {
value = DocumentFields.ID;
diff --git a/src/main/java/com/arangodb/internal/InternalArangoCollection.java b/src/main/java/com/arangodb/internal/InternalArangoCollection.java
index 70b32b23c..3840fd7a2 100644
--- a/src/main/java/com/arangodb/internal/InternalArangoCollection.java
+++ b/src/main/java/com/arangodb/internal/InternalArangoCollection.java
@@ -24,16 +24,15 @@
import com.arangodb.DbName;
import com.arangodb.entity.*;
import com.arangodb.internal.ArangoExecutor.ResponseDeserializer;
-import com.arangodb.internal.util.ArangoSerializationFactory.Serializer;
import com.arangodb.internal.util.DocumentUtil;
import com.arangodb.internal.util.RequestUtils;
import com.arangodb.model.*;
-import com.arangodb.util.ArangoSerializer;
-import com.arangodb.velocypack.Type;
-import com.arangodb.velocypack.VPackSlice;
+import com.arangodb.serde.SerdeUtils;
import com.arangodb.velocystream.Request;
import com.arangodb.velocystream.RequestType;
+import com.fasterxml.jackson.databind.JsonNode;
+import java.lang.reflect.Type;
import java.util.*;
/**
@@ -67,7 +66,7 @@ public abstract class InternalArangoCollection, D
protected volatile String name;
protected InternalArangoCollection(final D db, final String name) {
- super(db.executor, db.util, db.context);
+ super(db.executor, db.serde, db.context);
this.db = db;
this.name = name;
}
@@ -90,25 +89,15 @@ protected Request insertDocumentRequest(final T value, final DocumentCreateO
request.putQueryParam(OVERWRITE_MODE, params.getOverwriteMode() != null ? params.getOverwriteMode().getValue() : null);
request.putQueryParam(MERGE_OBJECTS, params.getMergeObjects());
request.putHeaderParam(TRANSACTION_ID, params.getStreamTransactionId());
-
- request.setBody(util(Serializer.CUSTOM).serialize(value));
-
+ request.setBody(getSerde().serializeUserData(value));
return request;
}
protected ResponseDeserializer> insertDocumentResponseDeserializer(
final T value, final DocumentCreateOptions options) {
return response -> {
- final VPackSlice body = response.getBody();
- final DocumentCreateEntity doc = util().deserialize(body, DocumentCreateEntity.class);
- final VPackSlice newDoc = body.get(NEW);
- if (newDoc.isObject()) {
- doc.setNew(util(Serializer.CUSTOM).deserialize(newDoc, value.getClass()));
- }
- final VPackSlice oldDoc = body.get(OLD);
- if (oldDoc.isObject()) {
- doc.setOld(util(Serializer.CUSTOM).deserialize(oldDoc, value.getClass()));
- }
+ Type type = SerdeUtils.INSTANCE.constructParametricType(DocumentCreateEntity.class, value.getClass());
+ final DocumentCreateEntity doc = getSerde().deserialize(response.getBody(), type);
if (options == null || Boolean.TRUE != options.getSilent()) {
final Map values = new HashMap<>();
values.put(DocumentFields.ID, doc.getId());
@@ -129,47 +118,31 @@ protected Request insertDocumentsRequest(final Collection values, final D
request.putQueryParam(OVERWRITE_MODE, params.getOverwriteMode() != null ? params.getOverwriteMode().getValue() : null);
request.putQueryParam(MERGE_OBJECTS, params.getMergeObjects());
request.putHeaderParam(TRANSACTION_ID, params.getStreamTransactionId());
-
- request.setBody(util(Serializer.CUSTOM)
- .serialize(values, new ArangoSerializer.Options().serializeNullValues(false).stringAsJson(true)));
+ request.setBody(getSerde().serializeCollectionUserData(values));
return request;
}
- @SuppressWarnings("unchecked")
protected ResponseDeserializer>> insertDocumentsResponseDeserializer(
final Collection values, final DocumentCreateOptions params) {
return response -> {
- Class type = null;
- if (Boolean.TRUE == params.getReturnNew()) {
- if (!values.isEmpty()) {
- type = (Class) values.iterator().next().getClass();
- }
- }
+ Class> userDataClass = getCollectionContentClass(values);
final MultiDocumentEntity> multiDocument = new MultiDocumentEntity<>();
final Collection> docs = new ArrayList<>();
final Collection errors = new ArrayList<>();
final Collection