Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
fd9856c
New Types utility class, which replaces generated classes just to get…
Mar 4, 2020
f31309e
Refactored Converter class. Deprecated GroupedResult, PseudoType now …
Mar 5, 2020
862cc41
Reverted GroupedResult changes due to some Jackson implications.
Mar 5, 2020
ba0e662
Reverted GroupedResult changes due to some Jackson implications. Repl…
Mar 5, 2020
73a2a8e
Reverts decoder to MIME to avoid backwards incompatibility.
Mar 5, 2020
da2e191
Minor code changes
Mar 5, 2020
15051be
Merge pull request #26 from rethinkdb/feature/type-utils
Mar 5, 2020
f802597
Merge pull request #27 from rethinkdb/refactor/converter
Mar 5, 2020
eb2cad0
Refactored internal code.
Mar 5, 2020
5253763
Remove broken tests
Mar 5, 2020
85ab207
Merge pull request #29 from rethinkdb/refactor/internals
Mar 7, 2020
f7ec3c4
Merge pull request #30 from rethinkdb/fix/rm-broken-tests
Mar 7, 2020
157f822
Rewrite readCString to avoid possible handshake hanging
Mar 7, 2020
b902aff
Refactored HandshakeProtocol class, turned Crypto class into inner cl…
Mar 7, 2020
bb9ca0f
Inlined the entire Crypto class in the Handshake inner classes
Mar 7, 2020
3598a43
Fixed compile error
Mar 7, 2020
1ba081a
Made certFile parameter not-null
Mar 7, 2020
8680804
Small Connection refactor
Mar 7, 2020
7aa7dfd
Updated .gitignore
Mar 7, 2020
334fdc9
Merge pull request #33 from rethinkdb/refactor/connection
Mar 7, 2020
70b3380
Merge pull request #31 from rethinkdb/fix/handshake-hang
Mar 7, 2020
6ffb128
Merge pull request #32 from rethinkdb/refactor/handshakes
Mar 7, 2020
6d7c9e5
Refactored test framework
Mar 22, 2020
8b8f95e
Merge pull request #34 from rethinkdb/refactor/tests
Mar 22, 2020
a11bae2
Version bump
Mar 22, 2020
a8fc2c8
Update README.md
Mar 24, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build/
out/
.gradle/
.#*
*.iml
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![Maven Central](https://img.shields.io/maven-central/v/com.rethinkdb/rethinkdb-driver)](https://search.maven.org/artifact/com.rethinkdb/rethinkdb-driver)
[![Bintray](https://img.shields.io/bintray/v/rethinkdb/maven/rethinkdb-driver)](https://bintray.com/rethinkdb/maven/rethinkdb-driver/_latestVersion)
[![License](https://img.shields.io/github/license/rethinkdb/rethinkdb-java?color=lightgrey)](https://github.com/rethinkdb/rethinkdb-java/tree/master/LICENSE)
[![Travis-CI.org](https://img.shields.io/travis/rethinkdb/rethinkdb-java)](https://travis-ci.org/rethinkdb/rethinkdb-java)
[![Twitter](https://img.shields.io/twitter/url?style=social&url=https%3A%2F%2Fgithub.com%2Frethinkdb%2Frethinkdb-java)](https://twitter.com/intent/tweet?text=Wow:&url=https%3A%2F%2Fgithub.com%2Frethinkdb%2Frethinkdb-java)

Expand All @@ -23,14 +24,18 @@ Run `./gradlew assemble` to build the jar or `./gradlew install` to install it i

## Contributing to the driver

If you want to contribute to the driver, make sure to base your branch off of our **develop** branch (or a feature-branch)
and create your PR into that **same** branch. **We will be rejecting any PRs between branches or into release branches!**
It is very possible that your change might already be in development or you missed something.

### Installation

Besides JDK 8, to be able to contribute to the driver, you must also install:

* Python **3.6** or **3.7**
* PIP3 libraries:
* mako
* rethinkdb
* `mako`
* `rethinkdb`

### Using Gradle

Expand Down Expand Up @@ -105,6 +110,4 @@ These are also checked into git, so you don't need to run the conversion script

This section was moved to separate documentation:

> [How to deploy this repository to Bintray](DEPLOYING-BINTRAY.md)

> [How to deploy this repository to Maven Central (Sonatype)](DEPLOYING-SONATYPE.md)
> [How to deploy this repository to Bintray with integration with Maven Central (Sonatype)](DEPLOYING.md)
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ plugins {
id("com.jfrog.bintray") version "1.8.4"
}

version = "2.4.1.1"
version = "2.4.2"
group = "com.rethinkdb"

java.sourceCompatibility = JavaVersion.VERSION_1_8
Expand Down
36 changes: 0 additions & 36 deletions src/main/java/com/rethinkdb/RethinkDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,47 +17,11 @@ public class RethinkDB extends TopLevel {
* The Singleton to use to begin interacting with RethinkDB Driver
*/
public static final RethinkDB r = new RethinkDB();

/**
* Jackson's {@link ObjectMapper} for internal JSON handling from and to RethinkDB's internals.
*/
private static ObjectMapper internalMapper;
/**
* Jackson's {@link ObjectMapper} for handling {@link com.rethinkdb.net.Result}'s values.
*/
private static ObjectMapper resultMapper;

/**
* Gets (or creates, if null) the {@link ObjectMapper} for internal JSON handling from and to RethinkDB's internals.
* <br><br>
* <b>WARNING:If you're trying to get or configure the {@link com.rethinkdb.net.Result}'s mapper,
* use {@link RethinkDB#getResultMapper()} instead.</b>
*
* @return the internal {@link ObjectMapper}
*/
public synchronized static @NotNull ObjectMapper getInternalMapper() {
ObjectMapper mapper = internalMapper;
if (mapper == null) {
mapper = new ObjectMapper()
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
.enable(DeserializationFeature.USE_LONG_FOR_INTS);
internalMapper = mapper;
}
return mapper;
}

/**
* Sets the {@link ObjectMapper} for internal JSON handling from and to RethinkDB's internals.
* <br><br>
* <b>WARNING:If you're trying to set the {@link com.rethinkdb.net.Result}'s mapper,
* use {@link RethinkDB#setResultMapper(ObjectMapper)} instead.</b>
*
* @param mapper an {@link ObjectMapper}, or null
*/
public synchronized static void setInternalMapper(@Nullable ObjectMapper mapper) {
internalMapper = mapper;
}

/**
* Gets (or creates, if null) the {@link ObjectMapper} for handling {@link com.rethinkdb.net.Result}'s values.
*
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/rethinkdb/ast/Query.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.rethinkdb.gen.exc.ReqlRuntimeError;
import com.rethinkdb.gen.proto.QueryType;
import com.rethinkdb.model.OptArgs;
import com.rethinkdb.utils.Internals;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -49,7 +50,7 @@ public ByteBuffer serialize() {
if (!globalOptions.isEmpty()) {
list.add(ReqlAst.buildOptarg(globalOptions));
}
String json = RethinkDB.getInternalMapper().writeValueAsString(list);
String json = Internals.getInternalMapper().writeValueAsString(list);
byte[] bytes = json.getBytes(StandardCharsets.UTF_8);
ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES + Integer.BYTES + bytes.length)
.order(ByteOrder.LITTLE_ENDIAN)
Expand Down
36 changes: 9 additions & 27 deletions src/main/java/com/rethinkdb/ast/ReqlAst.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import com.rethinkdb.model.OptArgs;
import com.rethinkdb.net.Connection;
import com.rethinkdb.net.Result;
import com.rethinkdb.utils.Types;

import java.lang.reflect.Type;
import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -95,7 +95,7 @@ public Result<Object> run(Connection conn, Result.FetchMode fetchMode) {
* @return The result of this query
*/
public <T> Result<T> run(Connection conn, Class<T> typeRef) {
return conn.run(this, new OptArgs(), null, new ClassReference<>(typeRef));
return conn.run(this, new OptArgs(), null, Types.of(typeRef));
}

/**
Expand Down Expand Up @@ -135,7 +135,7 @@ public Result<Object> run(Connection conn, OptArgs runOpts, Result.FetchMode fet
* @return The result of this query
*/
public <T> Result<T> run(Connection conn, OptArgs runOpts, Class<T> typeRef) {
return conn.run(this, runOpts, null, new ClassReference<>(typeRef));
return conn.run(this, runOpts, null, Types.of(typeRef));
}

/**
Expand Down Expand Up @@ -163,7 +163,7 @@ public <T> Result<T> run(Connection conn, OptArgs runOpts, TypeReference<T> type
* @return The result of this query
*/
public <T> Result<T> run(Connection conn, Result.FetchMode fetchMode, Class<T> typeRef) {
return conn.run(this, new OptArgs(), fetchMode, new ClassReference<>(typeRef));
return conn.run(this, new OptArgs(), fetchMode, Types.of(typeRef));
}

/**
Expand Down Expand Up @@ -192,7 +192,7 @@ public <T> Result<T> run(Connection conn, Result.FetchMode fetchMode, TypeRefere
* @return The result of this query
*/
public <T> Result<T> run(Connection conn, OptArgs runOpts, Result.FetchMode fetchMode, Class<T> typeRef) {
return conn.run(this, runOpts, fetchMode, new ClassReference<>(typeRef));
return conn.run(this, runOpts, fetchMode, Types.of(typeRef));
}

/**
Expand Down Expand Up @@ -254,7 +254,7 @@ public CompletableFuture<Result<Object>> runAsync(Connection conn, Result.FetchM
* @return The result of this query
*/
public <T> CompletableFuture<Result<T>> runAsync(Connection conn, Class<T> typeRef) {
return conn.runAsync(this, new OptArgs(), null, new ClassReference<>(typeRef));
return conn.runAsync(this, new OptArgs(), null, Types.of(typeRef));
}

/**
Expand Down Expand Up @@ -294,7 +294,7 @@ public CompletableFuture<Result<Object>> runAsync(Connection conn, OptArgs runOp
* @return The result of this query
*/
public <T> CompletableFuture<Result<T>> runAsync(Connection conn, OptArgs runOpts, Class<T> typeRef) {
return conn.runAsync(this, runOpts, null, new ClassReference<>(typeRef));
return conn.runAsync(this, runOpts, null, Types.of(typeRef));
}

/**
Expand Down Expand Up @@ -322,7 +322,7 @@ public <T> CompletableFuture<Result<T>> runAsync(Connection conn, OptArgs runOpt
* @return The result of this query
*/
public <T> CompletableFuture<Result<T>> runAsync(Connection conn, Result.FetchMode fetchMode, Class<T> typeRef) {
return conn.runAsync(this, new OptArgs(), fetchMode, new ClassReference<>(typeRef));
return conn.runAsync(this, new OptArgs(), fetchMode, Types.of(typeRef));
}

/**
Expand Down Expand Up @@ -351,7 +351,7 @@ public <T> CompletableFuture<Result<T>> runAsync(Connection conn, Result.FetchMo
* @return The result of this query
*/
public <T> CompletableFuture<Result<T>> runAsync(Connection conn, OptArgs runOpts, Result.FetchMode fetchMode, Class<T> typeRef) {
return conn.runAsync(this, runOpts, fetchMode, new ClassReference<>(typeRef));
return conn.runAsync(this, runOpts, fetchMode, Types.of(typeRef));
}

/**
Expand Down Expand Up @@ -438,22 +438,4 @@ private void astToString(StringBuilder builder, String name, String indent, bool
}
}
}

/**
* A TypeReference that accepts an class instead of compiler type information.
*
* @param <T> the type referred to.
*/
private static class ClassReference<T> extends TypeReference<T> {
private Class<T> c;

ClassReference(Class<T> c) {
this.c = c;
}

@Override
public Type getType() {
return c;
}
}
}
141 changes: 0 additions & 141 deletions src/main/java/com/rethinkdb/ast/Util.java

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/java/com/rethinkdb/gen/ast/Add.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class Add extends ReqlExpr {
public Add(Object arg) {
this(new Arguments(arg), null);
}
public Add(Arguments args){
public Add(Arguments args) {
this(args, null);
}
public Add(Arguments args, OptArgs optargs) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/rethinkdb/gen/ast/And.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class And extends ReqlExpr {
public And(Object arg) {
this(new Arguments(arg), null);
}
public And(Arguments args){
public And(Arguments args) {
this(args, null);
}
public And(Arguments args, OptArgs optargs) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/rethinkdb/gen/ast/Append.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class Append extends ReqlExpr {
public Append(Object arg) {
this(new Arguments(arg), null);
}
public Append(Arguments args){
public Append(Arguments args) {
this(args, null);
}
public Append(Arguments args, OptArgs optargs) {
Expand Down
Loading