Skip to content

Commit cf2b334

Browse files
committed
feat: update and rebase codebase
Signed-off-by: Otavio Santana <[email protected]>
2 parents 9f813db + 949208d commit cf2b334

File tree

195 files changed

+12081
-596
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

195 files changed

+12081
-596
lines changed

CHANGELOG.adoc

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,56 @@ and this project adheres to https://semver.org/spec/v2.0.0.html[Semantic Version
88

99
== [Unreleased]
1010

11+
== [1.1.4] - 2024-10-24
12+
13+
== Changes
14+
15+
- Update API using Apache Tinkerpop
16+
- Update package name of Graph to Tinkerpop
17+
18+
== Fixed
19+
20+
- MongoDB conversions applied also to other databases
21+
22+
== [1.1.3] - 2024-10-24
23+
24+
=== Added
25+
26+
- Added Redis Sentinel and Redis Cluster configuration at JNoSQL Redis Database API
27+
28+
=== Fixed
29+
30+
- Fixed the broken connection issue at JNoSQL Redis Database API
31+
- Use `getAccessibleDatabases` method to get the databases at JNoSQL ArangoDB Database API
32+
33+
== [1.1.2] - 2023-09-15
34+
35+
=== Added
36+
37+
- Include between query support at MongoDB
38+
- Include Graph as Apache TinkerPop
39+
- Include UUID support to MongoDB
40+
41+
=== Changed
42+
43+
- Upgrade AraongDB driver to 7.7.1
44+
- Upgrade Couchbase to version 3.7.1
45+
- Upgrade dynamodb to version 2.27.2
46+
- Upgrade Elasticsearch to version 8.14.3
47+
- Upgrade Hazelcast to version 5.5.0
48+
- Upgrade Hbase version to 2.6.0
49+
- Upgrade Infinispan to version 15.0.7.Final
50+
- Upgrade MongoDB to version 5.1.3
51+
- Upgrade Oracle NoSQL to version 5.4.15
52+
- Upgrade OrientDB to version 3.2.32
53+
- Upgrade Redis to version 5.1.4
54+
- Upgrade Solr to version 9.6.1
55+
56+
== Fixed
57+
58+
- Fixed the support to negation queries on the Eclipse JNoSQL layer to MongoDB
59+
- Fixed the precedence of NOT operator in AQL query generation on the Eclipse JNoSQL layer to ArangoDB
60+
1161
== [1.1.1] - 2023-05-25
1262

1363
=== Changed

README.adoc

Lines changed: 267 additions & 49 deletions
Large diffs are not rendered by default.

jnosql-arangodb/pom.xml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
<parent>
2222
<groupId>org.eclipse.jnosql.databases</groupId>
2323
<artifactId>jnosql-databases-parent</artifactId>
24-
<version>1.1.2-SNAPSHOT</version>
24+
<version>1.1.5-SNAPSHOT</version>
2525
</parent>
2626

2727
<artifactId>jnosql-arangodb</artifactId>
2828
<description>The Eclipse JNoSQL layer to ArangoDB</description>
2929

3030
<properties>
31-
<arango.driver>7.6.0</arango.driver>
31+
<arango.driver>7.15.0</arango.driver>
3232
</properties>
3333
<dependencies>
3434
<dependency>
@@ -46,8 +46,14 @@
4646
</dependency>
4747
<dependency>
4848
<groupId>com.arangodb</groupId>
49-
<artifactId>arangodb-java-driver</artifactId>
49+
<artifactId>arangodb-java-driver-shaded</artifactId>
5050
<version>${arango.driver}</version>
5151
</dependency>
52+
<dependency>
53+
<groupId>org.slf4j</groupId>
54+
<artifactId>slf4j-simple</artifactId>
55+
<version>2.0.16</version>
56+
<scope>test</scope>
57+
</dependency>
5258
</dependencies>
5359
</project>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright (c) 2022 Contributors to the Eclipse Foundation
3+
* All rights reserved. This program and the accompanying materials
4+
* are made available under the terms of the Eclipse Public License v1.0
5+
* and Apache License v2.0 which accompanies this distribution.
6+
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
7+
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
8+
*
9+
* You may elect to redistribute this code under either of these licenses.
10+
*
11+
* Contributors:
12+
*
13+
* Michele Rastelli
14+
*/
15+
package org.eclipse.jnosql.databases.arangodb.communication;
16+
17+
import com.arangodb.ArangoDB;
18+
19+
public interface ArangoDBAccessor {
20+
21+
/**
22+
* Accessor for the underlying ArangoDB driver instance.
23+
*
24+
* @return the {@link ArangoDB} instance
25+
*/
26+
ArangoDB getArangoDB();
27+
28+
}

