diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml
index a503d03d..75be71ce 100644
--- a/.github/workflows/gradle.yml
+++ b/.github/workflows/gradle.yml
@@ -21,7 +21,7 @@ jobs:
build:
name: Build
runs-on: ubuntu-latest
- if: ${{ github.event_name == 'push' }}
+ if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
diff --git a/README.md b/README.md
index 52b76695..71b64462 100644
--- a/README.md
+++ b/README.md
@@ -1,12 +1,12 @@
-
+
-
☕ The official Java/JVM client library for EdgeDB ☕
+
☕ The official Java/JVM client library for Gel ☕
-
-
+
+
-
+
@@ -20,13 +20,13 @@ The Java binding is distrubuted via maven central:
#### Gradle
```groovy
-implementation 'com.edgedb:driver:0.3.0'
+implementation 'com.gel:driver:0.3.0'
```
#### Maven
```xml
- com.edgedb
+ com.gel
driver
0.3.0
@@ -36,36 +36,36 @@ implementation 'com.edgedb:driver:0.3.0'
```scala
libraryDependencies ++= Seq(
- "com.edgedb" % "driver" % "0.3.0"
+ "com.gel" % "driver" % "0.3.0"
)
```
## Usage
-The `EdgeDBClient` class contains all the methods necessary to interact with the EdgeDB database.
+The `GelClientPool` class contains all the methods necessary to interact with the Gel database.
```java
-import com.edgedb.driver.EdgeDBClient;
+import com.gel.driver.GelClientPool;
void main() {
- var client = new EdgeDBClient();
+ var clientPool = new GelClientPool();
- client.query(String.class, "SELECT 'Hello, Java!'")
+ clientPool.query(String.class, "SELECT 'Hello, Java!'")
.thenAccept(System.out::println);
}
```
-The `EdgeDBClient` uses `CompletionStage` for asynchronous operations, allowing you
+The `GelClientPool` uses `CompletionStage` for asynchronous operations, allowing you
to integrate it with your favorite asynchronous frameworks
```java
-import com.edgedb.driver.EdgeDBClient;
+import com.gel.driver.GelClientPool;
import reactor.core.publisher.Mono;
void main() {
- var client = new EdgeDBClient();
+ var clientPool = new GelClientPool();
- Mono.fromFuture(client.querySingle(String.class, "SELECT 'Hello, Java!'"))
+ Mono.fromFuture(clientPool.querySingle(String.class, "SELECT 'Hello, Java!'"))
.doOnNext(System.out::println)
.block();
}
@@ -75,15 +75,15 @@ This also means it plays nicely with other JVM language that support asynchronou
```kotlin
-import com.edgedb.driver.EdgeDBClient
+import com.gel.driver.GelClientPool
import kotlinx.coroutines.future.await
import kotlinx.coroutines.runBlocking
fun main() {
- val client = EdgeDBClient()
+ val clientPool = GelClientPool()
runBlocking {
- client.querySingle(String::class.java, "SELECT 'Hello, Kotlin!'")
+ clientPool.querySingle(String::class.java, "SELECT 'Hello, Kotlin!'")
.thenAccept { println(it) }
.await()
}
@@ -92,20 +92,20 @@ fun main() {
```scala
-import com.edgedb.driver.EdgeDBClient
+import com.gel.driver.GelClientPool
import scala.jdk.FutureConverters.*
object Main extends App {
- val client = new EdgeDBClient()
+ val clientPool = new GelClientPool()
- client.querySingle(classOf[String], "SELECT 'Hello, Scala!'")
+ clientPool.querySingle(classOf[String], "SELECT 'Hello, Scala!'")
.asScala
.map(println)
}
```
## Examples
-Some examples of using the Java client api can be found in the [examples](./examples) directory.
+Some examples of using the Java clientPool api can be found in the [examples](./examples) directory.
## Compiling
This project uses gradle. To build the project run the following command:
diff --git a/build.gradle b/build.gradle
index 3111d5e8..7c1e3bd8 100644
--- a/build.gradle
+++ b/build.gradle
@@ -8,8 +8,8 @@ ext {
project_version = '0.3.1-SNAPSHOT'
github_org = 'edgedb'
project_name = 'edgedb-java'
- artifact_group = 'com.edgedb'
- project_description = 'Java binding for the EdgeDB database'
+ artifact_group = 'com.gel'
+ project_description = 'Java binding for Gel'
project_url = "https://edgedb.com"
project_jdk = '11'
jdk = JavaVersion.current().majorVersion
@@ -103,7 +103,7 @@ allprojects {
}
subprojects {
- archivesBaseName = "com.edgedb.$project.name"
+ archivesBaseName = "com.gel.$project.name"
tasks.withType(Javadoc).configureEach {
title = "$archivesBaseName ${version} API"
diff --git a/dbschema/futures.esdl b/dbschema/futures.esdl
index 332c7d84..fa4b1c5f 100644
--- a/dbschema/futures.esdl
+++ b/dbschema/futures.esdl
@@ -1,4 +1,4 @@
# Disable the application of access policies within access policies
-# themselves. This behavior will become the default in EdgeDB 3.0.
+# themselves. This behavior will become the default in Gel 3.0.
# See: https://www.edgedb.com/docs/reference/ddl/access_policies#nonrecursive
using future nonrecursive_access_policies;
diff --git a/docs/conf.py b/docs/conf.py
index fc0a5dda..a8bc0a4d 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -17,9 +17,9 @@
# -- Project information -----------------------------------------------------
-project = 'edgedb'
-copyright = '2019-present MagicStack Inc. and the EdgeDB authors.'
-author = 'MagicStack Inc. and the EdgeDB authors'
+project = 'gel'
+copyright = '2019-present MagicStack Inc. and the Gel authors.'
+author = 'MagicStack Inc. and the Gel authors'
# The full version, including alpha/beta/rc tags
diff --git a/docs/configuration.rst b/docs/configuration.rst
index d214adf7..b4683643 100644
--- a/docs/configuration.rst
+++ b/docs/configuration.rst
@@ -1,17 +1,17 @@
-.. _edgedb-java-configuration:
+.. _gel-java-configuration:
=============
Configuration
=============
-The driver can be configured by passing an ``EdgeDBClientConfig`` object
-into the ``EdgeDBClient`` constructor. The client config contains immutable
-settings for client behavior. You can construct a new ``EdgeDBClientConfig``
+The driver can be configured by passing an ``GelClientConfig`` object
+into the ``GelClientPool`` constructor. The client config contains immutable
+settings for client behavior. You can construct a new ``GelClientConfig``
with the builder subclass like so:
.. code-block:: java
- var builder = EdgeDBClientConfig.builder();
+ var builder = GelClientConfig.builder();
..
@@ -30,7 +30,7 @@ These are the following methods exposed on the configuration builder:
+------------------------------+-------------------------+---------------------------------------------------------------------------------------------+
| ``withConnectionTimeout`` | ``long``, ``TimeUnit`` | The amount of time to wait for a connection to be established. |
+------------------------------+-------------------------+---------------------------------------------------------------------------------------------+
-| ``withMessageTimeout`` | ``long, TimeUnit`` | The amount of time to wait for an expected response from EdgeDB. |
+| ``withMessageTimeout`` | ``long, TimeUnit`` | The amount of time to wait for an expected response from Gel. |
+------------------------------+-------------------------+---------------------------------------------------------------------------------------------+
| ``withExplicitObjectIds`` | ``boolean`` | Whether or not the ``id`` property of objects need to be explicitly included in shapes. |
+------------------------------+-------------------------+---------------------------------------------------------------------------------------------+
@@ -50,7 +50,7 @@ These are the following methods exposed on the configuration builder:
+------------------------------+-------------------------+---------------------------------------------------------------------------------------------+
This configuration object can then be passed into the constructor of
-a ``EdgeDBClient``.
+a ``GelClientPool``.
In addition to client-level configuration, the driver offers session-level
configuration. This type of configuration is controlled using methods prefixed
@@ -59,8 +59,8 @@ connection, pool, and client configuration.
.. code-block:: java
- var client = new EdgeDBClient();
+ var clientPool = new GelClientPool();
- var appliedGlobalClient = client.withGlobals(new HashMap<>(){{
+ var appliedGlobalClient = clientPool.withGlobals(new HashMap<>(){{
put("current_user_id", ...);
}});
\ No newline at end of file
diff --git a/docs/connecting.rst b/docs/connecting.rst
index 97565adf..28c509fb 100644
--- a/docs/connecting.rst
+++ b/docs/connecting.rst
@@ -1,106 +1,69 @@
-.. _edgedb_java_connecting:
+.. _gel_java_connecting:
=====================
Connection Parameters
=====================
-The ``EdgeDBClient`` constructor can consume an ``EdgeDBConnection`` class
-containing connection arguments for the client.
+The ``GelClientPool`` constructor can optionally consume a ``GelConnection``
+object containing connection arguments for the client.
Most of the time, the connection arguments are implicitly resolved via
-:ref:`projects `. In other cases, the ``EdgeDBConnection``
+:ref:`projects `. In other cases, the ``GelConnection``
class exposes ways to construct connection arguments.
Connection builder
------------------
You can use a provided builder by calling the ``builder()`` method on
-``EdgeDBConnection``
+``GelConnection``
.. code-block:: java
- var builder = EdgeDBConnection.builder();
+ var builder = GelConnection.builder();
+ var connection = builder.build();
-The builder has the following methods:
-
-+---------------------+-----------------+-----------------------------------------------------------------------+
-| Name | Type | Description |
-+=====================+=================+=======================================================================+
-| ``withUser`` | String | The username to connect as. |
-+---------------------+-----------------+-----------------------------------------------------------------------+
-| ``withPassword`` | String | The password used to authenticate. |
-+---------------------+-----------------+-----------------------------------------------------------------------+
-| ``withDatabase`` | String | The name of the database to use. |
-+---------------------+-----------------+-----------------------------------------------------------------------+
-| ``withHostname`` | String | The hostname of the database. |
-+---------------------+-----------------+-----------------------------------------------------------------------+
-| ``withPort`` | int | The port of the database. |
-+---------------------+-----------------+-----------------------------------------------------------------------+
-| ``withTlsca`` | String | The TLS certificate authority, used to verify the server certificate. |
-+---------------------+-----------------+-----------------------------------------------------------------------+
-| ``withTlsSecurity`` | TLSSecurityMode | The TLS security policy. |
-+---------------------+-----------------+-----------------------------------------------------------------------+
-
-
-Parse & constructor methods
----------------------------
-
-``EdgeDBConnection`` also exposes static methods used to parse connection
-arguments from different sources.
-
-fromDSN
-^^^^^^^
-
-This method parses a :ref:`DSN ` string into an ``EdgeDBConnection``.
-
-.. code-block:: java
-
- var connection = EdgeDBConnection
- .fromDSN("edgedb://user:pass@host:port/db");
-
-fromProjectFile
-^^^^^^^^^^^^^^^
-
-This method resolves connection arguments from an ``edgedb.toml``
-:ref:`project file `.
-
-.. code-block:: java
-
- var connection = EdgeDBConnection
- .fromProjectFile("~/myproject/edgedb.toml");
+The builder accepts several `parameters `_
+which are used to construct the final ``GelConnection``.
-fromInstanceName
-^^^^^^^^^^^^^^^^
+If no parameters are provided, the default behavior is to search for the
+project's ``gel.toml`` file.
-This method resolves the connection arguments for a given instance name.
-
-.. code-block:: java
-
- var connection = EdgeDBConnection
- .fromInstanceName("my_instance_name");
-
-resolveEdgeDBTOML
-^^^^^^^^^^^^^^^^^
-
-This method is the default behaviour, it scans the current directory for
-a ``edgedb.toml`` project file, if none is found, the parent directory is
-scanned recursivly until a project file is found; if none is found, a
-``FileNotFoundException`` is raised.
-
-.. code-block:: java
-
- var connection = EdgeDBConnection
- .resolveEdgeDBTOML();
-
-parse
-^^^^^
-
-The parse method will resolve the given arguments as well as apply
-environment variables to the connection, following the
-:ref:`priority levels ` of arguments.
-
-.. code-block:: java
-
- var connection = EdgeDBConnection
- .parse("my_instance");
+The builder has the following methods:
++-------------------------------------+--------------------------+-------------------------------------------------------------------------+
+| Name | Type | Description |
++=====================================+==========================+=========================================================================+
+| ``withInstance`` | String | The name of the gel instance to connect to. |
++-------------------------------------+--------------------------+-------------------------------------------------------------------------+
+| ``withDsn`` | String | The DSN to connect to. See: `here `_ for more information. |
++-------------------------------------+--------------------------+-------------------------------------------------------------------------+
+| ``withCredentials`` | String | A json representation of the connection arguments. |
++-------------------------------------+--------------------------+-------------------------------------------------------------------------+
+| ``withCredentialsFile`` | Path | A file to read as the credentials. |
++-------------------------------------+--------------------------+-------------------------------------------------------------------------+
+| ``withHost`` | String | The hostname to connect as. |
++-------------------------------------+--------------------------+-------------------------------------------------------------------------+
+| ``withPort`` | int | The port of the database. |
++-------------------------------------+--------------------------+-------------------------------------------------------------------------+
+| ``withBranch`` | String | The name of the branch to use. |
++-------------------------------------+--------------------------+-------------------------------------------------------------------------+
+| ``withDatabase`` | String | The name of the database to use. (Deprecated in favor of withBranch) |
++-------------------------------------+--------------------------+-------------------------------------------------------------------------+
+| ``withUser`` | String | The username to connect as. |
++-------------------------------------+--------------------------+-------------------------------------------------------------------------+
+| ``withPassword`` | String | The password used to authenticate. |
++-------------------------------------+--------------------------+-------------------------------------------------------------------------+
+| ``withSecretKey`` | String | The secret key used to use for cloud connections. |
++-------------------------------------+--------------------------+-------------------------------------------------------------------------+
+| ``withTLSCertificateAuthority`` | String | The TLS certificate authority, used to verifiy the server certificate. |
++-------------------------------------+--------------------------+-------------------------------------------------------------------------+
+| ``withTLSCertificateAuthorityFile`` | Path | A file to read as the TLS certificate authority. |
++-------------------------------------+--------------------------+-------------------------------------------------------------------------+
+| ``withTlsSecurity`` | TLSSecurityMode | The TLS security policy. |
++-------------------------------------+--------------------------+-------------------------------------------------------------------------+
+| ``withTLSServerName`` | String | The TLS server name to use. Overrides the hostname. |
++-------------------------------------+--------------------------+-------------------------------------------------------------------------+
+| ``withWaitUntilAvailable`` | WaitTime | The time to wait for a connection to the server to be established. |
++-------------------------------------+--------------------------+-------------------------------------------------------------------------+
+| ``withServerSettings`` | HashMap | Additional settings for the server connection. Currently has no effect. |
++-------------------------------------+--------------------------+-------------------------------------------------------------------------+
diff --git a/docs/datamodeling.rst b/docs/datamodeling.rst
index ed3a8886..f3f3f145 100644
--- a/docs/datamodeling.rst
+++ b/docs/datamodeling.rst
@@ -1,4 +1,4 @@
-.. _edgedb_java_datamodeling:
+.. _gel_java_datamodeling:
=============
Data modeling
@@ -10,14 +10,14 @@ Basic representation
--------------------
You can simply create a class that matches the schema types' properties
-by following the :ref:`scalar type map `.
+by following the :ref:`scalar type map `.
.. tabs::
.. code-tab:: java
:caption: Java
- @EdgeDBType
+ @GelType
public class Person {
public String name;
public int Age;
@@ -46,10 +46,10 @@ by following the :ref:`scalar type map `.
There are a few requirements with the class representation:
* All classes that represent data need to be marked with the
- ``@EdgeDBType`` annotation.
+ ``@GelType`` annotation.
* Any multi-link property (collection) needs to be marked with the
- ``@EdgeDBLinkType`` annotation.
+ ``@GelLinkType`` annotation.
* A field must be public *or* have a valid setter if
``useFieldSetters`` is ``true`` in the client configuration.
@@ -69,7 +69,7 @@ under the interface, for example:
.. code-block:: java
- var config = EdgeDBClientConfig.builder()
+ var config = GelClientConfig.builder()
.withNamingStrategy(NamingStrategy.snakeCase())
.build();
@@ -97,7 +97,7 @@ For example, creating a bean that represents the ``Person`` schema type:
.. code-tab:: java
:caption: Java
- @EdgeDBType
+ @GelType
public class Person {
private String name;
private int age;
@@ -147,19 +147,19 @@ Multi-link properties
The JVM doesn't retain generic information for collection generics. To get
around this, you must specify the type of the collection with the
-``@EdgeDBLinkType`` annotation.
+``@GelLinkType`` annotation.
.. tabs::
.. code-tab:: java
:caption: Java
- @EdgeDBType
+ @GelType
public class Person {
public String name;
public int age;
- @EdgeDBLinkType(Person.class)
+ @GelLinkType(Person.class)
public List friends;
}
@@ -192,7 +192,7 @@ Custom deserializers
--------------------
You can specify a constructor as a target for deserialization with the
-``@EdgeDBDeserializer`` annotation. A deserializer has 2 valid modes of
+``@GelDeserializer`` annotation. A deserializer has 2 valid modes of
operation: enumeration consumers or value consumers.
Enumerator consumer
@@ -206,7 +206,7 @@ the name, type, and value.
.. code-block:: java
- @EdgeDBType
+ @GelType
public class Person {
private String name;
private int age;
@@ -227,7 +227,7 @@ the name, type, and value.
}
}
- } catch(EdgeDBException err) { // deserialization error
+ } catch(GelException err) { // deserialization error
} catch(OperationNotSupportedException err) { // read/IO error
@@ -240,9 +240,9 @@ for other data type representations, like tuples:
.. code-block:: java
- @EdgeDBDeserializer
+ @GelDeserializer
public SimpleTuple(ObjectEnumerator enumerator)
- throws EdgeDBException, OperationNotSupportedException {
+ throws GelException, OperationNotSupportedException {
elements = new ArrayList<>();
while(enumerator.hasRemaining()) {
@@ -261,22 +261,22 @@ Value consumers
^^^^^^^^^^^^^^^
Value consumers take in the fields' values in the constructor, mapped by a
-``@EdgeDBName`` annotation:
+``@GelName`` annotation:
.. tabs::
.. code-tab:: java
:caption: Java
- @EdgeDBType
+ @GelType
public class Person {
private final String name;
private final int age;
- @EdgeDBDeserializer
+ @GelDeserializer
public Person(
- @EdgeDBName("name") String name,
- @EdgeDBName("age") int age
+ @GelName("name") String name,
+ @GelName("age") int age
) {
this.name = name;
this.age = age;
@@ -317,17 +317,17 @@ schema types in code. For example:
.. code-tab:: java
:caption: Java
- @EdgeDBType
+ @GelType
public abstract class Media {
public String title;
}
- @EdgeDBType
+ @GelType
public class Show extends Media {
public Long seasons;
}
- @EdgeDBType
+ @GelType
public class Movie extends Media {
public Long release_year;
}
diff --git a/docs/datatypes.rst b/docs/datatypes.rst
index 62ce1e3a..e667ee09 100644
--- a/docs/datatypes.rst
+++ b/docs/datatypes.rst
@@ -1,19 +1,19 @@
-.. _edgedb_java_datatypes:
+.. _gel_java_datatypes:
=========
Datatypes
=========
-The Java binding maps the following EdgeDB types to corresponding JVM types:
+The Java binding maps the following Gel types to corresponding JVM types:
+------------------------------------+---------------------------------------------------------+
-| EdgeDB Type | JVM Type |
+| Gel Type | JVM Type |
+====================================+=========================================================+
| ``Set`` | ``Collection`` |
+------------------------------------+---------------------------------------------------------+
| :eql:type:`array` | ``T[]`` |
+------------------------------------+---------------------------------------------------------+
-| :eql:type:`anytuple` | ``com.edgedb.driver.datatypes.Tuple`` |
+| :eql:type:`anytuple` | ``com.gel.driver.datatypes.Tuple`` |
+------------------------------------+---------------------------------------------------------+
| :eql:type:`anyenum` | ``enum`` |
+------------------------------------+---------------------------------------------------------+
@@ -31,7 +31,7 @@ The Java binding maps the following EdgeDB types to corresponding JVM types:
+------------------------------------+---------------------------------------------------------+
| :eql:type:`cal::local_datetime` | ``java.time.LocalDateTime`` |
+------------------------------------+---------------------------------------------------------+
-| :eql:type:`cal::relative_duration` | ``com.edgedb.driver.datatypes.RelativeDuration`` [#f1]_ |
+| :eql:type:`cal::relative_duration` | ``com.gel.driver.datatypes.RelativeDuration`` [#f1]_ |
+------------------------------------+---------------------------------------------------------+
| :eql:type:`datetime` | ``java.time.OffsetDateTime`` [#f2]_ |
+------------------------------------+---------------------------------------------------------+
@@ -51,11 +51,11 @@ The Java binding maps the following EdgeDB types to corresponding JVM types:
+------------------------------------+---------------------------------------------------------+
| :eql:type:`decimal` | ``java.math.BigDecimal`` |
+------------------------------------+---------------------------------------------------------+
-| :eql:type:`json` | ``com.edgedb.driver.datatypes.Json`` |
+| :eql:type:`json` | ``com.gel.driver.datatypes.Json`` |
+------------------------------------+---------------------------------------------------------+
| :eql:type:`uuid` | ``UUID`` |
+------------------------------------+---------------------------------------------------------+
-| :eql:func:`range` | ``com.edgedb.driver.datatypes.Range`` |
+| :eql:func:`range` | ``com.gel.driver.datatypes.Range`` |
+------------------------------------+---------------------------------------------------------+
.. [#f1] ``Period`` and ``Duration`` are implicitly
diff --git a/docs/index.rst b/docs/index.rst
index d93e8b5d..9825e717 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1,8 +1,8 @@
-.. _edgedb-java-intro:
+.. _gel-java-intro:
-==============================
-Java client library for EdgeDB
-==============================
+===========================
+Java client library for Gel
+===========================
.. toctree::
:maxdepth: 3
@@ -15,12 +15,12 @@ Java client library for EdgeDB
transactions
-This is the official EdgeDB Java client, available to other JVM languages as well.
+This is the official Gel Java client, available to other JVM languages as well.
Quickstart
----------
-To get started, you will need to setup an EdgeDB project and have an instance
+To get started, you will need to setup an Gel project and have an instance
created. For more information regarding how to do this, we recommend going
through the `Quickstart guide `_.
@@ -33,17 +33,17 @@ project.
:caption: Maven
- com.edgedb
+ com.gel
driver
.. code-tab:: groovy
:caption: Gradle
- implementation 'com.edgedb:driver'
+ implementation 'com.gel:driver'
Once you have the dependency added, you can start using the client. The
-following is a simple example of how to connect to an EdgeDB instance and
+following is a simple example of how to connect to an Gel instance and
execute a query:
.. tabs::
@@ -51,14 +51,14 @@ execute a query:
.. code-tab:: java
:caption: Futures
- import com.edgedb.driver.EdgeDBClient;
+ import com.gel.driver.GelClientPool;
import java.util.concurrent.CompletableFuture;
public class Main {
public static void main(String[] args) {
- var client = new EdgeDBClient();
+ var clientPool = new GelClientPool();
- client.querySingle(String.class, "SELECT 'Hello, Java!'")
+ clientPool.querySingle(String.class, "SELECT 'Hello, Java!'")
.thenAccept(System.out::println)
.toCompletableFuture().get();
}
@@ -67,14 +67,14 @@ execute a query:
.. code-tab:: java
:caption: Reactor
- import com.edgedb.driver.EdgeDBClient;
+ import com.gel.driver.GelClientPool;
import reactor.core.publisher.Mono;
public class Main {
public static void main(String[] args) {
- var client = new EdgeDBClient();
+ var clientPool = new GelClientPool();
- Mono.fromFuture(client.querySingle(String.class, "SELECT 'Hello, Java!'"))
+ Mono.fromFuture(clientPool.querySingle(String.class, "SELECT 'Hello, Java!'"))
.doOnNext(System.out::println)
.block();
}
@@ -88,7 +88,7 @@ schema type:
.. code-tab:: java
:caption: Code
- @EdgeDBType
+ @GelType
public class Person {
public String name;
public int age;
@@ -96,7 +96,7 @@ schema type:
..
- client.query(Person.class, "SELECT Person { name, age }")
+ clientPool.query(Person.class, "SELECT Person { name, age }")
.thenAccept(result -> {
for(var person : result) {
System.out.println("Person { " + person.name + ", " + person.age + "}");
@@ -123,7 +123,7 @@ schema type:
}
}
-Learn more about :ref:`data modeling `.
+Learn more about :ref:`data modeling `.
Logging
-------
diff --git a/docs/transactions.rst b/docs/transactions.rst
index 067586cd..b12c81a5 100644
--- a/docs/transactions.rst
+++ b/docs/transactions.rst
@@ -1,4 +1,4 @@
-.. _edgedb_java_transactions:
+.. _gel_java_transactions:
============
Transactions
@@ -6,7 +6,7 @@ Transactions
Transactions are a robust concept to ensure your queries are executed,
even if network errors occur. To do this, simply use the ``transaction``
-method on ``EdgeDBClient``.
+method on ``GelClientPool``.
.. code-block:: java
diff --git a/examples/java-examples/build.gradle b/examples/java-examples/build.gradle
index d393870a..17a8d123 100644
--- a/examples/java-examples/build.gradle
+++ b/examples/java-examples/build.gradle
@@ -2,7 +2,7 @@ plugins {
id 'java'
}
-group 'com.edgedb'
+group 'com.gel'
version '0.0.1-SNAPSHOT'
repositories {
diff --git a/examples/java-examples/src/main/java/com/edgedb/examples/CustomDeserializer.java b/examples/java-examples/src/main/java/com/edgedb/examples/CustomDeserializer.java
deleted file mode 100644
index a0c8433f..00000000
--- a/examples/java-examples/src/main/java/com/edgedb/examples/CustomDeserializer.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package com.edgedb.examples;
-
-import com.edgedb.driver.EdgeDBClient;
-import com.edgedb.driver.annotations.EdgeDBDeserializer;
-import com.edgedb.driver.annotations.EdgeDBName;
-import com.edgedb.driver.annotations.EdgeDBType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.concurrent.CompletionStage;
-
-public final class CustomDeserializer implements Example {
- private static final Logger logger = LoggerFactory.getLogger(CustomDeserializer.class);
-
- @EdgeDBType
- public static final class Person {
- private final String name;
- private final Long age;
-
- @EdgeDBDeserializer
- public Person(
- @EdgeDBName("name") String name,
- @EdgeDBName("age") Long age
- ) {
- this.name = name;
- this.age = age;
-
- logger.info("Custom deserializer called");
- }
- }
-
- @Override
- public CompletionStage run(EdgeDBClient client) {
- return client.execute("insert Person { name := 'Example', age := 123 } unless conflict on .name")
- .thenCompose(v -> client.queryRequiredSingle(Person.class, "select Person { name, age } filter .name = 'Example'"))
- .thenAccept(person -> logger.info("Person result: {person}"));
- }
-}
\ No newline at end of file
diff --git a/examples/java-examples/src/main/java/com/edgedb/examples/Example.java b/examples/java-examples/src/main/java/com/edgedb/examples/Example.java
deleted file mode 100644
index e6eabd47..00000000
--- a/examples/java-examples/src/main/java/com/edgedb/examples/Example.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.edgedb.examples;
-
-import com.edgedb.driver.EdgeDBClient;
-
-import java.util.concurrent.CompletionStage;
-
-public interface Example {
- CompletionStage run(EdgeDBClient client);
-}
\ No newline at end of file
diff --git a/examples/java-examples/src/main/java/com/edgedb/examples/AbstractTypes.java b/examples/java-examples/src/main/java/com/gel/examples/AbstractTypes.java
similarity index 67%
rename from examples/java-examples/src/main/java/com/edgedb/examples/AbstractTypes.java
rename to examples/java-examples/src/main/java/com/gel/examples/AbstractTypes.java
index e30ce6f3..7f8dd0d3 100644
--- a/examples/java-examples/src/main/java/com/edgedb/examples/AbstractTypes.java
+++ b/examples/java-examples/src/main/java/com/gel/examples/AbstractTypes.java
@@ -1,7 +1,7 @@
-package com.edgedb.examples;
+package com.gel.examples;
-import com.edgedb.driver.EdgeDBClient;
-import com.edgedb.driver.annotations.EdgeDBType;
+import com.gel.driver.GelClientPool;
+import com.gel.driver.annotations.GelType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -10,27 +10,27 @@
public class AbstractTypes implements Example {
private static final Logger logger = LoggerFactory.getLogger(AbstractTypes.class);
- @EdgeDBType
+ @GelType
public static abstract class Media {
public String title;
}
- @EdgeDBType
+ @GelType
public static class Show extends Media {
public Long seasons;
}
- @EdgeDBType
+ @GelType
public static class Movie extends Media {
public Long releaseYear;
}
@Override
- public CompletionStage run(EdgeDBClient client) {
- return client
+ public CompletionStage run(GelClientPool clientPool) {
+ return clientPool
.execute("insert Movie { title := \"The Matrix\", release_year := 1999 } unless conflict on .title")
- .thenCompose(v -> client.execute("insert Show { title := \"The Office\", seasons := 9 } unless conflict on .title"))
- .thenCompose(v -> client.query(Media.class, "select Media { title, [is Movie].release_year, [is Show].seasons }"))
+ .thenCompose(v -> clientPool.execute("insert Show { title := \"The Office\", seasons := 9 } unless conflict on .title"))
+ .thenCompose(v -> clientPool.query(Media.class, "select Media { title, [is Movie].release_year, [is Show].seasons }"))
.thenAccept(content -> {
for (var media : content) {
if(media instanceof Show) {
diff --git a/examples/java-examples/src/main/java/com/edgedb/examples/BasicQueryFunctions.java b/examples/java-examples/src/main/java/com/gel/examples/BasicQueryFunctions.java
similarity index 57%
rename from examples/java-examples/src/main/java/com/edgedb/examples/BasicQueryFunctions.java
rename to examples/java-examples/src/main/java/com/gel/examples/BasicQueryFunctions.java
index a1e9126b..ac235086 100644
--- a/examples/java-examples/src/main/java/com/edgedb/examples/BasicQueryFunctions.java
+++ b/examples/java-examples/src/main/java/com/gel/examples/BasicQueryFunctions.java
@@ -1,6 +1,6 @@
-package com.edgedb.examples;
+package com.gel.examples;
-import com.edgedb.driver.EdgeDBClient;
+import com.gel.driver.GelClientPool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -10,12 +10,12 @@ public final class BasicQueryFunctions implements Example {
private static final Logger logger = LoggerFactory.getLogger(BasicQueryFunctions.class);
@Override
- public CompletionStage run(EdgeDBClient client) {
- return client.query(String.class, "select 'Hello, Java!'")
+ public CompletionStage run(GelClientPool clientPool) {
+ return clientPool.query(String.class, "select 'Hello, Java!'")
.thenAccept(result -> logger.info("query result: {}", result))
- .thenCompose(v -> client.querySingle(String.class, "select 'Hello, Java!'"))
+ .thenCompose(v -> clientPool.querySingle(String.class, "select 'Hello, Java!'"))
.thenAccept(result -> logger.info("querySingle result: {}", result))
- .thenCompose(v -> client.queryRequiredSingle(String.class, "select 'Hello, Java!'"))
+ .thenCompose(v -> clientPool.queryRequiredSingle(String.class, "select 'Hello, Java!'"))
.thenAccept(result -> logger.info("queryRequiredSingle result: {}", result));
}
}
\ No newline at end of file
diff --git a/examples/java-examples/src/main/java/com/gel/examples/CustomDeserializer.java b/examples/java-examples/src/main/java/com/gel/examples/CustomDeserializer.java
new file mode 100644
index 00000000..f969764c
--- /dev/null
+++ b/examples/java-examples/src/main/java/com/gel/examples/CustomDeserializer.java
@@ -0,0 +1,38 @@
+package com.gel.examples;
+
+import com.gel.driver.GelClientPool;
+import com.gel.driver.annotations.GelDeserializer;
+import com.gel.driver.annotations.GelName;
+import com.gel.driver.annotations.GelType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.concurrent.CompletionStage;
+
+public final class CustomDeserializer implements Example {
+ private static final Logger logger = LoggerFactory.getLogger(CustomDeserializer.class);
+
+ @GelType
+ public static final class Person {
+ private final String name;
+ private final Long age;
+
+ @GelDeserializer
+ public Person(
+ @GelName("name") String name,
+ @GelName("age") Long age
+ ) {
+ this.name = name;
+ this.age = age;
+
+ logger.info("Custom deserializer called");
+ }
+ }
+
+ @Override
+ public CompletionStage run(GelClientPool clientPool) {
+ return clientPool.execute("insert Person { name := 'Example', age := 123 } unless conflict on .name")
+ .thenCompose(v -> clientPool.queryRequiredSingle(Person.class, "select Person { name, age } filter .name = 'Example'"))
+ .thenAccept(person -> logger.info("Person result: {person}"));
+ }
+}
\ No newline at end of file
diff --git a/examples/java-examples/src/main/java/com/gel/examples/Example.java b/examples/java-examples/src/main/java/com/gel/examples/Example.java
new file mode 100644
index 00000000..e5679e53
--- /dev/null
+++ b/examples/java-examples/src/main/java/com/gel/examples/Example.java
@@ -0,0 +1,9 @@
+package com.gel.examples;
+
+import com.gel.driver.GelClientPool;
+
+import java.util.concurrent.CompletionStage;
+
+public interface Example {
+ CompletionStage run(GelClientPool clientPool);
+}
\ No newline at end of file
diff --git a/examples/java-examples/src/main/java/com/edgedb/examples/GlobalsAndConfig.java b/examples/java-examples/src/main/java/com/gel/examples/GlobalsAndConfig.java
similarity index 83%
rename from examples/java-examples/src/main/java/com/edgedb/examples/GlobalsAndConfig.java
rename to examples/java-examples/src/main/java/com/gel/examples/GlobalsAndConfig.java
index 7d880cad..247874f4 100644
--- a/examples/java-examples/src/main/java/com/edgedb/examples/GlobalsAndConfig.java
+++ b/examples/java-examples/src/main/java/com/gel/examples/GlobalsAndConfig.java
@@ -1,6 +1,6 @@
-package com.edgedb.examples;
+package com.gel.examples;
-import com.edgedb.driver.EdgeDBClient;
+import com.gel.driver.GelClientPool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -13,8 +13,8 @@ public final class GlobalsAndConfig implements Example {
private static final Logger logger = LoggerFactory.getLogger(GlobalsAndConfig.class);
@Override
- public CompletionStage run(EdgeDBClient client) {
- var configuredClient = client
+ public CompletionStage run(GelClientPool clientPool) {
+ var configuredClient = clientPool
.withConfig(config -> config
.withIdleTransactionTimeout(Duration.ZERO)
.applyAccessPolicies(true))
diff --git a/examples/java-examples/src/main/java/com/edgedb/examples/JsonResults.java b/examples/java-examples/src/main/java/com/gel/examples/JsonResults.java
similarity index 79%
rename from examples/java-examples/src/main/java/com/edgedb/examples/JsonResults.java
rename to examples/java-examples/src/main/java/com/gel/examples/JsonResults.java
index 6d5e229f..1d1e06c3 100644
--- a/examples/java-examples/src/main/java/com/edgedb/examples/JsonResults.java
+++ b/examples/java-examples/src/main/java/com/gel/examples/JsonResults.java
@@ -1,7 +1,7 @@
-package com.edgedb.examples;
+package com.gel.examples;
-import com.edgedb.driver.EdgeDBClient;
-import com.edgedb.driver.annotations.EdgeDBType;
+import com.gel.driver.GelClientPool;
+import com.gel.driver.annotations.GelType;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.json.JsonMapper;
import org.slf4j.Logger;
@@ -14,16 +14,16 @@ public final class JsonResults implements Example {
private static final Logger logger = LoggerFactory.getLogger(JsonResults.class);
private static final JsonMapper mapper = new JsonMapper();
- @EdgeDBType
+ @GelType
public static final class Person {
public String name;
public Long age;
}
@Override
- public CompletionStage run(EdgeDBClient client) {
+ public CompletionStage run(GelClientPool clientPool) {
- return client.queryJson("select Person { name, age }")
+ return clientPool.queryJson("select Person { name, age }")
.thenApply(result -> {
try {
return mapper.readValue(result.getValue(), Person[].class);
diff --git a/examples/java-examples/src/main/java/com/edgedb/examples/LinkProperties.java b/examples/java-examples/src/main/java/com/gel/examples/LinkProperties.java
similarity index 77%
rename from examples/java-examples/src/main/java/com/edgedb/examples/LinkProperties.java
rename to examples/java-examples/src/main/java/com/gel/examples/LinkProperties.java
index 9a3d84d9..2c63e045 100644
--- a/examples/java-examples/src/main/java/com/edgedb/examples/LinkProperties.java
+++ b/examples/java-examples/src/main/java/com/gel/examples/LinkProperties.java
@@ -1,8 +1,8 @@
-package com.edgedb.examples;
+package com.gel.examples;
-import com.edgedb.driver.EdgeDBClient;
-import com.edgedb.driver.annotations.EdgeDBLinkType;
-import com.edgedb.driver.annotations.EdgeDBType;
+import com.gel.driver.GelClientPool;
+import com.gel.driver.annotations.GelLinkType;
+import com.gel.driver.annotations.GelType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -12,12 +12,12 @@
public final class LinkProperties implements Example {
private static final Logger logger = LoggerFactory.getLogger(LinkProperties.class);
- @EdgeDBType
+ @GelType
public static final class Person {
public String name;
public Long age;
public Person bestFriend;
- @EdgeDBLinkType(Person.class)
+ @GelLinkType(Person.class)
public Collection friends;
}
@@ -28,10 +28,10 @@ public static final class Person {
"insert Person { name := 'Person D', age := 23, friends := { a, b, c }, best_friend := c } unless conflict on .name";
@Override
- public CompletionStage run(EdgeDBClient client) {
- return client.execute(INSERT_QUERY)
+ public CompletionStage run(GelClientPool clientPool) {
+ return clientPool.execute(INSERT_QUERY)
.thenCompose(v ->
- client.queryRequiredSingle(
+ clientPool.queryRequiredSingle(
Person.class,
"select Person { name, age, friends: { name, age, friends }, best_friend: { name, age, friends } } filter .name = 'Person D'"
))
diff --git a/examples/java-examples/src/main/java/com/edgedb/examples/Main.java b/examples/java-examples/src/main/java/com/gel/examples/Main.java
similarity index 73%
rename from examples/java-examples/src/main/java/com/edgedb/examples/Main.java
rename to examples/java-examples/src/main/java/com/gel/examples/Main.java
index 0204e280..cf4105a7 100644
--- a/examples/java-examples/src/main/java/com/edgedb/examples/Main.java
+++ b/examples/java-examples/src/main/java/com/gel/examples/Main.java
@@ -1,8 +1,8 @@
-package com.edgedb.examples;
+package com.gel.examples;
-import com.edgedb.driver.*;
-import com.edgedb.driver.exceptions.EdgeDBException;
-import com.edgedb.driver.namingstrategies.NamingStrategy;
+import com.gel.driver.*;
+import com.gel.driver.exceptions.GelException;
+import com.gel.driver.namingstrategies.NamingStrategy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -13,21 +13,21 @@
public class Main {
private static final Logger logger = LoggerFactory.getLogger(Main.class);
- public static void main(String[] args) throws IOException, EdgeDBException {
- var client = new EdgeDBClient(EdgeDBClientConfig.builder()
+ public static void main(String[] args) throws IOException, GelException {
+ var clientPool = new GelClientPool(GelClientConfig.builder()
.withNamingStrategy(NamingStrategy.snakeCase())
.useFieldSetters(true)
.build()
).withModule("examples");
- runJavaExamples(client);
+ runJavaExamples(clientPool);
logger.info("Examples complete");
System.exit(0);
}
- private static void runJavaExamples(EdgeDBClient client) {
+ private static void runJavaExamples(GelClientPool clientPool) {
var examples = new ArrayList>() {
{
add(AbstractTypes::new);
@@ -45,7 +45,7 @@ private static void runJavaExamples(EdgeDBClient client) {
var inst = example.get();
logger.info("Running Java example {}...", inst);
try {
- inst.run(client).toCompletableFuture().get();
+ inst.run(clientPool).toCompletableFuture().get();
logger.info("Java example {} complete!", inst);
}
catch (Exception x) {
diff --git a/examples/java-examples/src/main/java/com/edgedb/examples/QueryResults.java b/examples/java-examples/src/main/java/com/gel/examples/QueryResults.java
similarity index 58%
rename from examples/java-examples/src/main/java/com/edgedb/examples/QueryResults.java
rename to examples/java-examples/src/main/java/com/gel/examples/QueryResults.java
index 8b310204..6070c073 100644
--- a/examples/java-examples/src/main/java/com/edgedb/examples/QueryResults.java
+++ b/examples/java-examples/src/main/java/com/gel/examples/QueryResults.java
@@ -1,7 +1,7 @@
-package com.edgedb.examples;
+package com.gel.examples;
-import com.edgedb.driver.EdgeDBClient;
-import com.edgedb.driver.annotations.EdgeDBType;
+import com.gel.driver.GelClientPool;
+import com.gel.driver.annotations.GelType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -10,7 +10,7 @@
public final class QueryResults implements Example {
private static final Logger logger = LoggerFactory.getLogger(QueryResults.class);
- @EdgeDBType
+ @GelType
public static final class Person {
public String name;
public Long age;
@@ -24,9 +24,9 @@ public void setAge(Long age) {
}
@Override
- public CompletionStage run(EdgeDBClient client) {
- return client.execute("insert Person { name := 'Example', age := 1234 } unless conflict on .name")
- .thenCompose(v -> client.queryRequiredSingle(Person.class, "select Person { name, age } filter .name = 'Example'"))
+ public CompletionStage run(GelClientPool clientPool) {
+ return clientPool.execute("insert Person { name := 'Example', age := 1234 } unless conflict on .name")
+ .thenCompose(v -> clientPool.queryRequiredSingle(Person.class, "select Person { name, age } filter .name = 'Example'"))
.thenAccept(result -> logger.info("Person returned from query: {}", result));
}
}
\ No newline at end of file
diff --git a/examples/java-examples/src/main/java/com/edgedb/examples/Transactions.java b/examples/java-examples/src/main/java/com/gel/examples/Transactions.java
similarity index 73%
rename from examples/java-examples/src/main/java/com/edgedb/examples/Transactions.java
rename to examples/java-examples/src/main/java/com/gel/examples/Transactions.java
index 3534f1d6..9ba55f64 100644
--- a/examples/java-examples/src/main/java/com/edgedb/examples/Transactions.java
+++ b/examples/java-examples/src/main/java/com/gel/examples/Transactions.java
@@ -1,6 +1,6 @@
-package com.edgedb.examples;
+package com.gel.examples;
-import com.edgedb.driver.EdgeDBClient;
+import com.gel.driver.GelClientPool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -11,14 +11,14 @@ public final class Transactions implements Example {
private static final Logger logger = LoggerFactory.getLogger(Transactions.class);
@Override
- public CompletionStage run(EdgeDBClient client) {
+ public CompletionStage run(GelClientPool clientPool) {
// verify we can run transactions
- if(!client.supportsTransactions()) {
- logger.info("Skipping transactions, client type {} doesn't support it", client.getClientType());
+ if(!clientPool.supportsTransactions()) {
+ logger.info("Skipping transactions, client type {} doesn't support it", clientPool.getClientType());
return CompletableFuture.completedFuture(null);
}
- return client.transaction(tx -> {
+ return clientPool.transaction(tx -> {
logger.info("In transaction");
return tx.queryRequiredSingle(String.class, "select 'Result from Transaction'");
}).thenAccept(result -> {
diff --git a/examples/kotlin-examples/build.gradle b/examples/kotlin-examples/build.gradle
index 31805949..abda2a39 100644
--- a/examples/kotlin-examples/build.gradle
+++ b/examples/kotlin-examples/build.gradle
@@ -3,7 +3,7 @@ plugins {
id 'org.jetbrains.kotlin.jvm' version '1.9.0-Beta'
}
-group 'com.edgedb'
+group 'com.gel'
version '0.0.1-SNAPSHOT'
repositories {
diff --git a/examples/kotlin-examples/src/main/kotlin/com/edgedb/examples/Example.kt b/examples/kotlin-examples/src/main/kotlin/com/edgedb/examples/Example.kt
deleted file mode 100644
index 720a9421..00000000
--- a/examples/kotlin-examples/src/main/kotlin/com/edgedb/examples/Example.kt
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.edgedb.examples
-
-import com.edgedb.driver.EdgeDBClient
-
-interface Example {
- suspend fun runAsync(client: EdgeDBClient)
-}
\ No newline at end of file
diff --git a/examples/kotlin-examples/src/main/kotlin/com/edgedb/examples/AbstractTypes.kt b/examples/kotlin-examples/src/main/kotlin/com/gel/examples/AbstractTypes.kt
similarity index 83%
rename from examples/kotlin-examples/src/main/kotlin/com/edgedb/examples/AbstractTypes.kt
rename to examples/kotlin-examples/src/main/kotlin/com/gel/examples/AbstractTypes.kt
index c4099d54..fa05c0e7 100644
--- a/examples/kotlin-examples/src/main/kotlin/com/edgedb/examples/AbstractTypes.kt
+++ b/examples/kotlin-examples/src/main/kotlin/com/gel/examples/AbstractTypes.kt
@@ -1,7 +1,7 @@
-package com.edgedb.examples
+package com.gel.examples
-import com.edgedb.driver.EdgeDBClient
-import com.edgedb.driver.annotations.EdgeDBType
+import com.gel.driver.GelClientPool
+import com.gel.driver.annotations.GelType
import kotlinx.coroutines.future.await
import org.slf4j.LoggerFactory
@@ -10,23 +10,23 @@ class AbstractTypes : Example {
private val logger = LoggerFactory.getLogger(AbstractTypes::class.java)!!
}
- @EdgeDBType
+ @GelType
abstract class Media {
var title: String? = null
}
- @EdgeDBType
+ @GelType
class Show : Media() {
var seasons: Long? = null
}
- @EdgeDBType
+ @GelType
class Movie : Media() {
var releaseYear: Long? = null
}
- override suspend fun runAsync(client: EdgeDBClient) {
- client.execute(
+ override suspend fun runAsync(clientPool: GelClientPool) {
+ clientPool.execute(
"""insert Movie {
title := "The Matrix",
release_year := 1999
@@ -37,7 +37,7 @@ class AbstractTypes : Example {
} unless conflict on .title"""
).await()
- val results = client.query(
+ val results = clientPool.query(
Media::class.java,
"""select Media {
title,
diff --git a/examples/kotlin-examples/src/main/kotlin/com/edgedb/examples/BasicQueries.kt b/examples/kotlin-examples/src/main/kotlin/com/gel/examples/BasicQueries.kt
similarity index 70%
rename from examples/kotlin-examples/src/main/kotlin/com/edgedb/examples/BasicQueries.kt
rename to examples/kotlin-examples/src/main/kotlin/com/gel/examples/BasicQueries.kt
index 54684b8b..0c06f77d 100644
--- a/examples/kotlin-examples/src/main/kotlin/com/edgedb/examples/BasicQueries.kt
+++ b/examples/kotlin-examples/src/main/kotlin/com/gel/examples/BasicQueries.kt
@@ -1,6 +1,6 @@
-package com.edgedb.examples
+package com.gel.examples
-import com.edgedb.driver.EdgeDBClient
+import com.gel.driver.GelClientPool
import kotlinx.coroutines.future.await
import org.slf4j.LoggerFactory
@@ -9,26 +9,26 @@ class BasicQueries : Example {
private val logger = LoggerFactory.getLogger(BasicQueries::class.java)!!
}
- override suspend fun runAsync(client: EdgeDBClient) {
+ override suspend fun runAsync(clientPool: GelClientPool) {
// the 'query' method enforces the cardinality of 'MANY', meaning zero OR X elements are
// returned. This translates to a collection of nullable results.
- val queryResult = client.query(String::class.java, "SELECT 'Hello, Kotlin!'").await()
+ val queryResult = clientPool.query(String::class.java, "SELECT 'Hello, Kotlin!'").await()
logger.info("'query' method result: {}", queryResult)
// 'querySingle' enforces the cardinality 'AT_MOST_ONE', meaning zero OR one element must
// be returned from the query. This translates to a nullable result
- val querySingleResult = client.querySingle(String::class.java, "SELECT 'Hello, Kotlin!'").await()
+ val querySingleResult = clientPool.querySingle(String::class.java, "SELECT 'Hello, Kotlin!'").await()
logger.info("'querySingle' method result: {}", querySingleResult)
// 'queryRequiredSingle' enforces the cardinality 'ONE', meaning one element must be returned.
// This translates to a non-null result.
- val queryRequiredSingleResult = client.queryRequiredSingle(
+ val queryRequiredSingleResult = clientPool.queryRequiredSingle(
String::class.java,
"SELECT 'Hello, Kotlin!'"
).await()
logger.info("'queryRequiredSingle' method result: {}", queryRequiredSingleResult)
// 'execute' disregards the result entirely.
- client.execute("SELECT 'Hello, Kotlin!'").await()
+ clientPool.execute("SELECT 'Hello, Kotlin!'").await()
}
}
\ No newline at end of file
diff --git a/examples/kotlin-examples/src/main/kotlin/com/edgedb/examples/CustomDeserializer.kt b/examples/kotlin-examples/src/main/kotlin/com/gel/examples/CustomDeserializer.kt
similarity index 64%
rename from examples/kotlin-examples/src/main/kotlin/com/edgedb/examples/CustomDeserializer.kt
rename to examples/kotlin-examples/src/main/kotlin/com/gel/examples/CustomDeserializer.kt
index 0f37e379..2c4fe9fb 100644
--- a/examples/kotlin-examples/src/main/kotlin/com/edgedb/examples/CustomDeserializer.kt
+++ b/examples/kotlin-examples/src/main/kotlin/com/gel/examples/CustomDeserializer.kt
@@ -1,9 +1,9 @@
-package com.edgedb.examples
+package com.gel.examples
-import com.edgedb.driver.EdgeDBClient
-import com.edgedb.driver.annotations.EdgeDBDeserializer
-import com.edgedb.driver.annotations.EdgeDBName
-import com.edgedb.driver.annotations.EdgeDBType
+import com.gel.driver.GelClientPool
+import com.gel.driver.annotations.GelDeserializer
+import com.gel.driver.annotations.GelName
+import com.gel.driver.annotations.GelType
import kotlinx.coroutines.future.await
import org.slf4j.LoggerFactory
@@ -12,13 +12,13 @@ class CustomDeserializer : Example {
private val logger = LoggerFactory.getLogger(CustomDeserializer::class.java)!!
}
- @EdgeDBType
+ @GelType
data class Person
- @EdgeDBDeserializer
+ @GelDeserializer
constructor (
- @EdgeDBName("name")
+ @GelName("name")
val name: String,
- @EdgeDBName("age")
+ @GelName("age")
val age: Long
) {
init {
@@ -26,8 +26,8 @@ class CustomDeserializer : Example {
}
}
- override suspend fun runAsync(client: EdgeDBClient) {
- val person = client.queryRequiredSingle(
+ override suspend fun runAsync(clientPool: GelClientPool) {
+ val person = clientPool.queryRequiredSingle(
Person::class.java,
"""
insert Person { name := 'Example', age := 123 } unless conflict on .name;
diff --git a/examples/kotlin-examples/src/main/kotlin/com/gel/examples/Example.kt b/examples/kotlin-examples/src/main/kotlin/com/gel/examples/Example.kt
new file mode 100644
index 00000000..3acc9c65
--- /dev/null
+++ b/examples/kotlin-examples/src/main/kotlin/com/gel/examples/Example.kt
@@ -0,0 +1,7 @@
+package com.gel.examples
+
+import com.gel.driver.GelClientPool
+
+interface Example {
+ suspend fun runAsync(clientPool: GelClientPool)
+}
\ No newline at end of file
diff --git a/examples/kotlin-examples/src/main/kotlin/com/edgedb/examples/GlobalsAndConfig.kt b/examples/kotlin-examples/src/main/kotlin/com/gel/examples/GlobalsAndConfig.kt
similarity index 82%
rename from examples/kotlin-examples/src/main/kotlin/com/edgedb/examples/GlobalsAndConfig.kt
rename to examples/kotlin-examples/src/main/kotlin/com/gel/examples/GlobalsAndConfig.kt
index 191ba4c6..1ed55198 100644
--- a/examples/kotlin-examples/src/main/kotlin/com/edgedb/examples/GlobalsAndConfig.kt
+++ b/examples/kotlin-examples/src/main/kotlin/com/gel/examples/GlobalsAndConfig.kt
@@ -1,6 +1,6 @@
-package com.edgedb.examples
+package com.gel.examples
-import com.edgedb.driver.EdgeDBClient
+import com.gel.driver.GelClientPool
import kotlinx.coroutines.future.await
import org.slf4j.LoggerFactory
import java.time.Duration
@@ -11,8 +11,8 @@ class GlobalsAndConfig : Example {
private val logger = LoggerFactory.getLogger(GlobalsAndConfig::class.java)!!
}
- override suspend fun runAsync(client: EdgeDBClient) {
- val configuredClient = client
+ override suspend fun runAsync(clientPool: GelClientPool) {
+ val configuredClient = clientPool
.withConfig { config -> config
.withIdleTransactionTimeout(Duration.ZERO)
.applyAccessPolicies(true)
diff --git a/examples/kotlin-examples/src/main/kotlin/com/edgedb/examples/LinkProperties.kt b/examples/kotlin-examples/src/main/kotlin/com/gel/examples/LinkProperties.kt
similarity index 82%
rename from examples/kotlin-examples/src/main/kotlin/com/edgedb/examples/LinkProperties.kt
rename to examples/kotlin-examples/src/main/kotlin/com/gel/examples/LinkProperties.kt
index 7916e7db..ca3fc923 100644
--- a/examples/kotlin-examples/src/main/kotlin/com/edgedb/examples/LinkProperties.kt
+++ b/examples/kotlin-examples/src/main/kotlin/com/gel/examples/LinkProperties.kt
@@ -1,8 +1,8 @@
-package com.edgedb.examples
+package com.gel.examples
-import com.edgedb.driver.EdgeDBClient
-import com.edgedb.driver.annotations.EdgeDBLinkType
-import com.edgedb.driver.annotations.EdgeDBType
+import com.gel.driver.GelClientPool
+import com.gel.driver.annotations.GelLinkType
+import com.gel.driver.annotations.GelType
import kotlinx.coroutines.future.await
import org.slf4j.LoggerFactory
@@ -27,20 +27,20 @@ class LinkProperties : Example {
"""
}
- @EdgeDBType
+ @GelType
class Person {
var name: String? = null
var age: Long? = null
var bestFriend: Person? = null
- @EdgeDBLinkType(Person::class)
+ @GelLinkType(Person::class)
var friends: Collection? = null
}
- override suspend fun runAsync(client: EdgeDBClient) {
- client.execute(INSERT_QUERY).await()
+ override suspend fun runAsync(clientPool: GelClientPool) {
+ clientPool.execute(INSERT_QUERY).await()
- val result = client.queryRequiredSingle(
+ val result = clientPool.queryRequiredSingle(
Person::class.java,
"""
select Person {
diff --git a/examples/kotlin-examples/src/main/kotlin/com/edgedb/examples/Main.kt b/examples/kotlin-examples/src/main/kotlin/com/gel/examples/Main.kt
similarity index 77%
rename from examples/kotlin-examples/src/main/kotlin/com/edgedb/examples/Main.kt
rename to examples/kotlin-examples/src/main/kotlin/com/gel/examples/Main.kt
index b5928bb8..1df1905f 100644
--- a/examples/kotlin-examples/src/main/kotlin/com/edgedb/examples/Main.kt
+++ b/examples/kotlin-examples/src/main/kotlin/com/gel/examples/Main.kt
@@ -1,9 +1,9 @@
-package com.edgedb.examples
+package com.gel.examples
-import com.edgedb.driver.EdgeDBClient
-import com.edgedb.driver.EdgeDBClientConfig
-import com.edgedb.driver.EdgeDBConnection
-import com.edgedb.driver.namingstrategies.NamingStrategy
+import com.gel.driver.GelClientPool
+import com.gel.driver.GelClientConfig
+import com.gel.driver.GelConnection
+import com.gel.driver.namingstrategies.NamingStrategy
import kotlinx.coroutines.runBlocking
import org.slf4j.LoggerFactory
import kotlin.system.exitProcess
@@ -13,7 +13,7 @@ object Main {
@JvmStatic
fun main(args: Array) {
- val client = EdgeDBClient(EdgeDBClientConfig.builder()
+ val clientPool = GelClientPool(GelClientConfig.builder()
.withNamingStrategy(NamingStrategy.snakeCase())
.useFieldSetters(true)
.build()
@@ -32,7 +32,7 @@ object Main {
for (example in examples) {
logger.info("Running Kotlin example {}...", example)
try {
- example.runAsync(client)
+ example.runAsync(clientPool)
logger.info("Kotlin example {} complete!", example)
} catch (x: Exception) {
logger.error("Failed to run Kotlin example {}", example, x)
diff --git a/examples/kotlin-examples/src/main/kotlin/com/edgedb/examples/Transactions.kt b/examples/kotlin-examples/src/main/kotlin/com/gel/examples/Transactions.kt
similarity index 65%
rename from examples/kotlin-examples/src/main/kotlin/com/edgedb/examples/Transactions.kt
rename to examples/kotlin-examples/src/main/kotlin/com/gel/examples/Transactions.kt
index 93269e53..fe1c72fa 100644
--- a/examples/kotlin-examples/src/main/kotlin/com/edgedb/examples/Transactions.kt
+++ b/examples/kotlin-examples/src/main/kotlin/com/gel/examples/Transactions.kt
@@ -1,6 +1,6 @@
-package com.edgedb.examples
+package com.gel.examples
-import com.edgedb.driver.EdgeDBClient
+import com.gel.driver.GelClientPool
import kotlinx.coroutines.future.await
import org.slf4j.LoggerFactory
@@ -9,14 +9,14 @@ class Transactions : Example {
private val logger = LoggerFactory.getLogger(Transactions::class.java)
}
- override suspend fun runAsync(client: EdgeDBClient) {
+ override suspend fun runAsync(clientPool: GelClientPool) {
// verify we can run transactions
- if (!client.supportsTransactions()) {
- logger.info("Skipping transactions, client type {} doesn't support it", client.clientType)
+ if (!clientPool.supportsTransactions()) {
+ logger.info("Skipping transactions, client type {} doesn't support it", clientPool.clientType)
return
}
- val transactionResult = client.transaction { tx ->
+ val transactionResult = clientPool.transaction { tx ->
tx.queryRequiredSingle(String::class.java, "SELECT 'Hello from transaction!'")
}.await()
diff --git a/examples/scala-examples/build.sbt b/examples/scala-examples/build.sbt
index e479eee0..42ac18ec 100644
--- a/examples/scala-examples/build.sbt
+++ b/examples/scala-examples/build.sbt
@@ -3,7 +3,7 @@ ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / scalaVersion := "3.1.3"
libraryDependencies ++= Seq(
- "com.edgedb" % "driver" % "0.3.0" from "file:///" + System.getProperty("user.dir") + "/lib/com.edgedb.driver-0.3.0.jar",
+ "com.gel" % "driver" % "0.3.0" from "file:///" + System.getProperty("user.dir") + "/lib/com.gel.driver-0.3.0.jar",
"ch.qos.logback" % "logback-classic" % "1.4.7",
"ch.qos.logback" % "logback-core" % "1.4.7",
"com.fasterxml.jackson.core" % "jackson-databind" % "2.15.1",
@@ -15,5 +15,5 @@ libraryDependencies ++= Seq(
lazy val root = (project in file("."))
.settings(
name := "scala-examples",
- idePackagePrefix := Some("com.edgedb.examples")
+ idePackagePrefix := Some("com.gel.examples")
)
diff --git a/examples/scala-examples/src/main/scala/AbstractTypes.scala b/examples/scala-examples/src/main/scala/AbstractTypes.scala
index 10974e53..18da0e5e 100644
--- a/examples/scala-examples/src/main/scala/AbstractTypes.scala
+++ b/examples/scala-examples/src/main/scala/AbstractTypes.scala
@@ -1,22 +1,22 @@
-package com.edgedb.examples
+package com.gel.examples
-import com.edgedb.driver.EdgeDBClient
-import com.edgedb.driver.annotations.EdgeDBType
+import com.gel.driver.GelClientPool
+import com.gel.driver.annotations.GelType
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import scala.concurrent.{Await, ExecutionContext, Future}
object AbstractTypes:
- @EdgeDBType
+ @GelType
abstract class Media:
var title: String = _
- @EdgeDBType
+ @GelType
class Movie extends Media:
var releaseYear: Long = _
- @EdgeDBType
+ @GelType
class Show extends Media:
var seasons: Long = _
@@ -26,7 +26,7 @@ class AbstractTypes extends Example:
import scala.jdk.FutureConverters._
import AbstractTypes._
- override def run(client: EdgeDBClient)(implicit context: ExecutionContext): Future[Unit] = {
+ override def run(clientPool: GelClientPool)(implicit context: ExecutionContext): Future[Unit] = {
for {
result <- client.query(
classOf[Media],
diff --git a/examples/scala-examples/src/main/scala/BasicQueryFunctions.scala b/examples/scala-examples/src/main/scala/BasicQueryFunctions.scala
index 52ba9953..ba43c594 100644
--- a/examples/scala-examples/src/main/scala/BasicQueryFunctions.scala
+++ b/examples/scala-examples/src/main/scala/BasicQueryFunctions.scala
@@ -1,5 +1,5 @@
-package com.edgedb.examples
-import com.edgedb.driver.EdgeDBClient
+package com.gel.examples
+import com.gel.driver.GelClientPool
import org.slf4j.LoggerFactory
import scala.concurrent.{ExecutionContext, Future}
@@ -7,7 +7,7 @@ import scala.jdk.FutureConverters.*
class BasicQueryFunctions extends Example:
private val logger = LoggerFactory.getLogger(classOf[BasicQueryFunctions])
- override def run(client: EdgeDBClient)(implicit context: ExecutionContext): Future[Unit] = {
+ override def run(clientPool: GelClientPool)(implicit context: ExecutionContext): Future[Unit] = {
for {
queryResult <- client.query(classOf[String], "SELECT 'Hello, Scala!'").asScala
querySingleResult <- client.querySingle(classOf[String], "SELECT 'Hello, Scala!'").asScala
diff --git a/examples/scala-examples/src/main/scala/CustomDeserializer.scala b/examples/scala-examples/src/main/scala/CustomDeserializer.scala
index 644b6fc6..ebd0797c 100644
--- a/examples/scala-examples/src/main/scala/CustomDeserializer.scala
+++ b/examples/scala-examples/src/main/scala/CustomDeserializer.scala
@@ -1,6 +1,6 @@
-package com.edgedb.examples
-import com.edgedb.driver.EdgeDBClient
-import com.edgedb.driver.annotations.{EdgeDBDeserializer, EdgeDBName, EdgeDBType}
+package com.gel.examples
+import com.gel.driver.GelClientPool
+import com.gel.driver.annotations.{GelDeserializer, GelName, GelType}
import org.slf4j.LoggerFactory
import scala.concurrent.{ExecutionContext, Future}
@@ -9,12 +9,12 @@ import scala.jdk.FutureConverters.*
object CustomDeserializer:
private val logger = LoggerFactory.getLogger(classOf[CustomDeserializer])
- @EdgeDBType
- class Person @EdgeDBDeserializer()
+ @GelType
+ class Person @GelDeserializer()
(
- @EdgeDBName("name")
+ @GelName("name")
val name: String,
- @EdgeDBName("age")
+ @GelName("age")
val age: Long
) {
logger.info("Custom deserializer called")
@@ -23,7 +23,7 @@ object CustomDeserializer:
class CustomDeserializer extends Example:
import CustomDeserializer._
- override def run(client: EdgeDBClient)(implicit context: ExecutionContext): Future[Unit] = {
+ override def run(clientPool: GelClientPool)(implicit context: ExecutionContext): Future[Unit] = {
for(
result <- client.queryRequiredSingle(
classOf[Person],
diff --git a/examples/scala-examples/src/main/scala/Example.scala b/examples/scala-examples/src/main/scala/Example.scala
index 77d8cd46..fc2e721e 100644
--- a/examples/scala-examples/src/main/scala/Example.scala
+++ b/examples/scala-examples/src/main/scala/Example.scala
@@ -1,8 +1,8 @@
-package com.edgedb.examples
+package com.gel.examples
import scala.concurrent.{ExecutionContext, Future}
-import com.edgedb.driver.EdgeDBClient
+import com.gel.driver.GelClientPool
trait Example {
- def run(client: EdgeDBClient)(implicit context: ExecutionContext): Future[Unit];
+ def run(clientPool: GelClientPool)(implicit context: ExecutionContext): Future[Unit];
}
\ No newline at end of file
diff --git a/examples/scala-examples/src/main/scala/GlobalsAndConfig.scala b/examples/scala-examples/src/main/scala/GlobalsAndConfig.scala
index 5ccd16e7..ca71d009 100644
--- a/examples/scala-examples/src/main/scala/GlobalsAndConfig.scala
+++ b/examples/scala-examples/src/main/scala/GlobalsAndConfig.scala
@@ -1,8 +1,8 @@
-package com.edgedb.examples
+package com.gel.examples
-import com.edgedb.driver.EdgeDBClient
+import com.gel.driver.GelClientPool
import io.netty.util.internal.shaded.org.jctools.queues.MessagePassingQueue.Consumer
-import com.edgedb.driver.state.Config
+import com.gel.driver.state.Config
import org.slf4j.LoggerFactory
import java.time.Duration
@@ -14,7 +14,7 @@ import scala.jdk.FutureConverters.*
class GlobalsAndConfig extends Example:
private val logger = LoggerFactory.getLogger(classOf[GlobalsAndConfig])
- override def run(client: EdgeDBClient)(implicit context: ExecutionContext): Future[Unit] = {
+ override def run(clientPool: GelClientPool)(implicit context: ExecutionContext): Future[Unit] = {
val configuredClient = client.withConfig(Config.builder()
.withQueryExecutionTimeout(Duration.ZERO)
.applyAccessPolicies(true)
diff --git a/examples/scala-examples/src/main/scala/LinkProperties.scala b/examples/scala-examples/src/main/scala/LinkProperties.scala
index 1931a951..c10e2a08 100644
--- a/examples/scala-examples/src/main/scala/LinkProperties.scala
+++ b/examples/scala-examples/src/main/scala/LinkProperties.scala
@@ -1,6 +1,6 @@
-package com.edgedb.examples
-import com.edgedb.driver.EdgeDBClient
-import com.edgedb.driver.annotations.{EdgeDBLinkType, EdgeDBType}
+package com.gel.examples
+import com.gel.driver.GelClientPool
+import com.gel.driver.annotations.{GelLinkType, GelType}
import org.slf4j.LoggerFactory
import java.util
@@ -8,20 +8,20 @@ import scala.concurrent.{ExecutionContext, Future}
import scala.jdk.FutureConverters.*
object LinkProperties:
- @EdgeDBType
+ @GelType
class Person:
var name: String = _
var age: Long = _
var bestFriend: Person = _
- @EdgeDBLinkType(classOf[Person])
+ @GelLinkType(classOf[Person])
var friends: util.Collection[Person] = _
class LinkProperties extends Example:
private val logger = LoggerFactory.getLogger(classOf[LinkProperties])
import LinkProperties.Person
- override def run(client: EdgeDBClient)(implicit context: ExecutionContext): Future[Unit] = {
+ override def run(clientPool: GelClientPool)(implicit context: ExecutionContext): Future[Unit] = {
for(
result <- client.queryRequiredSingle(
classOf[Person],
diff --git a/examples/scala-examples/src/main/scala/Main.scala b/examples/scala-examples/src/main/scala/Main.scala
index 4a4e8b5d..375c7253 100644
--- a/examples/scala-examples/src/main/scala/Main.scala
+++ b/examples/scala-examples/src/main/scala/Main.scala
@@ -1,7 +1,7 @@
-package com.edgedb.examples
+package com.gel.examples
-import com.edgedb.driver.namingstrategies.NamingStrategy
-import com.edgedb.driver.{EdgeDBClient, EdgeDBClientConfig, Transaction}
+import com.gel.driver.namingstrategies.NamingStrategy
+import com.gel.driver.{GelClientPool, GelClientConfig, Transaction}
import org.slf4j.{Logger, LoggerFactory}
import scala.concurrent.duration.Duration
@@ -13,7 +13,7 @@ import ExecutionContext.Implicits.global
def main(): Unit = {
val logger = LoggerFactory.getLogger("Main")
- val client = new EdgeDBClient(EdgeDBClientConfig.builder
+ val clientPool = new GelClientPool(GelClientConfig.builder
.withNamingStrategy(NamingStrategy.snakeCase)
.useFieldSetters(true)
.build
@@ -29,14 +29,14 @@ def main(): Unit = {
)
for (example <- examples)
- Await.ready(runExample(logger, client, example), Duration.Inf)
+ Await.ready(runExample(logger, clientPool, example), Duration.Inf)
logger.info("Examples complete!")
System.exit(0)
}
-private def runExample(logger: Logger, client: EdgeDBClient, example: Example)(implicit context: ExecutionContext): Future[Unit] = {
+private def runExample(logger: Logger, clientPool: GelClientPool, example: Example)(implicit context: ExecutionContext): Future[Unit] = {
logger.info("Running Scala example {}...", example)
example.run(client)
.map({ * =>
diff --git a/examples/scala-examples/src/main/scala/Transactions.scala b/examples/scala-examples/src/main/scala/Transactions.scala
index d6d9f20f..d772185a 100644
--- a/examples/scala-examples/src/main/scala/Transactions.scala
+++ b/examples/scala-examples/src/main/scala/Transactions.scala
@@ -1,5 +1,5 @@
-package com.edgedb.examples
-import com.edgedb.driver.{EdgeDBClient, Transaction}
+package com.gel.examples
+import com.gel.driver.{GelClientPool, Transaction}
import org.slf4j.LoggerFactory
import scala.jdk.FutureConverters.*
@@ -7,7 +7,7 @@ import scala.concurrent.{ExecutionContext, Future}
class Transactions extends Example {
private val logger = LoggerFactory.getLogger(classOf[Transactions])
- override def run(client: EdgeDBClient)(implicit context: ExecutionContext): Future[Unit] = {
+ override def run(clientPool: GelClientPool)(implicit context: ExecutionContext): Future[Unit] = {
// verify we can run transactions
if (!client.supportsTransactions()) {
logger.info("Skipping transactions, client type {} doesn't support it", client.getClientType)
diff --git a/settings.gradle b/settings.gradle
index 51504b4d..56827533 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,4 +1,4 @@
-rootProject.name = 'edgedb-java'
+rootProject.name = 'gel-java'
include 'src:driver'
include 'tools'
include 'tools:testgen'
diff --git a/src/driver/build.gradle b/src/driver/build.gradle
index 754e4a50..fd6dc9ee 100644
--- a/src/driver/build.gradle
+++ b/src/driver/build.gradle
@@ -29,13 +29,13 @@ jar {
manifest {
attributes 'Implementation-Title': archivesBaseName,
'Implementation-Version': archiveVersion,
- 'Automatic-Module-Name': 'com.edgedb.driver'
+ 'Automatic-Module-Name': 'com.gel.driver'
}
}
def deleteOldJar = tasks.register('deleteOldJarInBin') {
var path = Paths.get(project.rootDir.toString(), 'examples', 'scala-examples', 'lib')
- var paths = path.toFile().listFiles((FileFilter) { File f -> f.name.startsWith('com.edgedb.driver') })
+ var paths = path.toFile().listFiles((FileFilter) { File f -> f.name.startsWith('com.gel.driver') })
delete files(paths)
}
@@ -67,16 +67,16 @@ publishing {
}
pom {
- name = 'EdgeDB Java'
- description = 'A JVM-based binding for the EdgeDB database'
- url = 'https://github.com/edgedb/edgedb-java'
+ name = 'Gel Java'
+ description = 'A JVM-based binding for Gel'
+ url = 'https://github.com.gel/edgedb-java'
organization {
- name = 'EdgeDB'
+ name = 'Gel'
url = 'https://edgedb.com'
}
issueManagement {
system = 'GitHub'
- url = 'https://github.com/edgedb/edgedb-java/issues'
+ url = 'https://github.com.gel/edgedb-java/issues'
}
licenses {
license {
@@ -86,13 +86,13 @@ publishing {
}
}
scm {
- url = 'https://github.com/edgedb/edgedb-java'
- connection = 'scm:git:git://github.com/edgedb/edgedb-java.git'
- developerConnection = 'scm:git:ssh://git@github.com:edgedb/edgedb-java.git'
+ url = 'https://github.com.gel/edgedb-java'
+ connection = 'scm:git:git://github.com.gel/edgedb-java.git'
+ developerConnection = 'scm:git:ssh://git@github.com.gel/edgedb-java.git'
}
developers {
developer {
- name = 'MagicStack Inc. and the EdgeDB authors'
+ name = 'MagicStack Inc. and the Gel authors'
}
}
}
diff --git a/src/driver/src/main/java/com/edgedb/driver/abstractions/ClientQueryDelegate.java b/src/driver/src/main/java/com/edgedb/driver/abstractions/ClientQueryDelegate.java
deleted file mode 100644
index 2f3b4370..00000000
--- a/src/driver/src/main/java/com/edgedb/driver/abstractions/ClientQueryDelegate.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.edgedb.driver.abstractions;
-
-import com.edgedb.driver.Capabilities;
-import com.edgedb.driver.EdgeDBQueryable;
-
-import java.util.EnumSet;
-import java.util.Map;
-import java.util.concurrent.CompletionStage;
-
-@FunctionalInterface
-public interface ClientQueryDelegate {
- CompletionStage run(EdgeDBQueryable client, Class cls, String query, Map args, EnumSet capabilities);
-}
diff --git a/src/driver/src/main/java/com/edgedb/driver/binary/codecs/CodecContext.java b/src/driver/src/main/java/com/edgedb/driver/binary/codecs/CodecContext.java
deleted file mode 100644
index 02624a54..00000000
--- a/src/driver/src/main/java/com/edgedb/driver/binary/codecs/CodecContext.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.edgedb.driver.binary.codecs;
-
-import com.edgedb.driver.binary.codecs.visitors.TypeVisitor;
-import com.edgedb.driver.clients.EdgeDBBinaryClient;
-import org.jetbrains.annotations.NotNull;
-
-public final class CodecContext {
- public final EdgeDBBinaryClient client;
-
- public CodecContext(EdgeDBBinaryClient client) {
- this.client = client;
- }
-
- public @NotNull TypeVisitor getTypeVisitor() {
- return new TypeVisitor(this.client);
- }
-}
diff --git a/src/driver/src/main/java/com/edgedb/driver/binary/codecs/scalars/ScalarCodec.java b/src/driver/src/main/java/com/edgedb/driver/binary/codecs/scalars/ScalarCodec.java
deleted file mode 100644
index 6df4ec77..00000000
--- a/src/driver/src/main/java/com/edgedb/driver/binary/codecs/scalars/ScalarCodec.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.edgedb.driver.binary.codecs.scalars;
-
-import com.edgedb.driver.binary.codecs.Codec;
-
-public interface ScalarCodec extends Codec {
-}
diff --git a/src/driver/src/main/java/com/edgedb/driver/binary/codecs/visitors/CodecVisitor.java b/src/driver/src/main/java/com/edgedb/driver/binary/codecs/visitors/CodecVisitor.java
deleted file mode 100644
index 1978786c..00000000
--- a/src/driver/src/main/java/com/edgedb/driver/binary/codecs/visitors/CodecVisitor.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.edgedb.driver.binary.codecs.visitors;
-
-import com.edgedb.driver.binary.codecs.Codec;
-import com.edgedb.driver.exceptions.EdgeDBException;
-
-@FunctionalInterface
-public interface CodecVisitor {
- Codec> visit(Codec> codec) throws EdgeDBException;
-}
diff --git a/src/driver/src/main/java/com/edgedb/driver/clients/EdgeDBTCPClient.java b/src/driver/src/main/java/com/edgedb/driver/clients/EdgeDBTCPClient.java
deleted file mode 100644
index a2474885..00000000
--- a/src/driver/src/main/java/com/edgedb/driver/clients/EdgeDBTCPClient.java
+++ /dev/null
@@ -1,161 +0,0 @@
-package com.edgedb.driver.clients;
-
-import com.edgedb.driver.*;
-import com.edgedb.driver.async.ChannelCompletableFuture;
-import com.edgedb.driver.binary.PacketSerializer;
-import com.edgedb.driver.binary.duplexers.ChannelDuplexer;
-import com.edgedb.driver.exceptions.ConnectionFailedTemporarilyException;
-import com.edgedb.driver.util.SslUtils;
-import io.netty.bootstrap.Bootstrap;
-import io.netty.buffer.PooledByteBufAllocator;
-import io.netty.channel.ChannelInitializer;
-import io.netty.channel.ChannelOption;
-import io.netty.channel.nio.NioEventLoopGroup;
-import io.netty.channel.socket.SocketChannel;
-import io.netty.channel.socket.nio.NioSocketChannel;
-import io.netty.handler.ssl.ApplicationProtocolConfig;
-import io.netty.handler.ssl.SslContextBuilder;
-import io.netty.util.concurrent.DefaultEventExecutorGroup;
-import io.netty.util.concurrent.EventExecutorGroup;
-import org.jetbrains.annotations.NotNull;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.net.ConnectException;
-import java.util.EnumSet;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.CompletionException;
-import java.util.concurrent.CompletionStage;
-
-import static com.edgedb.driver.util.ComposableUtil.exceptionallyCompose;
-
-public class EdgeDBTCPClient extends EdgeDBBinaryClient implements TransactableClient {
- private static final Logger logger = LoggerFactory.getLogger(EdgeDBTCPClient.class);
- private static final NioEventLoopGroup NETTY_TCP_GROUP = new NioEventLoopGroup();
- private static final EventExecutorGroup DUPLEXER_GROUP = new DefaultEventExecutorGroup(8);
-
- private final @NotNull ChannelDuplexer duplexer;
- private final Bootstrap bootstrap;
- private TransactionState transactionState;
-
- public EdgeDBTCPClient(EdgeDBConnection connection, EdgeDBClientConfig config, AutoCloseable poolHandle) {
- super(connection, config, poolHandle);
- this.duplexer = new ChannelDuplexer(this);
-
- this.bootstrap = new Bootstrap()
- .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT)
- .group(NETTY_TCP_GROUP)
- .channel(NioSocketChannel.class)
- .handler(new ChannelInitializer() {
- @Override
- protected void initChannel(@NotNull SocketChannel ch) throws Exception {
- var pipeline = ch.pipeline();
-
- var builder = SslContextBuilder.forClient()
- .protocols("TLSv1.3")
- .applicationProtocolConfig(new ApplicationProtocolConfig(
- ApplicationProtocolConfig.Protocol.ALPN,
- ApplicationProtocolConfig.SelectorFailureBehavior.CHOOSE_MY_LAST_PROTOCOL,
- ApplicationProtocolConfig.SelectedListenerFailureBehavior.ACCEPT,
- "edgedb-binary"
- ));
-
- SslUtils.applyTrustManager(getConnectionArguments(), builder);
-
- pipeline.addLast(
- "ssl",
- builder.build().newHandler(
- ch.alloc(),
- getConnectionArguments().getHostname(), // SNI
- getConnectionArguments().getPort() // SNI
- )
- );
-
- // edgedb-binary protocol and duplexer
- pipeline.addLast(
- PacketSerializer.createDecoder(EdgeDBTCPClient.this),
- PacketSerializer.createEncoder()
- );
-
- pipeline.addLast(DUPLEXER_GROUP, duplexer.channelHandler);
-
- duplexer.init(ch);
- }
- });
- }
-
- @Override
- public @NotNull ChannelDuplexer getDuplexer() {
- return this.duplexer;
- }
-
- @Override
- public void setTransactionState(TransactionState state) {
- this.transactionState = state;
- }
-
- @Override
- protected CompletionStage openConnection() {
- final var connection = getConnectionArguments();
-
- try {
- logger.debug("Opening connection from bootstrap");
- return exceptionallyCompose(
- ChannelCompletableFuture.completeFrom(
- bootstrap.connect(
- connection.getHostname(),
- connection.getPort()
- )
- ), e -> {
- logger.debug("Connection failed", e);
-
- if(e instanceof CompletionException && e.getCause() instanceof ConnectException) {
- return CompletableFuture.failedFuture(new ConnectionFailedTemporarilyException(e));
- }
-
- return CompletableFuture.failedFuture(e);
- })
- .orTimeout(
- getConnectionArguments().getWaitUntilAvailable().value,
- getConnectionArguments().getWaitUntilAvailable().unit
- );
- }
- catch (Exception err) {
- logger.error("Failed to open connection", err);
- return CompletableFuture.failedFuture(err);
- }
- }
-
- @Override
- protected CompletionStage closeConnection() {
- return this.duplexer.disconnect();
- }
-
- @Override
- public TransactionState getTransactionState() {
- return this.transactionState;
- }
-
- @Override
- public CompletionStage startTransaction(@NotNull TransactionIsolation isolation, boolean readonly, boolean deferrable) {
- String query = "start transaction isolation " +
- isolation +
- ", " +
- (readonly ? "read only" : "read write") +
- ", " +
- (deferrable ? "" : "not ") +
- "deferrable";
-
- return execute(query, EnumSet.of(Capabilities.TRANSACTION));
- }
-
- @Override
- public CompletionStage commit() {
- return execute("commit", EnumSet.of(Capabilities.TRANSACTION));
- }
-
- @Override
- public CompletionStage rollback() {
- return execute("rollback", EnumSet.of(Capabilities.TRANSACTION));
- }
-}
diff --git a/src/driver/src/main/java/com/edgedb/driver/Capabilities.java b/src/driver/src/main/java/com/gel/driver/Capabilities.java
similarity index 87%
rename from src/driver/src/main/java/com/edgedb/driver/Capabilities.java
rename to src/driver/src/main/java/com/gel/driver/Capabilities.java
index ef932980..a6e5ff83 100644
--- a/src/driver/src/main/java/com/edgedb/driver/Capabilities.java
+++ b/src/driver/src/main/java/com/gel/driver/Capabilities.java
@@ -1,6 +1,6 @@
-package com.edgedb.driver;
+package com.gel.driver;
-import com.edgedb.driver.binary.BinaryEnum;
+import com.gel.driver.binary.BinaryEnum;
import org.jetbrains.annotations.NotNull;
public enum Capabilities implements BinaryEnum {
diff --git a/src/driver/src/main/java/com/edgedb/driver/ClientType.java b/src/driver/src/main/java/com/gel/driver/ClientType.java
similarity index 52%
rename from src/driver/src/main/java/com/edgedb/driver/ClientType.java
rename to src/driver/src/main/java/com/gel/driver/ClientType.java
index ef405889..6e03e16e 100644
--- a/src/driver/src/main/java/com/edgedb/driver/ClientType.java
+++ b/src/driver/src/main/java/com/gel/driver/ClientType.java
@@ -1,16 +1,16 @@
-package com.edgedb.driver;
+package com.gel.driver;
/**
* An enum specifying the client type to use within a client pool.
*/
public enum ClientType {
/**
- * A TCP client using the EdgeDB Binary protocol.
+ * A TCP client using the Gel Binary protocol.
*/
TCP,
/**
- * An HTTP client using the EdgeDB Binary protocol.
+ * An HTTP client using the Gel Binary protocol.
*/
HTTP
}
diff --git a/src/driver/src/main/java/com/edgedb/driver/ConnectionRetryMode.java b/src/driver/src/main/java/com/gel/driver/ConnectionRetryMode.java
similarity index 84%
rename from src/driver/src/main/java/com/edgedb/driver/ConnectionRetryMode.java
rename to src/driver/src/main/java/com/gel/driver/ConnectionRetryMode.java
index aa4d5bd4..1ab69359 100644
--- a/src/driver/src/main/java/com/edgedb/driver/ConnectionRetryMode.java
+++ b/src/driver/src/main/java/com/gel/driver/ConnectionRetryMode.java
@@ -1,7 +1,7 @@
-package com.edgedb.driver;
+package com.gel.driver;
/**
- * An enum that specifies retry behavior for retryable errors when connecting to EdgeDB.
+ * An enum that specifies retry behavior for retryable errors when connecting to Gel.
*/
public enum ConnectionRetryMode {
/**
diff --git a/src/driver/src/main/java/com/edgedb/driver/ErrorCode.java b/src/driver/src/main/java/com/gel/driver/ErrorCode.java
similarity index 96%
rename from src/driver/src/main/java/com/edgedb/driver/ErrorCode.java
rename to src/driver/src/main/java/com/gel/driver/ErrorCode.java
index d6fb98dd..b424a342 100644
--- a/src/driver/src/main/java/com/edgedb/driver/ErrorCode.java
+++ b/src/driver/src/main/java/com/gel/driver/ErrorCode.java
@@ -1,11 +1,11 @@
-package com.edgedb.driver;
+package com.gel.driver;
-import com.edgedb.driver.binary.BinaryEnum;
+import com.gel.driver.binary.BinaryEnum;
import org.jetbrains.annotations.NotNull;
/**
- * Represents different possible error codes returned by EdgeDB.
- * @see com.edgedb.driver.exceptions.EdgeDBErrorException
+ * Represents different possible error codes returned by Gel.
+ * @see com.gel.driver.exceptions.GelErrorException
*/
public enum ErrorCode implements BinaryEnum {
INTERNAL_SERVER_ERROR (0x01_00_00_00),
diff --git a/src/driver/src/main/java/com/edgedb/driver/ErrorSeverity.java b/src/driver/src/main/java/com/gel/driver/ErrorSeverity.java
similarity index 64%
rename from src/driver/src/main/java/com/edgedb/driver/ErrorSeverity.java
rename to src/driver/src/main/java/com/gel/driver/ErrorSeverity.java
index 35d8e790..6db40615 100644
--- a/src/driver/src/main/java/com/edgedb/driver/ErrorSeverity.java
+++ b/src/driver/src/main/java/com/gel/driver/ErrorSeverity.java
@@ -1,11 +1,11 @@
-package com.edgedb.driver;
+package com.gel.driver;
-import com.edgedb.driver.binary.BinaryEnum;
+import com.gel.driver.binary.BinaryEnum;
import org.jetbrains.annotations.NotNull;
/**
- * Represents the error severity for an error returned by EdgeDB
- * @see com.edgedb.driver.exceptions.EdgeDBErrorException
+ * Represents the error severity for an error returned by Gel
+ * @see com.gel.driver.exceptions.GelErrorException
*/
public enum ErrorSeverity implements BinaryEnum {
ERROR (0x78),
diff --git a/src/driver/src/main/java/com/edgedb/driver/EdgeDBClientConfig.java b/src/driver/src/main/java/com/gel/driver/GelClientConfig.java
similarity index 87%
rename from src/driver/src/main/java/com/edgedb/driver/EdgeDBClientConfig.java
rename to src/driver/src/main/java/com/gel/driver/GelClientConfig.java
index 6a4b13c8..e8ead96f 100644
--- a/src/driver/src/main/java/com/edgedb/driver/EdgeDBClientConfig.java
+++ b/src/driver/src/main/java/com/gel/driver/GelClientConfig.java
@@ -1,14 +1,14 @@
-package com.edgedb.driver;
+package com.gel.driver;
-import com.edgedb.driver.namingstrategies.NamingStrategy;
+import com.gel.driver.namingstrategies.NamingStrategy;
import org.jetbrains.annotations.NotNull;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import java.util.concurrent.TimeUnit;
-public class EdgeDBClientConfig {
- public static final @NotNull EdgeDBClientConfig DEFAULT = new EdgeDBClientConfig();
+public class GelClientConfig {
+ public static final @NotNull GelClientConfig DEFAULT = new GelClientConfig();
public static @NotNull Builder builder() {
return new Builder();
}
@@ -145,7 +145,7 @@ public boolean getImplicitTypeIds() {
}
/**
- * A builder class used to construct {@linkplain EdgeDBClientConfig}s.
+ * A builder class used to construct {@linkplain GelClientConfig}s.
*/
public static final class Builder {
private int poolSize = DEFAULT.poolSize;
@@ -304,25 +304,25 @@ public static final class Builder {
}
/**
- * Constructs a {@linkplain EdgeDBClientConfig} from the current builder.
- * @return A {@linkplain EdgeDBClientConfig} that represents the current builder.
+ * Constructs a {@linkplain GelClientConfig} from the current builder.
+ * @return A {@linkplain GelClientConfig} that represents the current builder.
*/
- public @NotNull EdgeDBClientConfig build() {
- EdgeDBClientConfig edgeDBClientConfig = new EdgeDBClientConfig();
- edgeDBClientConfig.clientType = this.clientType;
- edgeDBClientConfig.implicitLimit = this.implicitLimit;
- edgeDBClientConfig.explicitObjectIds = this.explicitObjectIds;
- edgeDBClientConfig.messageTimeoutUnit = this.messageTimeoutUnit;
- edgeDBClientConfig.maxConnectionRetries = this.maxConnectionRetries;
- edgeDBClientConfig.clientMaxAge = this.clientMaxAge;
- edgeDBClientConfig.poolSize = this.poolSize;
- edgeDBClientConfig.useFieldSetters = this.useFieldSetters;
- edgeDBClientConfig.namingStrategy = this.namingStrategy;
- edgeDBClientConfig.clientAvailability = this.clientAvailability;
- edgeDBClientConfig.implicitTypeIds = this.implicitTypeIds;
- edgeDBClientConfig.retryMode = this.retryMode;
- edgeDBClientConfig.messageTimeout = this.messageTimeout;
- return edgeDBClientConfig;
+ public @NotNull GelClientConfig build() {
+ GelClientConfig gelClientConfig = new GelClientConfig();
+ gelClientConfig.clientType = this.clientType;
+ gelClientConfig.implicitLimit = this.implicitLimit;
+ gelClientConfig.explicitObjectIds = this.explicitObjectIds;
+ gelClientConfig.messageTimeoutUnit = this.messageTimeoutUnit;
+ gelClientConfig.maxConnectionRetries = this.maxConnectionRetries;
+ gelClientConfig.clientMaxAge = this.clientMaxAge;
+ gelClientConfig.poolSize = this.poolSize;
+ gelClientConfig.useFieldSetters = this.useFieldSetters;
+ gelClientConfig.namingStrategy = this.namingStrategy;
+ gelClientConfig.clientAvailability = this.clientAvailability;
+ gelClientConfig.implicitTypeIds = this.implicitTypeIds;
+ gelClientConfig.retryMode = this.retryMode;
+ gelClientConfig.messageTimeout = this.messageTimeout;
+ return gelClientConfig;
}
}
}
diff --git a/src/driver/src/main/java/com/edgedb/driver/EdgeDBClient.java b/src/driver/src/main/java/com/gel/driver/GelClientPool.java
similarity index 79%
rename from src/driver/src/main/java/com/edgedb/driver/EdgeDBClient.java
rename to src/driver/src/main/java/com/gel/driver/GelClientPool.java
index 4f26c9cd..bbf1cd7a 100644
--- a/src/driver/src/main/java/com/edgedb/driver/EdgeDBClient.java
+++ b/src/driver/src/main/java/com/gel/driver/GelClientPool.java
@@ -1,13 +1,13 @@
-package com.edgedb.driver;
-
-import com.edgedb.driver.abstractions.ClientQueryDelegate;
-import com.edgedb.driver.clients.*;
-import com.edgedb.driver.datatypes.Json;
-import com.edgedb.driver.exceptions.ConfigurationException;
-import com.edgedb.driver.exceptions.EdgeDBException;
-import com.edgedb.driver.state.Config;
-import com.edgedb.driver.state.Session;
-import com.edgedb.driver.util.ClientPoolHolder;
+package com.gel.driver;
+
+import com.gel.driver.abstractions.ClientQueryDelegate;
+import com.gel.driver.clients.*;
+import com.gel.driver.datatypes.Json;
+import com.gel.driver.exceptions.ConfigurationException;
+import com.gel.driver.exceptions.GelException;
+import com.gel.driver.state.Config;
+import com.gel.driver.state.Session;
+import com.gel.driver.util.ClientPoolHolder;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
@@ -28,19 +28,19 @@
import java.util.function.Consumer;
import java.util.function.Function;
-import static com.edgedb.driver.util.ComposableUtil.composeWith;
+import static com.gel.driver.util.ComposableUtil.composeWith;
/**
- * Represents a client pool used to interact with EdgeDB.
+ * Represents a client pool used to interact with Gel.
*/
-public final class EdgeDBClient implements StatefulClient, EdgeDBQueryable, AutoCloseable {
- private static final Logger logger = LoggerFactory.getLogger(EdgeDBClient.class);
+public final class GelClientPool implements StatefulClient, GelQueryable, AutoCloseable {
+ private static final Logger logger = LoggerFactory.getLogger(GelClientPool.class);
private static final class PooledClient {
- public final BaseEdgeDBClient client;
+ public final BaseGelClient client;
public Instant lastUsed;
- public PooledClient(BaseEdgeDBClient client) {
+ public PooledClient(BaseGelClient client) {
this.client = client;
lastUsed = Instant.now();
}
@@ -56,20 +56,23 @@ public Duration age() {
private final AtomicInteger clientCount = new AtomicInteger();
private final @NotNull ConcurrentLinkedQueue clients;
- private final EdgeDBConnection connection;
- private final EdgeDBClientConfig config;
+ private final GelConnection connection;
+ private final GelClientConfig config;
private final ClientPoolHolder poolHolder;
private final ClientFactory clientFactory;
private final Session session;
private final int clientAvailability;
/**
- * Constructs a new {@linkplain EdgeDBClient}.
- * @param connection The connection parameters used to connect this client to EdgeDB.
+ * Constructs a new {@linkplain GelClientPool}.
+ * @param connection The connection parameters used to connect this client to Gel.
* @param config The configuration for this client.
* @throws ConfigurationException A configuration parameter is invalid.
*/
- public EdgeDBClient(EdgeDBConnection connection, @NotNull EdgeDBClientConfig config) throws ConfigurationException {
+ public GelClientPool(
+ @NotNull GelConnection connection,
+ @NotNull GelClientConfig config
+ ) throws ConfigurationException {
this.clients = new ConcurrentLinkedQueue<>();
this.config = config;
this.connection = connection;
@@ -80,34 +83,34 @@ public EdgeDBClient(EdgeDBConnection connection, @NotNull EdgeDBClientConfig con
}
/**
- * Constructs a new {@linkplain EdgeDBClient}.
- * @param connection The connection parameters used to connect this client to EdgeDB.
+ * Constructs a new {@linkplain GelClientPool}.
+ * @param connection The connection parameters used to connect this client to Gel.
* @throws ConfigurationException A configuration parameter is invalid.
*/
- public EdgeDBClient(EdgeDBConnection connection) throws EdgeDBException {
- this(connection, EdgeDBClientConfig.DEFAULT);
+ public GelClientPool(@NotNull GelConnection connection) throws GelException {
+ this(connection, GelClientConfig.DEFAULT);
}
/**
- * Constructs a new {@linkplain EdgeDBClient}.
+ * Constructs a new {@linkplain GelClientPool}.
* @param config The configuration for this client.
* @throws IOException The connection arguments couldn't be automatically resolved.
* @throws ConfigurationException A configuration parameter is invalid.
*/
- public EdgeDBClient(@NotNull EdgeDBClientConfig config) throws IOException, ConfigurationException {
- this(EdgeDBConnection.builder().build(), config);
+ public GelClientPool(@NotNull GelClientConfig config) throws IOException, ConfigurationException {
+ this(GelConnection.builder().build(), config);
}
/**
- * Constructs a new {@linkplain EdgeDBClient}.
+ * Constructs a new {@linkplain GelClientPool}.
* @throws IOException The connection arguments couldn't be automatically resolved.
* @throws ConfigurationException A configuration parameter is invalid.
*/
- public EdgeDBClient() throws IOException, EdgeDBException {
- this(EdgeDBConnection.builder().build(), EdgeDBClientConfig.DEFAULT);
+ public GelClientPool() throws IOException, GelException {
+ this(GelConnection.builder().build(), GelClientConfig.DEFAULT);
}
- private EdgeDBClient(@NotNull EdgeDBClient other, Session session) {
+ private GelClientPool(@NotNull GelClientPool other, Session session) {
this.clients = new ConcurrentLinkedQueue<>();
this.config = other.config;
this.connection = other.connection;
@@ -123,9 +126,9 @@ public int getClientCount() {
private @NotNull ClientFactory createClientFactory() throws ConfigurationException {
if(config.getClientType() == ClientType.TCP) {
- return EdgeDBTCPClient::new;
+ return GelTcpClient::new;
} else if (config.getClientType() == ClientType.HTTP) {
- return EdgeDBHttpClient::new;
+ return GelHttpClient::new;
}
throw new ConfigurationException(String.format("No such implementation for client type %s found", this.config.getClientType()));
@@ -182,8 +185,8 @@ public CompletionStage transaction(@NotNull Function CompletionStage transaction(@NotNull Function aliases) {
- return new EdgeDBClient(this, this.session.withModuleAliases(aliases));
+ public @NotNull GelClientPool withModuleAliases(@NotNull Map aliases) {
+ return new GelClientPool(this, this.session.withModuleAliases(aliases));
}
/**
@@ -206,8 +209,8 @@ public CompletionStage transaction(@NotNull Function CompletionStage transaction(@NotNull Function func) {
- return new EdgeDBClient(this, this.session.withConfig(func));
+ public @NotNull GelClientPool withConfig(@NotNull Consumer func) {
+ return new GelClientPool(this, this.session.withConfig(func));
}
/**
@@ -230,8 +233,8 @@ public CompletionStage transaction(@NotNull Function globals) {
- return new EdgeDBClient(this, this.session.withGlobals(globals));
+ public @NotNull GelClientPool withGlobals(@NotNull Map globals) {
+ return new GelClientPool(this, this.session.withGlobals(globals));
}
/**
@@ -242,16 +245,16 @@ public CompletionStage transaction(@NotNull Function {
- private final BaseEdgeDBClient client;
+ private final BaseGelClient client;
private final @Nullable U result;
- private ExecutePair(BaseEdgeDBClient client, @Nullable U result) {
+ private ExecutePair(BaseGelClient client, @Nullable U result) {
this.client = client;
this.result = result;
}
@@ -260,7 +263,7 @@ private ExecutePair(BaseEdgeDBClient client, @Nullable U result) {
return result;
}
- public BaseEdgeDBClient getClient() {
+ public BaseGelClient getClient() {
return client;
}
}
@@ -300,17 +303,17 @@ public CompletionStage execute(@NotNull String query, @Nullable Map CompletionStage> query(@NotNull Class cls, @NotNull String query, @Nullable Map args, @NotNull EnumSet capabilities) {
- return executePooledQuery(cls, query, args, capabilities, EdgeDBQueryable::query);
+ return executePooledQuery(cls, query, args, capabilities, GelQueryable::query);
}
@Override
public CompletionStage querySingle(@NotNull Class cls, @NotNull String query, @Nullable Map args, @NotNull EnumSet capabilities) {
- return executePooledQuery(cls, query, args, capabilities, EdgeDBQueryable::querySingle);
+ return executePooledQuery(cls, query, args, capabilities, GelQueryable::querySingle);
}
@Override
public CompletionStage queryRequiredSingle(@NotNull Class cls, @NotNull String query, @Nullable Map args, @NotNull EnumSet capabilities) {
- return executePooledQuery(cls, query, args, capabilities, EdgeDBQueryable::queryRequiredSingle);
+ return executePooledQuery(cls, query, args, capabilities, GelQueryable::queryRequiredSingle);
}
@Override
@@ -336,7 +339,7 @@ public void close() throws Exception {
}
}
- private synchronized CompletionStage getClient() {
+ private synchronized CompletionStage getClient() {
logger.trace("polling cached clients...");
var cachedClient = clients.poll();
@@ -364,7 +367,7 @@ private synchronized CompletionStage getTransactableClient()
client.getClass().getSimpleName()
);
throw new CompletionException(
- new EdgeDBException("Cannot use transactions with " + client + " type")
+ new GelException("Cannot use transactions with " + client + " type")
);
}
@@ -379,7 +382,7 @@ private void cleanupPool() {
);
}
- private synchronized void acceptClient(BaseEdgeDBClient client) {
+ private synchronized void acceptClient(BaseGelClient client) {
this.clients.add(new PooledClient(client));
var count = this.clientCount.incrementAndGet();
@@ -391,7 +394,7 @@ private synchronized void acceptClient(BaseEdgeDBClient client) {
}
}
- private synchronized @NotNull CompletionStage onClientReady(@NotNull BaseEdgeDBClient client) {
+ private synchronized @NotNull CompletionStage onClientReady(@NotNull BaseGelClient client) {
var suggestedConcurrency = client.getSuggestedPoolConcurrency();
suggestedConcurrency.ifPresent(this.poolHolder::resize);
@@ -399,14 +402,14 @@ private synchronized void acceptClient(BaseEdgeDBClient client) {
return CompletableFuture.completedFuture(null);
}
- private CompletionStage createClient() {
+ private CompletionStage createClient() {
return this.poolHolder.acquireContract()
.thenApply(contract -> {
logger.trace("Contract acquired, remaining handles: {}", this.poolHolder.remaining());
- BaseEdgeDBClient client;
+ BaseGelClient client;
try {
client = clientFactory.create(this.connection, this.config, contract);
- } catch (EdgeDBException e) {
+ } catch (GelException e) {
throw new CompletionException(e);
}
contract.register(client, this::acceptClient);
@@ -419,7 +422,7 @@ private CompletionStage createClient() {
@FunctionalInterface
private interface ClientFactory {
- BaseEdgeDBClient create(EdgeDBConnection connection, EdgeDBClientConfig config, AutoCloseable poolHandle)
- throws EdgeDBException;
+ BaseGelClient create(GelConnection connection, GelClientConfig config, AutoCloseable poolHandle)
+ throws GelException;
}
}
diff --git a/src/driver/src/main/java/com/edgedb/driver/EdgeDBConnection.java b/src/driver/src/main/java/com/gel/driver/GelConnection.java
similarity index 90%
rename from src/driver/src/main/java/com/edgedb/driver/EdgeDBConnection.java
rename to src/driver/src/main/java/com/gel/driver/GelConnection.java
index 4efe902a..58b9cf35 100644
--- a/src/driver/src/main/java/com/edgedb/driver/EdgeDBConnection.java
+++ b/src/driver/src/main/java/com/gel/driver/GelConnection.java
@@ -1,14 +1,14 @@
-package com.edgedb.driver;
-
-import com.edgedb.driver.abstractions.SystemProvider;
-import com.edgedb.driver.abstractions.SystemProvider.GelEnvVar;
-import com.edgedb.driver.datatypes.internal.CloudProfile;
-import com.edgedb.driver.exceptions.ConfigurationException;
-import com.edgedb.driver.util.*;
-import com.edgedb.driver.util.ConfigUtils.ConnectionCredentials;
-import com.edgedb.driver.util.ConfigUtils.DatabaseOrBranch;
-import com.edgedb.driver.util.ConfigUtils.ResolvedField;
-import com.edgedb.driver.util.ConfigUtils.ResolvedFields;
+package com.gel.driver;
+
+import com.gel.driver.abstractions.SystemProvider;
+import com.gel.driver.abstractions.SystemProvider.GelEnvVar;
+import com.gel.driver.datatypes.internal.CloudProfile;
+import com.gel.driver.exceptions.ConfigurationException;
+import com.gel.driver.util.*;
+import com.gel.driver.util.ConfigUtils.ConnectionCredentials;
+import com.gel.driver.util.ConfigUtils.DatabaseOrBranch;
+import com.gel.driver.util.ConfigUtils.ResolvedField;
+import com.gel.driver.util.ConfigUtils.ResolvedFields;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -31,13 +31,13 @@
import java.util.regex.Pattern;
/**
- * A class containing information on how to connect to a EdgeDB instance.
+ * A class containing information on how to connect to a Gel instance.
*/
@SuppressWarnings("CloneableClassWithoutClone")
-public class EdgeDBConnection implements Cloneable {
+public class GelConnection implements Cloneable {
/**
- * Gets a {@linkplain Builder} used to construct a new {@linkplain EdgeDBConnection}.
+ * Gets a {@linkplain Builder} used to construct a new {@linkplain GelConnection}.
*
* @return A new builder instance.
*/
@@ -70,34 +70,9 @@ public class EdgeDBConnection implements Cloneable {
.build();
/**
- * Constructs a new {@linkplain EdgeDBConnection}.
- *
- * @param user The connections' user.
- * @param password The connections' password.
- * @param database The connections' database name.
- * @param hostname The connections' hostname.
- * @param port The connections' port.
- * @param tlsca The connections' tls certificate authority.
- * @param tlsSecurity The connections' tls security policy.
- */
- public EdgeDBConnection(
- String user, String password, String database,
- String hostname, Integer port, String tlsca,
- @Nullable TLSSecurityMode tlsSecurity
- ) {
- this.user = user;
- this.password = password;
- this.database = database;
- this.hostname = hostname;
- this.port = port;
- this.tlsCertificateAuthority = tlsca;
- this.tlsSecurity = tlsSecurity;
- }
-
- /**
- * Constructs an empty {@linkplain EdgeDBConnection}
+ * Constructs an empty {@linkplain GelConnection}
*/
- public EdgeDBConnection() {
+ private GelConnection() {
}
//#region Main connection args
@@ -111,24 +86,6 @@ public EdgeDBConnection() {
return hostname == null ? _defaultHostname : hostname;
}
- /**
- * Sets the current connections hostname field.
- *
- * @param value The new hostname
- * @throws ConfigurationException The hostname is invalid
- */
- protected void setHostname(@NotNull String value) throws ConfigurationException {
- if (value.contains("/")) {
- throw new ConfigurationException("Cannot use UNIX socket for 'Hostname'");
- }
-
- if (value.contains(",")) {
- throw new ConfigurationException("DSN cannot contain more than one host");
- }
-
- hostname = value;
- }
-
@JsonIgnore
private @Nullable String hostname;
private static final String _defaultHostname = "localhost";
@@ -142,15 +99,6 @@ public int getPort() {
return port == null ? _defaultPort : port;
}
- /**
- * Sets the current connections port field.
- *
- * @param value The new port.
- */
- protected void setPort(int value) {
- port = value;
- }
-
@JsonProperty("port")
private @Nullable Integer port;
private static final int _defaultPort = 5656;
@@ -170,15 +118,6 @@ protected void setPort(int value) {
return _defaultDatabase;
}
- /**
- * Sets the current connections database field.
- *
- * @param value The new database.
- */
- protected void setDatabase(String value) {
- database = value;
- }
-
@JsonProperty("database")
private @Nullable String database;
private static final String _defaultDatabase = "edgedb";
@@ -198,15 +137,6 @@ protected void setDatabase(String value) {
return _defaultBranch;
}
- /**
- * Sets the current connections branch field.
- *
- * @param value The new branch.
- */
- protected void setBranch(String value) {
- branch = value;
- }
-
@JsonProperty("branch")
private @Nullable String branch;
private static final String _defaultBranch = "__default__";
@@ -220,15 +150,6 @@ protected void setBranch(String value) {
return user == null ? _defaultUser : user;
}
- /**
- * Sets the current connections username field
- *
- * @param value The new username.
- */
- protected void setUsername(String value) {
- user = value;
- }
-
@JsonProperty("user")
private @Nullable String user;
private static final String _defaultUser = "edgedb";
@@ -242,15 +163,6 @@ protected void setUsername(String value) {
return password == null ? _defaultPassword : password;
}
- /**
- * Sets the current connections password field.
- *
- * @param value The new password.
- */
- protected void setPassword(String value) {
- password = value;
- }
-
@JsonProperty("password")
private @Nullable String password;
private static final String _defaultPassword = "";
@@ -264,15 +176,6 @@ protected void setPassword(String value) {
return this.secretKey;
}
- /**
- * Sets the secret key used to authenticate with cloud instances.
- *
- * @param secretKey The secret key for cloud authentication.
- */
- protected void setSecretKey(@Nullable String secretKey) {
- this.secretKey = secretKey;
- }
-
@JsonIgnore
private @Nullable String secretKey;
@@ -285,15 +188,6 @@ protected void setSecretKey(@Nullable String secretKey) {
return tlsCertificateAuthority;
}
- /**
- * Sets the current connections TLS certificate authority.
- *
- * @param value The new TLS certificate authority.
- */
- protected void setTLSCertificateAuthority(String value) {
- tlsCertificateAuthority = value;
- }
-
@JsonProperty("tls_ca")
private @Nullable String tlsCertificateAuthority;
@@ -311,16 +205,6 @@ protected void setTLSCertificateAuthority(String value) {
: this.tlsSecurity;
}
- /**
- * Sets the current connections TLS security mode.
- *
- * @param value The new TLS security mode.
- * @see TLSSecurityMode
- */
- protected void setTLSSecurity(TLSSecurityMode value) {
- tlsSecurity = value;
- }
-
@JsonProperty("tls_security")
private @Nullable TLSSecurityMode tlsSecurity;
private static final TLSSecurityMode _defaultTlsSecurity = TLSSecurityMode.STRICT;
@@ -347,15 +231,6 @@ public WaitTime(@NotNull Long value, @NotNull TimeUnit unit) {
return waitUntilAvailable == null ? _defaultWaitUntilAvailable : waitUntilAvailable;
}
- /**
- * Sets the time a client will wait for a connection to be established with the server.
- *
- * @param value The time to wait.
- */
- protected void setWaitUntilAvailable(WaitTime waitUntilAvailable) {
- this.waitUntilAvailable = waitUntilAvailable;
- }
-
private @Nullable WaitTime waitUntilAvailable;
private static final @NotNull WaitTime _defaultWaitUntilAvailable = new WaitTime(30l, TimeUnit.SECONDS);
@@ -368,15 +243,6 @@ protected void setWaitUntilAvailable(WaitTime waitUntilAvailable) {
return this.cloudProfile == null ? "default" : this.cloudProfile;
}
- /**
- * Sets the name of the cloud profile to use to resolve the secret key.
- *
- * @param cloudProfile The name of the cloud profile.
- */
- protected void setCloudProfile(@Nullable String cloudProfile) {
- this.cloudProfile = cloudProfile;
- }
-
@JsonIgnore
private @Nullable String cloudProfile;
@@ -412,7 +278,7 @@ protected void setCloudProfile(@Nullable String cloudProfile) {
//#region Builder
/**
- * A builder class used to construct a {@linkplain EdgeDBConnection}
+ * A builder class used to construct a {@linkplain GelConnection}
*/
public static final class Builder {
// Primary args
@@ -508,7 +374,7 @@ public static final class Builder {
* @param port The new port.
* @return The current builder.
*/
- public @NotNull Builder withPort(@NotNull Integer port) {
+ public @NotNull Builder withPort(@NotNull int port) {
this.port = port;
return this;
}
@@ -516,9 +382,12 @@ public static final class Builder {
/**
* Sets the connections' database.
*
+ * @deprecated in Gel.Net >=2.0 in favor of branch.
+ *
* @param database The new database.
* @return The current builder.
*/
+ @Deprecated
public @NotNull Builder withDatabase(@NotNull String database) {
this.database = database;
return this;
@@ -668,17 +537,17 @@ public boolean isEmpty() {
}
/**
- * Constructs a {@linkplain EdgeDBConnection} from the current builder.
+ * Constructs a {@linkplain GelConnection} from the current builder.
*
- * @return A {@linkplain EdgeDBConnection} that represents the current builder.
+ * @return A {@linkplain GelConnection} that represents the current builder.
*/
- public @NotNull EdgeDBConnection build(
+ public @NotNull GelConnection build(
) throws ConfigurationException, IOException {
return fromBuilder(this, ConfigUtils.getDefaultSystemProvider());
}
}
- private static @NotNull EdgeDBConnection fromBuilder(
+ private static @NotNull GelConnection fromBuilder(
@NotNull Builder builder,
@NotNull SystemProvider provider
) throws ConfigurationException, IOException {
@@ -710,7 +579,7 @@ public boolean isEmpty() {
+ "\"CredentialsFile\" or \"Host\"/\"Port\"");
// The primaryError has priority, so hold on to any other exception
// until all primary options are processed.
- @Nullable ConfigurationException deferredPrimaryError = null;
+ @Nullable Exception deferredPrimaryError = null;
if (builder.instance != null) {
if (hasPrimaryOptions) {
@@ -764,12 +633,18 @@ public boolean isEmpty() {
credentialsText = "{}";
}
}
- else {
+ else if (builder.credentialsFile.toString().equals("")) {
deferredPrimaryError = new ConfigurationException(String.format(
"Invalid CredentialsFile: \"%s\", could not find file",
builder.credentialsFile
));
}
+ else {
+ deferredPrimaryError = new FileNotFoundException(String.format(
+ "Invalid CredentialsFile: \"%s\", could not find file",
+ builder.credentialsFile
+ ));
+ }
hasPrimaryOptions = true;
}
if (credentialsText != null) {
@@ -815,7 +690,15 @@ public boolean isEmpty() {
}
if (deferredPrimaryError != null) {
- throw deferredPrimaryError;
+ if (deferredPrimaryError instanceof ConfigurationException) {
+ throw (ConfigurationException)deferredPrimaryError;
+ }
+ else if (deferredPrimaryError instanceof IOException) {
+ throw (IOException)deferredPrimaryError;
+ }
+ else {
+ throw new ConfigurationException("Error: Unknown exception.");
+ }
}
}
@@ -836,8 +719,7 @@ public boolean isEmpty() {
+ "\"GEL_CREDENTIALS_FILE\" or \"GEL_HOST\"/\"GEL_PORT\"");
// The primaryError has priority, so hold on to any other exception
// until all primary env vars are processed.
- @Nullable ConfigurationException deferredPrimaryError = null;
-
+ @Nullable Exception deferredPrimaryError = null;
GelEnvVar instanceEnvVar = SystemProvider.getGelEnvVariable(provider, INSTANCE_ENV_NAME);
if (instanceEnvVar != null) {
if (hasPrimaryEnv) {
@@ -881,7 +763,7 @@ public boolean isEmpty() {
}
else
{
- deferredPrimaryError = new ConfigurationException(String.format(
+ deferredPrimaryError = new FileNotFoundException(String.format(
"Invalid credential file from %s: \"%s\", could not find file",
credentialsFileEnvVar.name,
credentialsFileEnvVar.value
@@ -925,7 +807,15 @@ public boolean isEmpty() {
}
if (deferredPrimaryError != null) {
- throw deferredPrimaryError;
+ if (deferredPrimaryError instanceof ConfigurationException) {
+ throw (ConfigurationException)deferredPrimaryError;
+ }
+ else if (deferredPrimaryError instanceof IOException) {
+ throw (IOException)deferredPrimaryError;
+ }
+ else {
+ throw new ConfigurationException("Error: Unknown exception.");
+ }
}
}
@@ -1116,7 +1006,7 @@ else if (builder.branch != null) {
);
}
else {
- throw new ConfigurationException(String.format(
+ throw new FileNotFoundException(String.format(
"Invalid TLSCertificateAuthorityFile: \"%s\", could not find file",
builder.tlsCertificateAuthorityFile
));
@@ -1158,11 +1048,11 @@ else if (builder.branch != null) {
//#region Builder Helpers
- private static EdgeDBConnection _fromResolvedFields(
+ private static GelConnection _fromResolvedFields(
@NotNull ConfigUtils.ResolvedFields resolvedFields,
@NotNull SystemProvider platform
- ) throws ConfigurationException {
- EdgeDBConnection result = new EdgeDBConnection();
+ ) throws ConfigurationException, IOException {
+ GelConnection result = new GelConnection();
result.hostname = ConfigUtils.checkAndGetFieldValue(
resolvedFields.host,
@@ -1465,7 +1355,7 @@ else if (key.startsWith("database")) {
}
else {
value = ResolvedField.invalid(
- new ConfigurationException(String.format(
+ new FileNotFoundException(String.format(
"Invalid DSN query parameter: \"%s\" could not find file \"%s\"",
oldKey,
fileName
@@ -1560,10 +1450,10 @@ else if (key.startsWith("database")) {
}
/**
- * Creates a {@linkplain EdgeDBConnection} from a project file.
+ * Creates a {@linkplain GelConnection} from a project file.
*
* @param path The {@code edgedb.toml} file
- * @return A {@linkplain EdgeDBConnection} that targets the instance hosting the project specified by the
+ * @return A {@linkplain GelConnection} that targets the instance hosting the project specified by the
* {@code edgedb.toml} file.
* @throws IOException The project file or one of its dependants doesn't exist
* @throws ConfigurationException A cloud instance parameter is invalid OR the instance name is in an invalid.
@@ -1738,11 +1628,11 @@ private static ResolvedFields _parseCloudInstanceName(
/**
* Turns this connection into a valid DSN string.
*
- * @return A DSN string representing the parameters within the current {@linkplain EdgeDBConnection}.
+ * @return A DSN string representing the parameters within the current {@linkplain GelConnection}.
*/
@Override
public @NotNull String toString() {
- var sb = new StringBuilder("edgedb://");
+ var sb = new StringBuilder("gel://");
this.getUsername();
sb.append(this.getUsername());
diff --git a/src/driver/src/main/java/com/edgedb/driver/EdgeDBQueryable.java b/src/driver/src/main/java/com/gel/driver/GelQueryable.java
similarity index 98%
rename from src/driver/src/main/java/com/edgedb/driver/EdgeDBQueryable.java
rename to src/driver/src/main/java/com/gel/driver/GelQueryable.java
index c09c4d18..02dc0888 100644
--- a/src/driver/src/main/java/com/edgedb/driver/EdgeDBQueryable.java
+++ b/src/driver/src/main/java/com/gel/driver/GelQueryable.java
@@ -1,7 +1,7 @@
-package com.edgedb.driver;
+package com.gel.driver;
-import com.edgedb.driver.datatypes.Json;
-import com.edgedb.driver.exceptions.ResultCardinalityMismatchException;
+import com.gel.driver.datatypes.Json;
+import com.gel.driver.exceptions.ResultCardinalityMismatchException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -11,10 +11,10 @@
import java.util.concurrent.CompletionStage;
/**
- * Represents a generic EdgeDB queryable interface, providing methods to execute queries with cardinality control.
- * @see EdgeDBClient
+ * Represents a generic Gel queryable interface, providing methods to execute queries with cardinality control.
+ * @see GelClientPool
*/
-public interface EdgeDBQueryable {
+public interface GelQueryable {
/**
* Executes a query, ignoring the result.
diff --git a/src/driver/src/main/java/com/edgedb/driver/LogSeverity.java b/src/driver/src/main/java/com/gel/driver/LogSeverity.java
similarity index 86%
rename from src/driver/src/main/java/com/edgedb/driver/LogSeverity.java
rename to src/driver/src/main/java/com/gel/driver/LogSeverity.java
index 2b8c279c..9307d4a2 100644
--- a/src/driver/src/main/java/com/edgedb/driver/LogSeverity.java
+++ b/src/driver/src/main/java/com/gel/driver/LogSeverity.java
@@ -1,6 +1,6 @@
-package com.edgedb.driver;
+package com.gel.driver;
-import com.edgedb.driver.binary.BinaryEnum;
+import com.gel.driver.binary.BinaryEnum;
import org.jetbrains.annotations.NotNull;
/**
diff --git a/src/driver/src/main/java/com/edgedb/driver/ObjectEnumerator.java b/src/driver/src/main/java/com/gel/driver/ObjectEnumerator.java
similarity index 80%
rename from src/driver/src/main/java/com/edgedb/driver/ObjectEnumerator.java
rename to src/driver/src/main/java/com/gel/driver/ObjectEnumerator.java
index 820f32fe..05b287ad 100644
--- a/src/driver/src/main/java/com/edgedb/driver/ObjectEnumerator.java
+++ b/src/driver/src/main/java/com/gel/driver/ObjectEnumerator.java
@@ -1,6 +1,6 @@
-package com.edgedb.driver;
+package com.gel.driver;
-import com.edgedb.driver.exceptions.EdgeDBException;
+import com.gel.driver.exceptions.GelException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -20,18 +20,18 @@ public interface ObjectEnumerator {
/**
* Gets the next {@linkplain ObjectElement}, deserializing the value.
* @return The next element.
- * @throws EdgeDBException A deserialization error occurred.
+ * @throws GelException A deserialization error occurred.
* @throws OperationNotSupportedException The read operation isn't allowed.
*/
- @Nullable ObjectElement next() throws EdgeDBException, OperationNotSupportedException;
+ @Nullable ObjectElement next() throws GelException, OperationNotSupportedException;
/**
* Flattens this enumerator into a single map, consuming the remaining data.
* @return A map of name-value pairs.
- * @throws EdgeDBException A deserialization error occurred.
+ * @throws GelException A deserialization error occurred.
* @throws OperationNotSupportedException The read operation isn't allowed.
*/
- Map flatten() throws EdgeDBException, OperationNotSupportedException;
+ Map flatten() throws GelException, OperationNotSupportedException;
/**
* Represents an element read from a {@linkplain ObjectEnumerator}.
diff --git a/src/driver/src/main/java/com/edgedb/driver/TLSSecurityMode.java b/src/driver/src/main/java/com/gel/driver/TLSSecurityMode.java
similarity index 98%
rename from src/driver/src/main/java/com/edgedb/driver/TLSSecurityMode.java
rename to src/driver/src/main/java/com/gel/driver/TLSSecurityMode.java
index e035651e..9b5511b7 100644
--- a/src/driver/src/main/java/com/edgedb/driver/TLSSecurityMode.java
+++ b/src/driver/src/main/java/com/gel/driver/TLSSecurityMode.java
@@ -1,4 +1,4 @@
-package com.edgedb.driver;
+package com.gel.driver;
import org.jetbrains.annotations.NotNull;
diff --git a/src/driver/src/main/java/com/edgedb/driver/Transaction.java b/src/driver/src/main/java/com/gel/driver/Transaction.java
similarity index 70%
rename from src/driver/src/main/java/com/edgedb/driver/Transaction.java
rename to src/driver/src/main/java/com/gel/driver/Transaction.java
index 2536dd52..714386cc 100644
--- a/src/driver/src/main/java/com/edgedb/driver/Transaction.java
+++ b/src/driver/src/main/java/com/gel/driver/Transaction.java
@@ -1,9 +1,9 @@
-package com.edgedb.driver;
+package com.gel.driver;
/**
* Represents a generic transaction.
*/
-public interface Transaction extends EdgeDBQueryable {
+public interface Transaction extends GelQueryable {
/**
* Gets the state of the current transaction.
* @return The current transaction state.
diff --git a/src/driver/src/main/java/com/edgedb/driver/TransactionIsolation.java b/src/driver/src/main/java/com/gel/driver/TransactionIsolation.java
similarity index 94%
rename from src/driver/src/main/java/com/edgedb/driver/TransactionIsolation.java
rename to src/driver/src/main/java/com/gel/driver/TransactionIsolation.java
index a1f9db00..2594bd24 100644
--- a/src/driver/src/main/java/com/edgedb/driver/TransactionIsolation.java
+++ b/src/driver/src/main/java/com/gel/driver/TransactionIsolation.java
@@ -1,4 +1,4 @@
-package com.edgedb.driver;
+package com.gel.driver;
import org.jetbrains.annotations.NotNull;
@@ -17,7 +17,7 @@ public enum TransactionIsolation {
/**
* All statements of the current transaction can only see data committed before the first query or data-modification
* statement was executed in this transaction.
- * @deprecated in EdgeDB >=1.3
+ * @deprecated in Gel >=1.3
*/
@Deprecated
REPEATABLE_READ;
diff --git a/src/driver/src/main/java/com/edgedb/driver/TransactionSettings.java b/src/driver/src/main/java/com/gel/driver/TransactionSettings.java
similarity index 99%
rename from src/driver/src/main/java/com/edgedb/driver/TransactionSettings.java
rename to src/driver/src/main/java/com/gel/driver/TransactionSettings.java
index acbd4a32..14d35385 100644
--- a/src/driver/src/main/java/com/edgedb/driver/TransactionSettings.java
+++ b/src/driver/src/main/java/com/gel/driver/TransactionSettings.java
@@ -1,4 +1,4 @@
-package com.edgedb.driver;
+package com.gel.driver;
import org.jetbrains.annotations.NotNull;
diff --git a/src/driver/src/main/java/com/edgedb/driver/TransactionState.java b/src/driver/src/main/java/com/gel/driver/TransactionState.java
similarity index 94%
rename from src/driver/src/main/java/com/edgedb/driver/TransactionState.java
rename to src/driver/src/main/java/com/gel/driver/TransactionState.java
index c0bfa444..43850a76 100644
--- a/src/driver/src/main/java/com/edgedb/driver/TransactionState.java
+++ b/src/driver/src/main/java/com/gel/driver/TransactionState.java
@@ -1,6 +1,6 @@
-package com.edgedb.driver;
+package com.gel.driver;
-import com.edgedb.driver.binary.BinaryEnum;
+import com.gel.driver.binary.BinaryEnum;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
diff --git a/src/driver/src/main/java/com/gel/driver/abstractions/ClientQueryDelegate.java b/src/driver/src/main/java/com/gel/driver/abstractions/ClientQueryDelegate.java
new file mode 100644
index 00000000..9679e701
--- /dev/null
+++ b/src/driver/src/main/java/com/gel/driver/abstractions/ClientQueryDelegate.java
@@ -0,0 +1,13 @@
+package com.gel.driver.abstractions;
+
+import com.gel.driver.Capabilities;
+import com.gel.driver.GelQueryable;
+
+import java.util.EnumSet;
+import java.util.Map;
+import java.util.concurrent.CompletionStage;
+
+@FunctionalInterface
+public interface ClientQueryDelegate {
+ CompletionStage run(GelQueryable client, Class cls, String query, Map args, EnumSet capabilities);
+}
diff --git a/src/driver/src/main/java/com/edgedb/driver/abstractions/OSType.java b/src/driver/src/main/java/com/gel/driver/abstractions/OSType.java
similarity index 62%
rename from src/driver/src/main/java/com/edgedb/driver/abstractions/OSType.java
rename to src/driver/src/main/java/com/gel/driver/abstractions/OSType.java
index 8c7c982b..c7699a70 100644
--- a/src/driver/src/main/java/com/edgedb/driver/abstractions/OSType.java
+++ b/src/driver/src/main/java/com/gel/driver/abstractions/OSType.java
@@ -1,4 +1,4 @@
-package com.edgedb.driver.abstractions;
+package com.gel.driver.abstractions;
public enum OSType {
WINDOWS,
diff --git a/src/driver/src/main/java/com/edgedb/driver/abstractions/QueryDelegate.java b/src/driver/src/main/java/com/gel/driver/abstractions/QueryDelegate.java
similarity index 77%
rename from src/driver/src/main/java/com/edgedb/driver/abstractions/QueryDelegate.java
rename to src/driver/src/main/java/com/gel/driver/abstractions/QueryDelegate.java
index f738e149..70f18fae 100644
--- a/src/driver/src/main/java/com/edgedb/driver/abstractions/QueryDelegate.java
+++ b/src/driver/src/main/java/com/gel/driver/abstractions/QueryDelegate.java
@@ -1,6 +1,6 @@
-package com.edgedb.driver.abstractions;
+package com.gel.driver.abstractions;
-import com.edgedb.driver.Capabilities;
+import com.gel.driver.Capabilities;
import java.util.EnumSet;
import java.util.Map;
diff --git a/src/driver/src/main/java/com/edgedb/driver/abstractions/SystemProvider.java b/src/driver/src/main/java/com/gel/driver/abstractions/SystemProvider.java
similarity index 98%
rename from src/driver/src/main/java/com/edgedb/driver/abstractions/SystemProvider.java
rename to src/driver/src/main/java/com/gel/driver/abstractions/SystemProvider.java
index 6460a451..5fe9879f 100644
--- a/src/driver/src/main/java/com/edgedb/driver/abstractions/SystemProvider.java
+++ b/src/driver/src/main/java/com/gel/driver/abstractions/SystemProvider.java
@@ -1,4 +1,4 @@
-package com.edgedb.driver.abstractions;
+package com.gel.driver.abstractions;
import java.io.IOException;
import java.nio.file.Path;
diff --git a/src/driver/src/main/java/com/edgedb/driver/annotations/EdgeDBDeserializer.java b/src/driver/src/main/java/com/gel/driver/annotations/GelDeserializer.java
similarity index 82%
rename from src/driver/src/main/java/com/edgedb/driver/annotations/EdgeDBDeserializer.java
rename to src/driver/src/main/java/com/gel/driver/annotations/GelDeserializer.java
index 9eaca2ed..0b35c794 100644
--- a/src/driver/src/main/java/com/edgedb/driver/annotations/EdgeDBDeserializer.java
+++ b/src/driver/src/main/java/com/gel/driver/annotations/GelDeserializer.java
@@ -1,4 +1,4 @@
-package com.edgedb.driver.annotations;
+package com.gel.driver.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -10,5 +10,5 @@
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.CONSTRUCTOR, ElementType.METHOD})
-public @interface EdgeDBDeserializer {
+public @interface GelDeserializer {
}
diff --git a/src/driver/src/main/java/com/edgedb/driver/annotations/EdgeDBIgnore.java b/src/driver/src/main/java/com/gel/driver/annotations/GelIgnore.java
similarity index 71%
rename from src/driver/src/main/java/com/edgedb/driver/annotations/EdgeDBIgnore.java
rename to src/driver/src/main/java/com/gel/driver/annotations/GelIgnore.java
index 28643b1c..70f8f39c 100644
--- a/src/driver/src/main/java/com/edgedb/driver/annotations/EdgeDBIgnore.java
+++ b/src/driver/src/main/java/com/gel/driver/annotations/GelIgnore.java
@@ -1,4 +1,4 @@
-package com.edgedb.driver.annotations;
+package com.gel.driver.annotations;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -7,5 +7,5 @@
* Marks the current target ignored for the binding.
*/
@Retention(RetentionPolicy.RUNTIME)
-public @interface EdgeDBIgnore {
+public @interface GelIgnore {
}
diff --git a/src/driver/src/main/java/com/edgedb/driver/annotations/EdgeDBLinkType.java b/src/driver/src/main/java/com/gel/driver/annotations/GelLinkType.java
similarity index 82%
rename from src/driver/src/main/java/com/edgedb/driver/annotations/EdgeDBLinkType.java
rename to src/driver/src/main/java/com/gel/driver/annotations/GelLinkType.java
index b0c06daf..2b7e73d3 100644
--- a/src/driver/src/main/java/com/edgedb/driver/annotations/EdgeDBLinkType.java
+++ b/src/driver/src/main/java/com/gel/driver/annotations/GelLinkType.java
@@ -1,4 +1,4 @@
-package com.edgedb.driver.annotations;
+package com.gel.driver.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -10,6 +10,6 @@
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.PARAMETER})
-public @interface EdgeDBLinkType {
+public @interface GelLinkType {
Class> value();
}
diff --git a/src/driver/src/main/java/com/edgedb/driver/annotations/EdgeDBName.java b/src/driver/src/main/java/com/gel/driver/annotations/GelName.java
similarity index 66%
rename from src/driver/src/main/java/com/edgedb/driver/annotations/EdgeDBName.java
rename to src/driver/src/main/java/com/gel/driver/annotations/GelName.java
index b7c0614d..c9c19a27 100644
--- a/src/driver/src/main/java/com/edgedb/driver/annotations/EdgeDBName.java
+++ b/src/driver/src/main/java/com/gel/driver/annotations/GelName.java
@@ -1,4 +1,4 @@
-package com.edgedb.driver.annotations;
+package com.gel.driver.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -6,10 +6,10 @@
import java.lang.annotation.Target;
/**
- * Specifies the name of the target as it's represented as in EdgeDB.
+ * Specifies the name of the target as it's represented as in Gel.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.PARAMETER})
-public @interface EdgeDBName {
+public @interface GelName {
String value();
}
diff --git a/src/driver/src/main/java/com/edgedb/driver/annotations/EdgeDBType.java b/src/driver/src/main/java/com/gel/driver/annotations/GelType.java
similarity index 79%
rename from src/driver/src/main/java/com/edgedb/driver/annotations/EdgeDBType.java
rename to src/driver/src/main/java/com/gel/driver/annotations/GelType.java
index f31dd9d3..d04ac0b6 100644
--- a/src/driver/src/main/java/com/edgedb/driver/annotations/EdgeDBType.java
+++ b/src/driver/src/main/java/com/gel/driver/annotations/GelType.java
@@ -1,4 +1,4 @@
-package com.edgedb.driver.annotations;
+package com.gel.driver.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@@ -6,11 +6,11 @@
import java.lang.annotation.Target;
/**
- * Marks the target type as a type that is represented in EdgeDB.
+ * Marks the target type as a type that is represented in Gel.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
-public @interface EdgeDBType {
+public @interface GelType {
/**
* Gets or sets the module that this type resides in.
* @return The module the type resides in if specified; otherwise {@code [UNASSIGNED]} is returned indicating that
diff --git a/src/driver/src/main/java/com/edgedb/driver/async/AsyncEvent.java b/src/driver/src/main/java/com/gel/driver/async/AsyncEvent.java
similarity index 97%
rename from src/driver/src/main/java/com/edgedb/driver/async/AsyncEvent.java
rename to src/driver/src/main/java/com/gel/driver/async/AsyncEvent.java
index fdc78181..248d0650 100644
--- a/src/driver/src/main/java/com/edgedb/driver/async/AsyncEvent.java
+++ b/src/driver/src/main/java/com/gel/driver/async/AsyncEvent.java
@@ -1,4 +1,4 @@
-package com.edgedb.driver.async;
+package com.gel.driver.async;
import org.jetbrains.annotations.NotNull;
diff --git a/src/driver/src/main/java/com/edgedb/driver/async/ChannelCompletableFuture.java b/src/driver/src/main/java/com/gel/driver/async/ChannelCompletableFuture.java
similarity index 97%
rename from src/driver/src/main/java/com/edgedb/driver/async/ChannelCompletableFuture.java
rename to src/driver/src/main/java/com/gel/driver/async/ChannelCompletableFuture.java
index 67b5dfd9..2ba279be 100644
--- a/src/driver/src/main/java/com/edgedb/driver/async/ChannelCompletableFuture.java
+++ b/src/driver/src/main/java/com/gel/driver/async/ChannelCompletableFuture.java
@@ -1,4 +1,4 @@
-package com.edgedb.driver.async;
+package com.gel.driver.async;
import io.netty.channel.ChannelFuture;
import org.jetbrains.annotations.NotNull;
diff --git a/src/driver/src/main/java/com/edgedb/driver/binary/BinaryEnum.java b/src/driver/src/main/java/com/gel/driver/binary/BinaryEnum.java
similarity index 83%
rename from src/driver/src/main/java/com/edgedb/driver/binary/BinaryEnum.java
rename to src/driver/src/main/java/com/gel/driver/binary/BinaryEnum.java
index fb18b2fb..424cda74 100644
--- a/src/driver/src/main/java/com/edgedb/driver/binary/BinaryEnum.java
+++ b/src/driver/src/main/java/com/gel/driver/binary/BinaryEnum.java
@@ -1,6 +1,6 @@
-package com.edgedb.driver.binary;
+package com.gel.driver.binary;
-import com.edgedb.driver.util.BinaryProtocolUtils;
+import com.gel.driver.util.BinaryProtocolUtils;
import org.jetbrains.annotations.NotNull;
import javax.naming.OperationNotSupportedException;
diff --git a/src/driver/src/main/java/com/edgedb/driver/binary/PacketReader.java b/src/driver/src/main/java/com/gel/driver/binary/PacketReader.java
similarity index 97%
rename from src/driver/src/main/java/com/edgedb/driver/binary/PacketReader.java
rename to src/driver/src/main/java/com/gel/driver/binary/PacketReader.java
index 29f96ddd..32f71ad5 100644
--- a/src/driver/src/main/java/com/edgedb/driver/binary/PacketReader.java
+++ b/src/driver/src/main/java/com/gel/driver/binary/PacketReader.java
@@ -1,7 +1,7 @@
-package com.edgedb.driver.binary;
+package com.gel.driver.binary;
-import com.edgedb.driver.binary.protocol.common.Annotation;
-import com.edgedb.driver.binary.protocol.common.KeyValue;
+import com.gel.driver.binary.protocol.common.Annotation;
+import com.gel.driver.binary.protocol.common.KeyValue;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.jetbrains.annotations.NotNull;
diff --git a/src/driver/src/main/java/com/edgedb/driver/binary/PacketSerializer.java b/src/driver/src/main/java/com/gel/driver/binary/PacketSerializer.java
similarity index 90%
rename from src/driver/src/main/java/com/edgedb/driver/binary/PacketSerializer.java
rename to src/driver/src/main/java/com/gel/driver/binary/PacketSerializer.java
index e97ae852..a1a6a329 100644
--- a/src/driver/src/main/java/com/edgedb/driver/binary/PacketSerializer.java
+++ b/src/driver/src/main/java/com/gel/driver/binary/PacketSerializer.java
@@ -1,12 +1,12 @@
-package com.edgedb.driver.binary;
-
-import com.edgedb.driver.binary.protocol.ServerMessageType;
-import com.edgedb.driver.binary.protocol.Receivable;
-import com.edgedb.driver.binary.protocol.Sendable;
-import com.edgedb.driver.clients.EdgeDBBinaryClient;
-import com.edgedb.driver.exceptions.ConnectionFailedException;
-import com.edgedb.driver.exceptions.EdgeDBException;
-import com.edgedb.driver.util.HexUtils;
+package com.gel.driver.binary;
+
+import com.gel.driver.binary.protocol.ServerMessageType;
+import com.gel.driver.binary.protocol.Receivable;
+import com.gel.driver.binary.protocol.Sendable;
+import com.gel.driver.clients.GelBinaryClient;
+import com.gel.driver.exceptions.ConnectionFailedException;
+import com.gel.driver.exceptions.GelException;
+import com.gel.driver.util.HexUtils;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
@@ -44,7 +44,7 @@ public static & BinaryEnum, U extends Number> T getEnumVal
return (T)binaryEnumMap.get(enumCls).get(raw);
}
- public static @NotNull MessageToMessageDecoder createDecoder(EdgeDBBinaryClient client) {
+ public static @NotNull MessageToMessageDecoder createDecoder(GelBinaryClient client) {
return new MessageToMessageDecoder<>() {
private final Map contracts = new HashMap<>();
@@ -80,7 +80,7 @@ protected void decode(@NotNull ChannelHandlerContext ctx, @NotNull ByteBuf msg,
if(packet == null) {
logger.error("Got null result for packet type {}", type);
- throw new EdgeDBException("Failed to read message type: malformed data");
+ throw new GelException("Failed to read message type: malformed data");
}
logger.debug("S->C: T:{}", type);
@@ -198,20 +198,20 @@ protected void encode(@NotNull ChannelHandlerContext ctx, @NotNull Sendable msg,
}
public static @Nullable Receivable deserialize(
- EdgeDBBinaryClient client, ServerMessageType messageType, long length, @NotNull ByteBuf buffer
+ GelBinaryClient client, ServerMessageType messageType, long length, @NotNull ByteBuf buffer
) {
var reader = new PacketReader(buffer);
return deserializeSingle(client, messageType, length, reader, true);
}
public static @Nullable Receivable deserialize(
- EdgeDBBinaryClient client, ServerMessageType messageType, long length, @NotNull ByteBuf buffer, boolean verifyEmpty
+ GelBinaryClient client, ServerMessageType messageType, long length, @NotNull ByteBuf buffer, boolean verifyEmpty
) {
var reader = new PacketReader(buffer);
return deserializeSingle(client, messageType, length, reader, verifyEmpty);
}
- public static @Nullable Receivable deserializeSingle(EdgeDBBinaryClient client, PacketReader reader) {
+ public static @Nullable Receivable deserializeSingle(GelBinaryClient client, PacketReader reader) {
var messageType = reader.readEnum(ServerMessageType.class, Byte.TYPE);
var length = reader.readUInt32().longValue();
@@ -219,7 +219,7 @@ protected void encode(@NotNull ChannelHandlerContext ctx, @NotNull Sendable msg,
}
public static @Nullable Receivable deserializeSingle(
- EdgeDBBinaryClient client, ServerMessageType type, long length, @NotNull PacketReader reader,
+ GelBinaryClient client, ServerMessageType type, long length, @NotNull PacketReader reader,
boolean verifyEmpty
) {
try {
@@ -237,12 +237,12 @@ protected void encode(@NotNull ChannelHandlerContext ctx, @NotNull Sendable msg,
}
}
- public static HttpResponse.BodyHandler> createHandler(EdgeDBBinaryClient client) {
+ public static HttpResponse.BodyHandler> createHandler(GelBinaryClient client) {
return new PacketBodyHandler(client);
}
private static class PacketBodyHandler implements HttpResponse.BodyHandler> {
- private final EdgeDBBinaryClient client;
- public PacketBodyHandler(EdgeDBBinaryClient client) {
+ private final GelBinaryClient client;
+ public PacketBodyHandler(GelBinaryClient client) {
this.client = client;
}
@@ -318,7 +318,7 @@ public void onComplete() {
if(packet == null && completeBuffer.readableBytes() > 0) {
promise.completeExceptionally(
- new EdgeDBException("Failed to deserialize packet, buffer had " + completeBuffer.readableBytes() + " bytes remaining")
+ new GelException("Failed to deserialize packet, buffer had " + completeBuffer.readableBytes() + " bytes remaining")
);
return;
}
diff --git a/src/driver/src/main/java/com/edgedb/driver/binary/PacketWriter.java b/src/driver/src/main/java/com/gel/driver/binary/PacketWriter.java
similarity index 96%
rename from src/driver/src/main/java/com/edgedb/driver/binary/PacketWriter.java
rename to src/driver/src/main/java/com/gel/driver/binary/PacketWriter.java
index f6eb6d8d..9f48be3c 100644
--- a/src/driver/src/main/java/com/edgedb/driver/binary/PacketWriter.java
+++ b/src/driver/src/main/java/com/gel/driver/binary/PacketWriter.java
@@ -1,8 +1,8 @@
-package com.edgedb.driver.binary;
+package com.gel.driver.binary;
-import com.edgedb.driver.exceptions.EdgeDBException;
-import com.edgedb.driver.util.BinaryProtocolUtils;
-import com.edgedb.driver.util.TypeUtils;
+import com.gel.driver.exceptions.GelException;
+import com.gel.driver.util.BinaryProtocolUtils;
+import com.gel.driver.util.TypeUtils;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
import org.jetbrains.annotations.NotNull;
@@ -19,7 +19,7 @@
import java.util.UUID;
import java.util.function.BiFunction;
-import static com.edgedb.driver.util.BinaryProtocolUtils.*;
+import static com.gel.driver.util.BinaryProtocolUtils.*;
public class PacketWriter implements AutoCloseable {
private ByteBuf buffer;
@@ -236,10 +236,10 @@ public & BinaryEnum> void writeEnumSet(@
@FunctionalInterface
public interface WriterDelegate {
- void consume(PacketWriter writer) throws OperationNotSupportedException, EdgeDBException;
+ void consume(PacketWriter writer) throws OperationNotSupportedException, GelException;
}
- public void writeDelegateWithLength(@NotNull WriterDelegate delegate) throws OperationNotSupportedException, EdgeDBException {
+ public void writeDelegateWithLength(@NotNull WriterDelegate delegate) throws OperationNotSupportedException, GelException {
ensureCanWrite(INT_SIZE);
var currentIndex = this.getPosition();
diff --git a/src/driver/src/main/java/com/edgedb/driver/binary/SerializableData.java b/src/driver/src/main/java/com/gel/driver/binary/SerializableData.java
similarity index 85%
rename from src/driver/src/main/java/com/edgedb/driver/binary/SerializableData.java
rename to src/driver/src/main/java/com/gel/driver/binary/SerializableData.java
index db129735..c0f626f4 100644
--- a/src/driver/src/main/java/com/edgedb/driver/binary/SerializableData.java
+++ b/src/driver/src/main/java/com/gel/driver/binary/SerializableData.java
@@ -1,4 +1,4 @@
-package com.edgedb.driver.binary;
+package com.gel.driver.binary;
import javax.naming.OperationNotSupportedException;
diff --git a/src/driver/src/main/java/com/edgedb/driver/binary/builders/CodecBuilder.java b/src/driver/src/main/java/com/gel/driver/binary/builders/CodecBuilder.java
similarity index 88%
rename from src/driver/src/main/java/com/edgedb/driver/binary/builders/CodecBuilder.java
rename to src/driver/src/main/java/com/gel/driver/binary/builders/CodecBuilder.java
index d3d8a697..3998f609 100644
--- a/src/driver/src/main/java/com/edgedb/driver/binary/builders/CodecBuilder.java
+++ b/src/driver/src/main/java/com/gel/driver/binary/builders/CodecBuilder.java
@@ -1,20 +1,20 @@
-package com.edgedb.driver.binary.builders;
-
-import com.edgedb.driver.binary.PacketReader;
-import com.edgedb.driver.binary.codecs.Codec;
-import com.edgedb.driver.binary.codecs.NullCodec;
-import com.edgedb.driver.binary.codecs.scalars.*;
-import com.edgedb.driver.binary.codecs.scalars.complex.DateTimeCodec;
-import com.edgedb.driver.binary.codecs.scalars.complex.RelativeDurationCodec;
-import com.edgedb.driver.binary.protocol.ProtocolProvider;
-import com.edgedb.driver.binary.protocol.ProtocolVersion;
-import com.edgedb.driver.binary.protocol.TypeDescriptorInfo;
-import com.edgedb.driver.binary.protocol.common.Cardinality;
-import com.edgedb.driver.binary.protocol.common.IOFormat;
-import com.edgedb.driver.binary.protocol.common.descriptors.CodecMetadata;
-import com.edgedb.driver.clients.EdgeDBBinaryClient;
-import com.edgedb.driver.exceptions.EdgeDBException;
-import com.edgedb.driver.exceptions.MissingCodecException;
+package com.gel.driver.binary.builders;
+
+import com.gel.driver.binary.PacketReader;
+import com.gel.driver.binary.codecs.Codec;
+import com.gel.driver.binary.codecs.NullCodec;
+import com.gel.driver.binary.codecs.scalars.*;
+import com.gel.driver.binary.codecs.scalars.complex.DateTimeCodec;
+import com.gel.driver.binary.codecs.scalars.complex.RelativeDurationCodec;
+import com.gel.driver.binary.protocol.ProtocolProvider;
+import com.gel.driver.binary.protocol.ProtocolVersion;
+import com.gel.driver.binary.protocol.TypeDescriptorInfo;
+import com.gel.driver.binary.protocol.common.Cardinality;
+import com.gel.driver.binary.protocol.common.IOFormat;
+import com.gel.driver.binary.protocol.common.descriptors.CodecMetadata;
+import com.gel.driver.clients.GelBinaryClient;
+import com.gel.driver.exceptions.GelException;
+import com.gel.driver.exceptions.MissingCodecException;
import io.netty.buffer.ByteBuf;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -71,7 +71,7 @@ private CodecCache(ProtocolVersion version) {
return codec != null ? codec : getCachedOrScalarCodec(provider, id);
}
- public static @NotNull Codec> buildCodec(EdgeDBBinaryClient client, @NotNull UUID id, @Nullable ByteBuf buffer) throws EdgeDBException {
+ public static @NotNull Codec> buildCodec(GelBinaryClient client, @NotNull UUID id, @Nullable ByteBuf buffer) throws GelException {
if(id.equals(NULL_CODEC_ID) || buffer == null) {
return getOrCreateCodec(client.getProtocolProvider(), NULL_CODEC_ID, NullCodec::new);
}
@@ -81,7 +81,7 @@ private CodecCache(ProtocolVersion version) {
}
@SuppressWarnings("unchecked")
- public static @NotNull Codec buildCodec(EdgeDBBinaryClient client, @NotNull UUID id, @Nullable ByteBuf buffer, Class cls) throws EdgeDBException, OperationNotSupportedException {
+ public static @NotNull Codec buildCodec(GelBinaryClient client, @NotNull UUID id, @Nullable ByteBuf buffer, Class cls) throws GelException, OperationNotSupportedException {
if(id.equals(NULL_CODEC_ID) || buffer == null) {
return (Codec)getOrCreateCodec(client.getProtocolProvider(), NULL_CODEC_ID, NullCodec::new);
}
@@ -91,11 +91,11 @@ private CodecCache(ProtocolVersion version) {
}
@SuppressWarnings("unchecked")
- public static @NotNull Codec buildCodec(EdgeDBBinaryClient client, @NotNull UUID id, @NotNull PacketReader reader, Class ignoredCodecResult) throws EdgeDBException {
+ public static @NotNull Codec buildCodec(GelBinaryClient client, @NotNull UUID id, @NotNull PacketReader reader, Class ignoredCodecResult) throws GelException {
return (Codec) buildCodec(client, id, reader);
}
- public static @NotNull Codec> buildCodec(EdgeDBBinaryClient client, @NotNull UUID id, @NotNull PacketReader reader) throws EdgeDBException {
+ public static @NotNull Codec> buildCodec(GelBinaryClient client, @NotNull UUID id, @NotNull PacketReader reader) throws GelException {
try {
if(id.equals(NULL_CODEC_ID)) {
logger.debug("Returning null codec");
diff --git a/src/driver/src/main/java/com/edgedb/driver/binary/builders/ObjectBuilder.java b/src/driver/src/main/java/com/gel/driver/binary/builders/ObjectBuilder.java
similarity index 83%
rename from src/driver/src/main/java/com/edgedb/driver/binary/builders/ObjectBuilder.java
rename to src/driver/src/main/java/com/gel/driver/binary/builders/ObjectBuilder.java
index 61640dd5..90c6db8c 100644
--- a/src/driver/src/main/java/com/edgedb/driver/binary/builders/ObjectBuilder.java
+++ b/src/driver/src/main/java/com/gel/driver/binary/builders/ObjectBuilder.java
@@ -1,13 +1,13 @@
-package com.edgedb.driver.binary.builders;
-
-import com.edgedb.driver.binary.builders.types.TypeBuilder;
-import com.edgedb.driver.binary.codecs.Codec;
-import com.edgedb.driver.binary.codecs.ObjectCodec;
-import com.edgedb.driver.binary.codecs.visitors.TypeVisitor;
-import com.edgedb.driver.clients.EdgeDBBinaryClient;
-import com.edgedb.driver.exceptions.EdgeDBException;
-import com.edgedb.driver.exceptions.NoTypeConverterException;
-import com.edgedb.driver.util.TypeUtils;
+package com.gel.driver.binary.builders;
+
+import com.gel.driver.binary.builders.types.TypeBuilder;
+import com.gel.driver.binary.codecs.Codec;
+import com.gel.driver.binary.codecs.ObjectCodec;
+import com.gel.driver.binary.codecs.visitors.TypeVisitor;
+import com.gel.driver.clients.GelBinaryClient;
+import com.gel.driver.exceptions.GelException;
+import com.gel.driver.exceptions.NoTypeConverterException;
+import com.gel.driver.util.TypeUtils;
import io.netty.buffer.ByteBuf;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -31,7 +31,7 @@ public interface CollectionConverter> {
}};
}
- public static @Nullable T buildResult(@NotNull EdgeDBBinaryClient client, Codec> codec, @NotNull ByteBuf data, @NotNull Class cls) throws EdgeDBException, OperationNotSupportedException {
+ public static @Nullable T buildResult(@NotNull GelBinaryClient client, Codec> codec, @NotNull ByteBuf data, @NotNull Class cls) throws GelException, OperationNotSupportedException {
var visitor = new TypeVisitor(client);
visitor.setTargetType(cls);
codec = visitor.visit(codec);
@@ -45,7 +45,7 @@ public interface CollectionConverter> {
}
@SuppressWarnings("unchecked")
- public static @Nullable T convertTo(@NotNull Class cls, @Nullable Object value) throws EdgeDBException {
+ public static @Nullable T convertTo(@NotNull Class cls, @Nullable Object value) throws GelException {
try {
if(value == null) {
return null;
@@ -86,7 +86,7 @@ public interface CollectionConverter> {
);
}
} catch (Exception x) {
- throw new EdgeDBException("Failed to convert type to specified result", x);
+ throw new GelException("Failed to convert type to specified result", x);
}
}
diff --git a/src/driver/src/main/java/com/edgedb/driver/binary/builders/TypeDeserializerFactory.java b/src/driver/src/main/java/com/gel/driver/binary/builders/TypeDeserializerFactory.java
similarity index 58%
rename from src/driver/src/main/java/com/edgedb/driver/binary/builders/TypeDeserializerFactory.java
rename to src/driver/src/main/java/com/gel/driver/binary/builders/TypeDeserializerFactory.java
index 002e4f56..37d5fa5a 100644
--- a/src/driver/src/main/java/com/edgedb/driver/binary/builders/TypeDeserializerFactory.java
+++ b/src/driver/src/main/java/com/gel/driver/binary/builders/TypeDeserializerFactory.java
@@ -1,7 +1,7 @@
-package com.edgedb.driver.binary.builders;
+package com.gel.driver.binary.builders;
-import com.edgedb.driver.ObjectEnumerator;
-import com.edgedb.driver.exceptions.EdgeDBException;
+import com.gel.driver.ObjectEnumerator;
+import com.gel.driver.exceptions.GelException;
import org.jetbrains.annotations.Nullable;
import javax.naming.OperationNotSupportedException;
@@ -11,16 +11,16 @@ public interface TypeDeserializerFactory {
T deserialize(
final ObjectEnumerator enumerator,
final @Nullable ParentDeserializer parent
- ) throws EdgeDBException, OperationNotSupportedException, ReflectiveOperationException;
+ ) throws GelException, OperationNotSupportedException, ReflectiveOperationException;
default T deserialize(
final ObjectEnumerator enumerator
- ) throws EdgeDBException, OperationNotSupportedException, ReflectiveOperationException {
+ ) throws GelException, OperationNotSupportedException, ReflectiveOperationException {
return deserialize(enumerator, null);
}
@FunctionalInterface
interface ParentDeserializer {
- void accept(T value, ObjectEnumerator.ObjectElement element) throws EdgeDBException, ReflectiveOperationException;
+ void accept(T value, ObjectEnumerator.ObjectElement element) throws GelException, ReflectiveOperationException;
}
}
diff --git a/src/driver/src/main/java/com/edgedb/driver/binary/builders/internal/ObjectEnumeratorImpl.java b/src/driver/src/main/java/com/gel/driver/binary/builders/internal/ObjectEnumeratorImpl.java
similarity index 76%
rename from src/driver/src/main/java/com/edgedb/driver/binary/builders/internal/ObjectEnumeratorImpl.java
rename to src/driver/src/main/java/com/gel/driver/binary/builders/internal/ObjectEnumeratorImpl.java
index d6485995..79ef350a 100644
--- a/src/driver/src/main/java/com/edgedb/driver/binary/builders/internal/ObjectEnumeratorImpl.java
+++ b/src/driver/src/main/java/com/gel/driver/binary/builders/internal/ObjectEnumeratorImpl.java
@@ -1,11 +1,11 @@
-package com.edgedb.driver.binary.builders.internal;
+package com.gel.driver.binary.builders.internal;
-import com.edgedb.driver.binary.PacketReader;
-import com.edgedb.driver.ObjectEnumerator;
-import com.edgedb.driver.binary.codecs.CodecContext;
-import com.edgedb.driver.binary.codecs.ObjectCodec;
-import com.edgedb.driver.clients.EdgeDBBinaryClient;
-import com.edgedb.driver.exceptions.EdgeDBException;
+import com.gel.driver.binary.PacketReader;
+import com.gel.driver.ObjectEnumerator;
+import com.gel.driver.binary.codecs.CodecContext;
+import com.gel.driver.binary.codecs.ObjectCodec;
+import com.gel.driver.clients.GelBinaryClient;
+import com.gel.driver.exceptions.GelException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -13,7 +13,7 @@
import java.util.HashMap;
import java.util.Map;
-import static com.edgedb.driver.util.BinaryProtocolUtils.INT_SIZE;
+import static com.gel.driver.util.BinaryProtocolUtils.INT_SIZE;
public final class ObjectEnumeratorImpl implements ObjectEnumerator {
private final @NotNull PacketReader reader;
@@ -31,7 +31,7 @@ public ObjectEnumeratorImpl(@NotNull PacketReader reader, ObjectCodec codec, Cod
this.numElements = reader.readInt32();
}
- public EdgeDBBinaryClient getClient() {
+ public GelBinaryClient getClient() {
return this.context.client;
}
@@ -41,7 +41,7 @@ public boolean hasRemaining() {
}
@Override
- public @Nullable ObjectEnumerator.ObjectElement next() throws EdgeDBException, OperationNotSupportedException {
+ public @Nullable ObjectEnumerator.ObjectElement next() throws GelException, OperationNotSupportedException {
if(!hasRemaining()) {
return null;
}
@@ -69,7 +69,7 @@ public boolean hasRemaining() {
}
@Override
- public @NotNull Map flatten() throws EdgeDBException, OperationNotSupportedException {
+ public @NotNull Map flatten() throws GelException, OperationNotSupportedException {
return new HashMap<>() {
{
ObjectEnumerator.ObjectElement element;
diff --git a/src/driver/src/main/java/com/edgedb/driver/binary/builders/types/TypeBuilder.java b/src/driver/src/main/java/com/gel/driver/binary/builders/types/TypeBuilder.java
similarity index 74%
rename from src/driver/src/main/java/com/edgedb/driver/binary/builders/types/TypeBuilder.java
rename to src/driver/src/main/java/com/gel/driver/binary/builders/types/TypeBuilder.java
index 3acaaa4a..7143948c 100644
--- a/src/driver/src/main/java/com/edgedb/driver/binary/builders/types/TypeBuilder.java
+++ b/src/driver/src/main/java/com/gel/driver/binary/builders/types/TypeBuilder.java
@@ -1,12 +1,12 @@
-package com.edgedb.driver.binary.builders.types;
-
-import com.edgedb.driver.annotations.EdgeDBType;
-import com.edgedb.driver.binary.codecs.Codec;
-import com.edgedb.driver.binary.codecs.ObjectCodec;
-import com.edgedb.driver.clients.EdgeDBBinaryClient;
-import com.edgedb.driver.datatypes.Tuple;
-import com.edgedb.driver.datatypes.internal.TupleImpl;
-import com.edgedb.driver.exceptions.EdgeDBException;
+package com.gel.driver.binary.builders.types;
+
+import com.gel.driver.annotations.GelType;
+import com.gel.driver.binary.codecs.Codec;
+import com.gel.driver.binary.codecs.ObjectCodec;
+import com.gel.driver.clients.GelBinaryClient;
+import com.gel.driver.datatypes.Tuple;
+import com.gel.driver.datatypes.internal.TupleImpl;
+import com.gel.driver.exceptions.GelException;
import io.netty.buffer.ByteBuf;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -29,7 +29,7 @@ public final class TypeBuilder {
}
@SuppressWarnings("unchecked")
- public static @Nullable T buildObject(@NotNull EdgeDBBinaryClient client, @NotNull Class type, ObjectCodec codec, @NotNull ByteBuf data) throws OperationNotSupportedException, EdgeDBException {
+ public static @Nullable T buildObject(@NotNull GelBinaryClient client, @NotNull Class type, ObjectCodec codec, @NotNull ByteBuf data) throws OperationNotSupportedException, GelException {
var info = getDeserializerInfo(type);
if(info == null) {
@@ -67,6 +67,6 @@ private static boolean isValidObjectType(@NotNull Class> type) {
return true;
}
- return type.getAnnotation(EdgeDBType.class) != null;
+ return type.getAnnotation(GelType.class) != null;
}
}
diff --git a/src/driver/src/main/java/com/edgedb/driver/binary/builders/types/TypeDeserializerInfo.java b/src/driver/src/main/java/com/gel/driver/binary/builders/types/TypeDeserializerInfo.java
similarity index 86%
rename from src/driver/src/main/java/com/edgedb/driver/binary/builders/types/TypeDeserializerInfo.java
rename to src/driver/src/main/java/com/gel/driver/binary/builders/types/TypeDeserializerInfo.java
index 13d0eca6..7a5a0b5e 100644
--- a/src/driver/src/main/java/com/edgedb/driver/binary/builders/types/TypeDeserializerInfo.java
+++ b/src/driver/src/main/java/com/gel/driver/binary/builders/types/TypeDeserializerInfo.java
@@ -1,17 +1,17 @@
-package com.edgedb.driver.binary.builders.types;
-
-import com.edgedb.driver.ObjectEnumerator;
-import com.edgedb.driver.annotations.*;
-import com.edgedb.driver.binary.builders.ObjectBuilder;
-import com.edgedb.driver.binary.builders.TypeDeserializerFactory;
-import com.edgedb.driver.binary.builders.internal.ObjectEnumeratorImpl;
-import com.edgedb.driver.binary.protocol.common.Cardinality;
-import com.edgedb.driver.exceptions.EdgeDBException;
-import com.edgedb.driver.exceptions.NoTypeConverterException;
-import com.edgedb.driver.namingstrategies.NamingStrategy;
-import com.edgedb.driver.util.FastInverseIndexer;
-import com.edgedb.driver.util.StringsUtil;
-import com.edgedb.driver.util.TypeUtils;
+package com.gel.driver.binary.builders.types;
+
+import com.gel.driver.ObjectEnumerator;
+import com.gel.driver.annotations.*;
+import com.gel.driver.binary.builders.ObjectBuilder;
+import com.gel.driver.binary.builders.TypeDeserializerFactory;
+import com.gel.driver.binary.builders.internal.ObjectEnumeratorImpl;
+import com.gel.driver.binary.protocol.common.Cardinality;
+import com.gel.driver.exceptions.GelException;
+import com.gel.driver.exceptions.NoTypeConverterException;
+import com.gel.driver.namingstrategies.NamingStrategy;
+import com.gel.driver.util.FastInverseIndexer;
+import com.gel.driver.util.StringsUtil;
+import com.gel.driver.util.TypeUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.reflections.Reflections;
@@ -29,7 +29,7 @@ public class TypeDeserializerInfo {
public final TypeDeserializerFactory factory;
private final Class type;
- private final @Nullable EdgeDBType edgeDBTypeAnno;
+ private final @Nullable GelType gelTypeAnno;
// lazy fields, use getter methods
private List fields;
@@ -45,7 +45,7 @@ public TypeDeserializerInfo(@NotNull Class type) {
this.constructorNamingMap = new HashMap<>();
this.fieldNamingMap = new HashMap<>();
this.type = type;
- this.edgeDBTypeAnno = type.getAnnotation(EdgeDBType.class);
+ this.gelTypeAnno = type.getAnnotation(GelType.class);
this.children = new HashMap<>();
try {
@@ -59,7 +59,7 @@ public TypeDeserializerInfo(@NotNull Class type) {
public TypeDeserializerInfo(Class cls, TypeDeserializerFactory factory) {
this.type = cls;
this.factory = factory;
- this.edgeDBTypeAnno = type.getAnnotation(EdgeDBType.class);
+ this.gelTypeAnno = type.getAnnotation(GelType.class);
this.constructorNamingMap = new HashMap<>();
this.fieldNamingMap = new HashMap<>();
this.children = new HashMap<>();
@@ -78,7 +78,7 @@ public TypeDeserializerInfo(Class cls, TypeDeserializerFactory factory) {
var bases = new ArrayList>();
Class> tempType = type;
Class> base;
- while((base = tempType.getSuperclass()) != null && base.isAnnotationPresent(EdgeDBType.class)) {
+ while((base = tempType.getSuperclass()) != null && base.isAnnotationPresent(GelType.class)) {
bases.add(base);
tempType = base;
}
@@ -141,7 +141,7 @@ public void scanChildren() {
if(!children.isEmpty()) {
for (var child : children) {
- if(child.getAnnotation(EdgeDBIgnore.class) != null) {
+ if(child.getAnnotation(GelIgnore.class) != null) {
continue;
}
@@ -161,11 +161,11 @@ public boolean requiresTypeNameIntrospection() {
}
public @Nullable String getModuleName() {
- if(this.edgeDBTypeAnno == null) {
+ if(this.gelTypeAnno == null) {
return null;
}
- var module = this.edgeDBTypeAnno.module();
+ var module = this.gelTypeAnno.module();
if(StringsUtil.isNullOrEmpty(module) || module.equals("[UNASSIGNED]")) {
return null;
@@ -175,7 +175,7 @@ public boolean requiresTypeNameIntrospection() {
}
private boolean isValidField(@NotNull Field field) {
- return field.getAnnotation(EdgeDBIgnore.class) == null;
+ return field.getAnnotation(GelIgnore.class) == null;
}
@SuppressWarnings("unchecked")
@@ -183,7 +183,7 @@ private boolean isValidField(@NotNull Field field) {
// check for constructor deserializer
var constructors = this.type.getDeclaredConstructors();
- var ctorDeserializer = Arrays.stream(constructors).filter(x -> x.getAnnotation(EdgeDBDeserializer.class) != null).findFirst();
+ var ctorDeserializer = Arrays.stream(constructors).filter(x -> x.getAnnotation(GelDeserializer.class) != null).findFirst();
if(ctorDeserializer.isPresent()) {
var ctor = ctorDeserializer.get();
@@ -238,7 +238,7 @@ private boolean isValidField(@NotNull Field field) {
if(type.isInterface() || Modifier.isAbstract(type.getModifiers())) {
return (enumerator, parent) -> {
if(this.children.isEmpty()) {
- throw new EdgeDBException(
+ throw new GelException(
"Cannot deserialize to type " + this.type + "; no sub-types found to " +
"deserialize to for this interface/abstract class"
);
@@ -252,12 +252,12 @@ private boolean isValidField(@NotNull Field field) {
var element = enumerator.next();
if(element == null) {
- throw new EdgeDBException("No data left in object enumerator for type building");
+ throw new GelException("No data left in object enumerator for type building");
}
//noinspection SpellCheckingInspection
if(!element.getName().equals("__tname__")) {
- throw new EdgeDBException("Type introspection is required for deserializing abstract classes or interfaces");
+ throw new GelException("Type introspection is required for deserializing abstract classes or interfaces");
}
var split = ((String)element.getValue()).split("::");
@@ -277,7 +277,7 @@ private boolean isValidField(@NotNull Field field) {
}
}
- throw new EdgeDBException(String.format("No child found for abstract type %s matching the name \"%s::%s\"", this.type.getName(), split[0], split[1]));
+ throw new GelException(String.format("No child found for abstract type %s matching the name \"%s::%s\"", this.type.getName(), split[0], split[1]));
};
}
@@ -320,7 +320,7 @@ private boolean isValidField(@NotNull Field field) {
}
private String getNameOrAnnotated(@NotNull U value, @NotNull Function getName) {
- var anno = value.getAnnotation(EdgeDBName.class);
+ var anno = value.getAnnotation(GelName.class);
if(anno != null && anno.value() != null) {
return anno.value();
}
@@ -329,18 +329,18 @@ private String getNameOrAnnotated(@NotNull U value,
}
public static class FieldInfo {
- public final EdgeDBName edgedbNameAnno;
+ public final GelName gelNameAnno;
public final @NotNull Class> fieldType;
public final @NotNull Field field;
private final @Nullable Method setMethod;
- private final @Nullable EdgeDBLinkType linkType;
+ private final @Nullable GelLinkType linkType;
public FieldInfo(@NotNull Field field, @NotNull Map setters) {
this.field = field;
this.fieldType = field.getType();
- this.edgedbNameAnno = field.getAnnotation(EdgeDBName.class);
+ this.gelNameAnno = field.getAnnotation(GelName.class);
// if there's a set method that isn't ignored, with the same type, use it.
var setMethod = setters.get(field.getName().substring(0, 1).toUpperCase() + field.getName().substring(1));
@@ -350,10 +350,10 @@ public FieldInfo(@NotNull Field field, @NotNull Map setters) {
this.setMethod = setMethod;
- this.linkType = field.getAnnotation(EdgeDBLinkType.class);
+ this.linkType = field.getAnnotation(GelLinkType.class);
}
- public Class> getType(@Nullable Cardinality cardinality) throws EdgeDBException {
+ public Class> getType(@Nullable Cardinality cardinality) throws GelException {
var isCollectionLike = cardinality == Cardinality.MANY || fieldType.isArray() || Collection.class.isAssignableFrom(fieldType);
if(isCollectionLike) {
@@ -363,7 +363,7 @@ public Class> getType(@Nullable Cardinality cardinality) throws EdgeDBExceptio
return fieldType;
}
- private Class> extractCollectionInnerType(@NotNull Class> cls) throws EdgeDBException {
+ private Class> extractCollectionInnerType(@NotNull Class> cls) throws GelException {
if(linkType != null) {
return linkType.value();
}
@@ -376,13 +376,13 @@ private Class> extractCollectionInnerType(@NotNull Class> cls) throws EdgeDB
var generic = field.getGenericType();
if (!(generic instanceof ParameterizedType)) {
- throw new EdgeDBException("Unable to resolve generic parameter in collection for " + field);
+ throw new GelException("Unable to resolve generic parameter in collection for " + field);
}
var actualGenerics = ((ParameterizedType) generic).getActualTypeArguments();
if (actualGenerics.length != 1) {
- throw new EdgeDBException(
+ throw new GelException(
"Unable to resolve generic parameter for " + field + ", expected 1 generic " +
"type argument, but found " + actualGenerics.length
);
@@ -391,19 +391,19 @@ private Class> extractCollectionInnerType(@NotNull Class> cls) throws EdgeDB
return (Class>) actualGenerics[0];
}
- throw new EdgeDBException("Cannot find element type of the collection " + cls.getName());
+ throw new GelException("Cannot find element type of the collection " + cls.getName());
}
public @NotNull String getFieldName() {
return this.field.getName();
}
- public void convertAndSet(boolean useMethodSetter, Object instance, Object value) throws EdgeDBException, ReflectiveOperationException {
+ public void convertAndSet(boolean useMethodSetter, Object instance, Object value) throws GelException, ReflectiveOperationException {
Object converted;
try {
converted = convertToType(value);
- } catch (EdgeDBException error) {
+ } catch (GelException error) {
var valueType = value == null ? "NULL" : value.getClass().getName();
throw new NoTypeConverterException(
String.format("The field '%s' with type '%s' cannot be implicitly assigned to the received data type '%s'", field.getName(), field.getType().getName(), valueType)
@@ -417,7 +417,7 @@ public void convertAndSet(boolean useMethodSetter, Object instance, Object value
}
}
- private @Nullable Object convertToType(@Nullable Object value) throws EdgeDBException {
+ private @Nullable Object convertToType(@Nullable Object value) throws GelException {
// TODO: custom converters?
if(value == null) {
diff --git a/src/driver/src/main/java/com/edgedb/driver/binary/codecs/ArgumentCodec.java b/src/driver/src/main/java/com/gel/driver/binary/codecs/ArgumentCodec.java
similarity index 66%
rename from src/driver/src/main/java/com/edgedb/driver/binary/codecs/ArgumentCodec.java
rename to src/driver/src/main/java/com/gel/driver/binary/codecs/ArgumentCodec.java
index b3fd756c..f7c0165d 100644
--- a/src/driver/src/main/java/com/edgedb/driver/binary/codecs/ArgumentCodec.java
+++ b/src/driver/src/main/java/com/gel/driver/binary/codecs/ArgumentCodec.java
@@ -1,7 +1,7 @@
-package com.edgedb.driver.binary.codecs;
+package com.gel.driver.binary.codecs;
-import com.edgedb.driver.binary.PacketWriter;
-import com.edgedb.driver.exceptions.EdgeDBException;
+import com.gel.driver.binary.PacketWriter;
+import com.gel.driver.exceptions.GelException;
import io.netty.buffer.ByteBuf;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -10,8 +10,8 @@
import java.util.Map;
public interface ArgumentCodec extends Codec {
- void serializeArguments(final PacketWriter writer, @Nullable Map value, CodecContext context) throws EdgeDBException, OperationNotSupportedException;
- static ByteBuf serializeToBuffer(@NotNull ArgumentCodec codec, final @Nullable Map value, final CodecContext context) throws OperationNotSupportedException, EdgeDBException {
+ void serializeArguments(final PacketWriter writer, @Nullable Map value, CodecContext context) throws GelException, OperationNotSupportedException;
+ static ByteBuf serializeToBuffer(@NotNull ArgumentCodec codec, final @Nullable Map value, final CodecContext context) throws OperationNotSupportedException, GelException {
try (var writer = new PacketWriter()) {
codec.serializeArguments(writer, value, context);
return writer.getBuffer();
diff --git a/src/driver/src/main/java/com/edgedb/driver/binary/codecs/ArrayCodec.java b/src/driver/src/main/java/com/gel/driver/binary/codecs/ArrayCodec.java
similarity index 84%
rename from src/driver/src/main/java/com/edgedb/driver/binary/codecs/ArrayCodec.java
rename to src/driver/src/main/java/com/gel/driver/binary/codecs/ArrayCodec.java
index 8294e378..e0f9468a 100644
--- a/src/driver/src/main/java/com/edgedb/driver/binary/codecs/ArrayCodec.java
+++ b/src/driver/src/main/java/com/gel/driver/binary/codecs/ArrayCodec.java
@@ -1,10 +1,10 @@
-package com.edgedb.driver.binary.codecs;
+package com.gel.driver.binary.codecs;
-import com.edgedb.driver.binary.PacketReader;
-import com.edgedb.driver.binary.PacketWriter;
-import com.edgedb.driver.binary.protocol.common.descriptors.CodecMetadata;
-import com.edgedb.driver.exceptions.EdgeDBException;
-import com.edgedb.driver.util.BinaryProtocolUtils;
+import com.gel.driver.binary.PacketReader;
+import com.gel.driver.binary.PacketWriter;
+import com.gel.driver.binary.protocol.common.descriptors.CodecMetadata;
+import com.gel.driver.exceptions.GelException;
+import com.gel.driver.util.BinaryProtocolUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -30,7 +30,7 @@ public ArrayCodec(UUID id, @Nullable CodecMetadata metadata, Class> cls, Codec
}
@Override
- public void serialize(@NotNull PacketWriter writer, T @Nullable [] value, CodecContext context) throws OperationNotSupportedException, EdgeDBException {
+ public void serialize(@NotNull PacketWriter writer, T @Nullable [] value, CodecContext context) throws OperationNotSupportedException, GelException {
if(value == null) {
writer.writeArrayWithoutLength(EMPTY_ARRAY);
return;
@@ -57,7 +57,7 @@ public void serialize(@NotNull PacketWriter writer, T @Nullable [] value, CodecC
@SuppressWarnings("unchecked")
@Override
- public T @Nullable [] deserialize(@NotNull PacketReader reader, CodecContext context) throws EdgeDBException, OperationNotSupportedException {
+ public T @Nullable [] deserialize(@NotNull PacketReader reader, CodecContext context) throws GelException, OperationNotSupportedException {
var dimensions = reader.readInt32();
reader.skip(BinaryProtocolUtils.LONG_SIZE); // reserved
diff --git a/src/driver/src/main/java/com/edgedb/driver/binary/codecs/Codec.java b/src/driver/src/main/java/com/gel/driver/binary/codecs/Codec.java
similarity index 69%
rename from src/driver/src/main/java/com/edgedb/driver/binary/codecs/Codec.java
rename to src/driver/src/main/java/com/gel/driver/binary/codecs/Codec.java
index f74b1e25..5e0f415b 100644
--- a/src/driver/src/main/java/com/edgedb/driver/binary/codecs/Codec.java
+++ b/src/driver/src/main/java/com/gel/driver/binary/codecs/Codec.java
@@ -1,9 +1,9 @@
-package com.edgedb.driver.binary.codecs;
+package com.gel.driver.binary.codecs;
-import com.edgedb.driver.binary.PacketWriter;
-import com.edgedb.driver.binary.PacketReader;
-import com.edgedb.driver.binary.protocol.common.descriptors.CodecMetadata;
-import com.edgedb.driver.exceptions.EdgeDBException;
+import com.gel.driver.binary.PacketWriter;
+import com.gel.driver.binary.PacketReader;
+import com.gel.driver.binary.protocol.common.descriptors.CodecMetadata;
+import com.gel.driver.exceptions.GelException;
import io.netty.buffer.ByteBuf;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -17,20 +17,20 @@ public interface Codec {
@Nullable CodecMetadata getMetadata();
- void serialize(final PacketWriter writer, final @Nullable T value, final CodecContext context) throws OperationNotSupportedException, EdgeDBException;
- @Nullable T deserialize(final PacketReader reader, final CodecContext context) throws EdgeDBException, OperationNotSupportedException;
+ void serialize(final PacketWriter writer, final @Nullable T value, final CodecContext context) throws OperationNotSupportedException, GelException;
+ @Nullable T deserialize(final PacketReader reader, final CodecContext context) throws GelException, OperationNotSupportedException;
Class getConvertingClass();
boolean canConvert(Type type);
- static ByteBuf serializeToBuffer(@NotNull Codec codec, final @Nullable T value, final CodecContext context) throws OperationNotSupportedException, EdgeDBException {
+ static ByteBuf serializeToBuffer(@NotNull Codec codec, final @Nullable T value, final CodecContext context) throws OperationNotSupportedException, GelException {
try (var writer = new PacketWriter()) {
codec.serialize(writer, value, context);
return writer.getBuffer();
}
}
- static @Nullable T deserializeFromBuffer(@NotNull Codec codec, final @NotNull ByteBuf buffer, final CodecContext context) throws EdgeDBException, OperationNotSupportedException {
+ static @Nullable T deserializeFromBuffer(@NotNull Codec codec, final @NotNull ByteBuf buffer, final CodecContext context) throws GelException, OperationNotSupportedException {
var reader = new PacketReader(buffer);
return codec.deserialize(reader, context);
}
diff --git a/src/driver/src/main/java/com/edgedb/driver/binary/codecs/CodecBase.java b/src/driver/src/main/java/com/gel/driver/binary/codecs/CodecBase.java
similarity index 87%
rename from src/driver/src/main/java/com/edgedb/driver/binary/codecs/CodecBase.java
rename to src/driver/src/main/java/com/gel/driver/binary/codecs/CodecBase.java
index a60649e8..bb6fc5d5 100644
--- a/src/driver/src/main/java/com/edgedb/driver/binary/codecs/CodecBase.java
+++ b/src/driver/src/main/java/com/gel/driver/binary/codecs/CodecBase.java
@@ -1,6 +1,6 @@
-package com.edgedb.driver.binary.codecs;
+package com.gel.driver.binary.codecs;
-import com.edgedb.driver.binary.protocol.common.descriptors.CodecMetadata;
+import com.gel.driver.binary.protocol.common.descriptors.CodecMetadata;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
diff --git a/src/driver/src/main/java/com/gel/driver/binary/codecs/CodecContext.java b/src/driver/src/main/java/com/gel/driver/binary/codecs/CodecContext.java
new file mode 100644
index 00000000..429f80b4
--- /dev/null
+++ b/src/driver/src/main/java/com/gel/driver/binary/codecs/CodecContext.java
@@ -0,0 +1,17 @@
+package com.gel.driver.binary.codecs;
+
+import com.gel.driver.binary.codecs.visitors.TypeVisitor;
+import com.gel.driver.clients.GelBinaryClient;
+import org.jetbrains.annotations.NotNull;
+
+public final class CodecContext {
+ public final GelBinaryClient client;
+
+ public CodecContext(GelBinaryClient client) {
+ this.client = client;
+ }
+
+ public @NotNull TypeVisitor getTypeVisitor() {
+ return new TypeVisitor(this.client);
+ }
+}
diff --git a/src/driver/src/main/java/com/edgedb/driver/binary/codecs/CompilableCodec.java b/src/driver/src/main/java/com/gel/driver/binary/codecs/CompilableCodec.java
similarity index 93%
rename from src/driver/src/main/java/com/edgedb/driver/binary/codecs/CompilableCodec.java
rename to src/driver/src/main/java/com/gel/driver/binary/codecs/CompilableCodec.java
index c6bf57f2..3c4b5c1d 100644
--- a/src/driver/src/main/java/com/edgedb/driver/binary/codecs/CompilableCodec.java
+++ b/src/driver/src/main/java/com/gel/driver/binary/codecs/CompilableCodec.java
@@ -1,8 +1,8 @@
-package com.edgedb.driver.binary.codecs;
+package com.gel.driver.binary.codecs;
-import com.edgedb.driver.binary.PacketReader;
-import com.edgedb.driver.binary.PacketWriter;
-import com.edgedb.driver.binary.protocol.common.descriptors.CodecMetadata;
+import com.gel.driver.binary.PacketReader;
+import com.gel.driver.binary.PacketWriter;
+import com.gel.driver.binary.protocol.common.descriptors.CodecMetadata;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
diff --git a/src/driver/src/main/java/com/edgedb/driver/binary/codecs/ComplexCodec.java b/src/driver/src/main/java/com/gel/driver/binary/codecs/ComplexCodec.java
similarity index 83%
rename from src/driver/src/main/java/com/edgedb/driver/binary/codecs/ComplexCodec.java
rename to src/driver/src/main/java/com/gel/driver/binary/codecs/ComplexCodec.java
index c4d97df4..9d6b4a93 100644
--- a/src/driver/src/main/java/com/edgedb/driver/binary/codecs/ComplexCodec.java
+++ b/src/driver/src/main/java/com/gel/driver/binary/codecs/ComplexCodec.java
@@ -1,4 +1,4 @@
-package com.edgedb.driver.binary.codecs;
+package com.gel.driver.binary.codecs;
import java.util.Collection;
diff --git a/src/driver/src/main/java/com/edgedb/driver/binary/codecs/CompoundCodec.java b/src/driver/src/main/java/com/gel/driver/binary/codecs/CompoundCodec.java
similarity index 79%
rename from src/driver/src/main/java/com/edgedb/driver/binary/codecs/CompoundCodec.java
rename to src/driver/src/main/java/com/gel/driver/binary/codecs/CompoundCodec.java
index aa124946..f86da11f 100644
--- a/src/driver/src/main/java/com/edgedb/driver/binary/codecs/CompoundCodec.java
+++ b/src/driver/src/main/java/com/gel/driver/binary/codecs/CompoundCodec.java
@@ -1,17 +1,17 @@
-package com.edgedb.driver.binary.codecs;
+package com.gel.driver.binary.codecs;
-import com.edgedb.driver.binary.PacketReader;
-import com.edgedb.driver.binary.PacketWriter;
-import com.edgedb.driver.binary.protocol.common.descriptors.CodecMetadata;
-import com.edgedb.driver.binary.protocol.common.descriptors.TypeOperation;
-import com.edgedb.driver.exceptions.EdgeDBException;
+import com.gel.driver.binary.PacketReader;
+import com.gel.driver.binary.PacketWriter;
+import com.gel.driver.binary.protocol.common.descriptors.CodecMetadata;
+import com.gel.driver.binary.protocol.common.descriptors.TypeOperation;
+import com.gel.driver.exceptions.GelException;
import org.jetbrains.annotations.Nullable;
import javax.naming.OperationNotSupportedException;
import java.util.Collection;
import java.util.UUID;
-import static com.edgedb.driver.util.BinaryProtocolUtils.INT_SIZE;
+import static com.gel.driver.util.BinaryProtocolUtils.INT_SIZE;
public class CompoundCodec extends CodecBase