jnosql-arangodb/src/main/java/org/eclipse/jnosql/databases/arangodb/communication/ArangoDBBucketManager.java

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111
* Contributors:
1212
*
1313
* Otavio Santana
14+
* Michele Rastelli
1415
*/
1516
package org.eclipse.jnosql.databases.arangodb.communication;
1617

1718

1819
import com.arangodb.ArangoDB;
19-
import com.arangodb.entity.BaseDocument;
20+
import jakarta.json.Json;
21+
import jakarta.json.JsonObject;
2022
import jakarta.json.bind.Jsonb;
2123
import org.eclipse.jnosql.communication.Value;
2224
import org.eclipse.jnosql.communication.driver.JsonbSupplier;
@@ -38,11 +40,12 @@
3840
* <p>{@link BucketManager#put(Iterable, Duration)}</p>
3941
* <p>{@link BucketManager#put(Iterable, Duration)}</p>
4042
*/
41-
public class ArangoDBBucketManager implements BucketManager {
43+
public class ArangoDBBucketManager implements BucketManager, ArangoDBAccessor {
4244

4345

46+
private static final String KEY = "_key";
4447
private static final String VALUE = "_value";
45-
private static final Function<BaseDocument, String> TO_JSON = e -> e.getAttribute(VALUE).toString();
48+
private static final Function<JsonObject, String> TO_JSON = e -> e.getString(VALUE);
4649
private static final Jsonb JSONB = JsonbSupplier.getInstance().get();
4750

4851
private final ArangoDB arangoDB;
@@ -66,14 +69,15 @@ public String name() {
6669
public <K, V> void put(K key, V value) throws NullPointerException {
6770
Objects.requireNonNull(key, "Key is required");
6871
Objects.requireNonNull(value, "value is required");
69-
BaseDocument baseDocument = new BaseDocument();
70-
baseDocument.setKey(key.toString());
71-
baseDocument.addAttribute(VALUE, JSONB.toJson(value));
72+
JsonObject jsonObject = Json.createObjectBuilder()
73+
.add(KEY, key.toString())
74+
.add(VALUE, JSONB.toJson(value))
75+
.build();
7276
if (arangoDB.db(bucketName).collection(namespace).documentExists(key.toString())) {
7377
arangoDB.db(bucketName).collection(namespace).deleteDocument(key.toString());
7478
}
7579
arangoDB.db(bucketName).collection(namespace)
76-
.insertDocument(baseDocument);
80+
.insertDocument(jsonObject);
7781
}
7882

7983
@Override
@@ -91,8 +95,8 @@ public void put(Iterable<KeyValueEntity> keyValueEntities) throws NullPointerEx
9195
@Override
9296
public <K> Optional<Value> get(K key) throws NullPointerException {
9397
Objects.requireNonNull(key, "Key is required");
94-
BaseDocument entity = arangoDB.db(bucketName).collection(namespace)
95-
.getDocument(key.toString(), BaseDocument.class);
98+
JsonObject entity = arangoDB.db(bucketName).collection(namespace)
99+
.getDocument(key.toString(), JsonObject.class);
96100

97101
return ofNullable(entity)
98102
.map(TO_JSON)
@@ -105,7 +109,7 @@ public <K> Iterable<Value> get(Iterable<K> keys) throws NullPointerException {
105109
return stream(keys.spliterator(), false)
106110
.map(Object::toString)
107111
.map(k -> arangoDB.db(bucketName).collection(namespace)
108-
.getDocument(k, BaseDocument.class))
112+
.getDocument(k, JsonObject.class))
109113
.filter(Objects::nonNull)
110114
.map(TO_JSON)
111115
.map(ValueJSON::of)
@@ -128,7 +132,7 @@ public <K> void delete(Iterable<K> keys) throws NullPointerException {
128132

129133
@Override
130134
public void close() {
131-
135+
arangoDB.shutdown();
132136
}
133137

134138
@Override
@@ -141,4 +145,9 @@ public void put(KeyValueEntity entity, Duration ttl) throws NullPointerException
141145
throw new UnsupportedOperationException("ArangoDB does not support TTL");
142146
}
143147

148+
@Override
149+
public ArangoDB getArangoDB() {
150+
return arangoDB;
151+
}
152+
144153
}

jnosql-arangodb/src/main/java/org/eclipse/jnosql/databases/arangodb/communication/ArangoDBBucketManagerFactory.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,24 @@
2323
import java.util.Set;
2424

2525
/**
26-
* The ArangoDB implementation to {@link BucketManagerFactory}
27-
* it does not support:
26+
* The ArangoDB implementation to {@link BucketManagerFactory}.
27+
* It does not support:
2828
* <p>{@link BucketManagerFactory#getMap(String, Class, Class)}</p>
2929
* <p>{@link BucketManagerFactory#getSet(String, Class)}</p>
3030
* <p>{@link BucketManagerFactory#getQueue(String, Class)}</p>
3131
* <p>{@link BucketManagerFactory#getList(String, Class)}</p>
32+
* <br/>
33+
* Closing an ArangoDBBucketManagerFactory has no effect. The ArangoDB driver instance will be closed in
34+
* ${@link ArangoDBBucketManager}.close().
3235
*/
3336
public class ArangoDBBucketManagerFactory implements BucketManagerFactory {
3437

3538
private static final String DEFAULT_NAMESPACE = "diana";
3639

37-
private final ArangoDB arangoDB;
40+
private final ArangoDBBuilder arangoDBBuilder;
3841

39-
ArangoDBBucketManagerFactory(ArangoDB arangoDB) {
40-
this.arangoDB = arangoDB;
42+
ArangoDBBucketManagerFactory(ArangoDBBuilder arangoDBBuilder) {
43+
this.arangoDBBuilder = arangoDBBuilder;
4144
}
4245

4346
@Override
@@ -46,6 +49,7 @@ public ArangoDBBucketManager apply(String bucketName) throws UnsupportedOperatio
4649
}
4750

4851
public ArangoDBBucketManager getBucketManager(String bucketName, String namespace) {
52+
ArangoDB arangoDB = arangoDBBuilder.build();
4953
ArangoDBUtil.checkCollection(bucketName, arangoDB, namespace);
5054
return new ArangoDBBucketManager(arangoDB, bucketName, namespace);
5155
}
@@ -70,10 +74,13 @@ public List getList(String bucketName, Class clazz) throws UnsupportedOperationE
7074
throw new UnsupportedOperationException("The ArangoDB does not support getList method");
7175
}
7276

77+
/**
78+
* Closing an {@link ArangoDBBucketManagerFactory} has no effect.
79+
* The ArangoDB driver instance will be closed in ${@link ArangoDBBucketManager}.close().
80+
*/
7381
@Override
7482
public void close() {
75-
arangoDB.shutdown();
83+
// no-op
7684
}
7785

78-
7986
}

jnosql-arangodb/src/main/java/org/eclipse/jnosql/databases/arangodb/communication/ArangoDBBuilder.java

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,59 @@
1414
*/
1515
package org.eclipse.jnosql.databases.arangodb.communication;
1616

17+
import com.arangodb.ArangoDB;
1718
import com.arangodb.Protocol;
1819
import com.arangodb.entity.LoadBalancingStrategy;
1920

20-
interface ArangoDBBuilder {
21+
public class ArangoDBBuilder {
2122

23+
private final ArangoDB.Builder arangoDB;
2224

23-
void host(String host, int port);
25+
ArangoDBBuilder(ArangoDB.Builder arangoDB) {
26+
this.arangoDB = arangoDB;
27+
}
2428

25-
void timeout(int timeout);
29+
public void host(String host, int port) {
30+
arangoDB.host(host, port);
31+
}
2632

27-
void user(String user);
33+
public void timeout(int timeout) {
34+
arangoDB.timeout(timeout);
35+
}
2836

29-
void password(String password);
37+
public void user(String user) {
38+
arangoDB.user(user);
39+
}
3040

31-
void useSsl(boolean useSsl);
41+
public void password(String password) {
42+
arangoDB.password(password);
43+
}
3244

33-
void chunkSize(int chunkSize);
45+
public void useSsl(boolean useSsl) {
46+
arangoDB.useSsl(useSsl);
47+
}
3448

35-
void maxConnections(int maxConnections);
49+
public void chunkSize(int chunkSize) {
50+
arangoDB.chunkSize(chunkSize);
51+
}
3652

37-
void protocol(Protocol protocol);
53+
public void maxConnections(int maxConnections) {
54+
arangoDB.maxConnections(maxConnections);
55+
}
3856

39-
void acquireHostList(boolean acquireHostList);
57+
public void protocol(Protocol protocol) {
58+
arangoDB.protocol(protocol);
59+
}
4060

41-
void loadBalancingStrategy(LoadBalancingStrategy loadBalancingStrategy);
61+
public void acquireHostList(boolean acquireHostList) {
62+
arangoDB.acquireHostList(acquireHostList);
63+
}
64+
65+
public void loadBalancingStrategy(LoadBalancingStrategy loadBalancingStrategy) {
66+
arangoDB.loadBalancingStrategy(loadBalancingStrategy);
67+
}
68+
69+
public ArangoDB build() {
70+
return arangoDB.build();
71+
}
4272
}

0 commit comments

Comments
 (0)