Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add KeyValue Couchbase Support #31

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
91360c7
build: create module for keyvalue coachbase support
dearrudam Jul 15, 2023
7aac19e
feat: add quarkus-jnosql-keyvalue-couchbase src files
dearrudam Jul 15, 2023
9fe185d
feat: add quarkus-jnosql-keyvalue-couchbase-deployment source files
dearrudam Jul 15, 2023
e4835d3
feat: add quarkus-jnosql-keyvalue-couchbase-integration-tests source …
dearrudam Jul 15, 2023
55efccb
docs: add documentation for the quarkus-jnosql-keyvalue-couchbase ext…
dearrudam Jul 15, 2023
4270a90
refactor: fix file format
dearrudam Jul 15, 2023
7399460
refactor: fix package import order and code format fixes
dearrudam Jul 15, 2023
070b399
docs: change README.md
dearrudam Jul 15, 2023
0a14510
Merge branch 'master' into keyvalue-couchbase-support
dearrudam Jul 17, 2023
05df7b6
refactor: add warn message during native-compilation
dearrudam Jul 18, 2023
4ad5601
tests: remove unnecessary IT class by now
dearrudam Jul 18, 2023
16ba796
build: add camel-quarkus-bom
dearrudam Jul 18, 2023
7a03d0c
build: add camel-quarkus-core-deployment
dearrudam Jul 18, 2023
9989381
build: add camel-quarkus-core
dearrudam Jul 18, 2023
2d05194
chore: add warn when native-compilation happens
dearrudam Jul 18, 2023
7db1584
Merge branch 'master' into keyvalue-couchbase-support
dearrudam Jul 18, 2023
43520fd
build: fix pom managed dependencies declaration
dearrudam Jul 18, 2023
a987022
chore: added JvmOnlyRecorder to warn extension doesn't support native…
dearrudam Jul 19, 2023
a815ca2
build: remove unnecessary dependencies
dearrudam Jul 19, 2023
4db76ed
ci: added CI step to ignore modules that do not support native-compil…
dearrudam Jul 19, 2023
92857af
Merge branch 'master' into keyvalue-couchbase-support
dearrudam Jul 19, 2023
2e7ef58
chore: change warn message
dearrudam Jul 19, 2023
bf4e390
Merge branch 'keyvalue-couchbase-support' of github.com:dearrudam/qua…
dearrudam Jul 19, 2023
65ed56b
chore: fix import order
dearrudam Jul 19, 2023
7293247
docs: add info about modules that doens't native-compilation support
dearrudam Jul 19, 2023
9d38b4b
chore: move JvmOnlyRecord.java to the extension's runtime module
dearrudam Jul 19, 2023
d55b7ad
chore: fix import order
dearrudam Jul 19, 2023
f6bb752
Merge branch 'master' into keyvalue-couchbase-support
dearrudam Jul 21, 2023
a2c5b9c
Merge branch 'master' into keyvalue-couchbase-support
dearrudam Aug 2, 2023
e78507a
Merge branch 'master' into keyvalue-couchbase-support
dearrudam Aug 16, 2023
81f7a85
chore: bump couchbase-parent.version to 3.2.2.0
dearrudam Aug 16, 2023
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
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,8 @@ jobs:
- name: Build with Maven
run: mvn -B clean verify -Dno-format

- name: Ignoring modules that do not support native-compilation
run: sed -i -e '/<module>couchbase\-parent<\/module>/d' keyvalue-parent/pom.xml

- name: Build with Maven (Native)
run: mvn -B verify -Dnative -Dquarkus.native.container-build -Dnative.surefire.skip
94 changes: 69 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# Quarkus JNoSQL

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

[![Version](https://img.shields.io/maven-central/v/io.quarkiverse.jnosql/quarkus-jnosql-core?logo=apache-maven&style=flat-square)](https://search.maven.org/artifact/io.quarkiverse.jnosql/quarkus-jnosql-core)

The Quarkus JNoSql Extension adds support for
The Quarkus JNoSql Extension adds support for
[JNoSQL](http://www.jnosql.org/), an implementation of [Jakarta NoSQL](https://jakarta.ee/specifications/nosql/).

:information_source: **Recommended Quarkus version: `3.2.2.Final` or higher**

### Usage
### Jakarta NoSQL Entity Mapping Sample

```java
import jakarta.nosql.Column;
Expand All @@ -19,61 +20,66 @@ import jakarta.nosql.Id;

@Entity
public class TestEntity {

@Id
private String id;

@Column
private String testField;
}
```

## KeyValue

### Configuration
### Required Configuration

The JNoSql KeyValue Quarkus extension supports the following configuration:

| Name | Type | Default |
|---|---|---|
| `jnosql.keyvalue.database`<br>The database's name. | string | |
| Name | Description | Type | Default |
|----------------------------|---------------------|--------|---------|
| `jnosql.keyvalue.database` | The database's name | string | |

### Usage

```java
@Inject
private KeyValueTemplate template;

public void insert(TestEntity entity) {
template.insert(entity);
}
public void insert(TestEntity entity){
template.insert(entity);
}
```

### ArangoDB

Add the dependency to the target project:

```xml

<dependency>
<groupId>io.quarkiverse.jnosql</groupId>
<artifactId>quarkus-jnosql-keyvalue-arangodb</artifactId>
</dependency>
```

Please refer to the [AranboDB JNoSQL driver](https://github.com/eclipse/jnosql-databases#arangodb) for specific configuration.
Please refer to the [AranboDB JNoSQL driver](https://github.com/eclipse/jnosql-databases#arangodb) for specific
configuration.

### DynamoDB

Add the dependency to the target project:

```xml

<dependency>
<groupId>io.quarkiverse.jnosql</groupId>
<artifactId>quarkus-jnosql-keyvalue-dynamodb</artifactId>
</dependency>
```

Please refer to the [DynamoDB Quarkiverse extension](https://quarkiverse.github.io/quarkiverse-docs/quarkus-amazon-services/dev/amazon-dynamodb.html) for specific configuration.
Please refer to
the [DynamoDB Quarkiverse extension](https://quarkiverse.github.io/quarkiverse-docs/quarkus-amazon-services/dev/amazon-dynamodb.html)
for specific configuration.

### Hazelcast

Expand All @@ -93,6 +99,7 @@ Please refer to the [Quarkus Hazelcast extension](https://github.com/hazelcast/q
Add the dependency to the target project:

```xml

<dependency>
<groupId>io.quarkiverse.jnosql</groupId>
<artifactId>quarkus-jnosql-keyvalue-redis</artifactId>
Expand All @@ -101,39 +108,69 @@ Add the dependency to the target project:

Please refer to the [Redis Quarkus extension](https://quarkus.io/guides/redis-reference) for specific configuration.

### Couchbase

Add the dependency to the target project:

:warning: **This extension doesn't support native-compilation**

```xml
<dependency>
<groupId>io.quarkiverse.jnosql</groupId>
<artifactId>quarkus-jnosql-keyvalue-couchbase</artifactId>
</dependency>
```

#### Required Configuration

This JNoSql KeyValue Quarkus extension for Couchbase supports the following configuration:

| Name | Description | Type | Default |
|-----------------------------|-----------------------|--------|---------|
| `jnosql.couchbase.host` | the connection string | string | |
| `jnosql.couchbase.user` | The username [^0] | string | |
| `jnosql.couchbase.password` | The password [^0] | string | |
| `jnosql.couchbase.password` | The password [^0] | string | |

[^0]: Pay attention to the way the sensitive variables are stored in order to avoid data leakage and security flaws.

Please, take a look at the [Eclipse JNoSQL Database API for Couchbase documentation](https://github.com/eclipse/jnosql-databases#configuration-2) to learn more about all supported properties.

## Document

### Configuration

The JNoSql Document Quarkus extension supports the following configuration:

| Name | Type | Default |
|---|---|---|
| `jnosql.document.database`<br>The database's name. | string | |
| Name | Type | Default |
|----------------------------------------------------|--------|---------|
| `jnosql.document.database`<br>The database's name. | string | |

### Usage

```java
@Inject
private DocumentTemplate template;

public void insert(TestDocumentEntity entity) {
template.insert(entity);
}
public void insert(TestDocumentEntity entity){
template.insert(entity);
}
```

### ArangoDB

Add the dependency to the target project:

```xml

<dependency>
<groupId>io.quarkiverse.jnosql</groupId>
<artifactId>quarkus-jnosql-document-arangodb</artifactId>
</dependency>
```

Please refer to the [AranboDB JNoSQL driver](https://github.com/eclipse/jnosql-databases#arangodb) for specific configuration.
Please refer to the [AranboDB JNoSQL driver](https://github.com/eclipse/jnosql-databases#arangodb) for specific
configuration.

### CouchDB

Expand All @@ -153,19 +190,23 @@ Please refer to the [CouchDB JNoSQL driver](https://github.com/eclipse/jnosql-da
Add the dependency to the target project:

```xml

<dependency>
<groupId>io.quarkiverse.jnosql</groupId>
<artifactId>quarkus-jnosql-document-elasticsearch</artifactId>
</dependency>
```

Please refer to the [Elasticsearch Quarkus extension](https://quarkus.io/guides/elasticsearch#using-the-elasticsearch-java-client) for specific configuration.
Please refer to
the [Elasticsearch Quarkus extension](https://quarkus.io/guides/elasticsearch#using-the-elasticsearch-java-client) for
specific configuration.

### MongoDB

Add the dependency to the target project:

```xml

<dependency>
<groupId>io.quarkiverse.jnosql</groupId>
<artifactId>quarkus-jnosql-document-mongodb</artifactId>
Expand Down Expand Up @@ -193,15 +234,16 @@ Please refer to the [Solr JNoSQL driver](https://github.com/eclipse/jnosql-datab

The JNoSql Column Quarkus extension supports the following configuration:

| Name | Type | Default |
|--------------------------------------------------|---|---|
| `jnosql.column.database`<br>The database's name. | string | |
| Name | Type | Default |
|--------------------------------------------------|--------|---------|
| `jnosql.column.database`<br>The database's name. | string | |

### Cassandra

Add the dependency to the target project:

```xml

<dependency>
<groupId>io.quarkiverse.jnosql</groupId>
<artifactId>quarkus-jnosql-column-cassandra</artifactId>
Expand Down Expand Up @@ -230,4 +272,6 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification.
Contributions of any kind welcome!

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package io.quarkiverse.jnosql.core.runtime;

import org.jboss.logging.Logger;

import io.quarkus.runtime.annotations.Recorder;

@Recorder
public class JvmOnlyRecorder {

private static final Logger LOG = Logger.getLogger(JvmOnlyRecorder.class);

public JvmOnlyRecorder() {
}

public static void warnJvmInNative(Logger log, String feature) {
log.warnf(
"The %s extension was not tested in native mode. You may want to report about the success or failure running it in native mode on https://github.com/quarkiverse/quarkus-jnosql/issues?q=is:issue+%s",
feature, feature.replace('-', '+'));
}

public void warnJvmInNative(String feature) {
warnJvmInNative(LOG, feature);
}
}
49 changes: 49 additions & 0 deletions keyvalue-parent/couchbase-parent/deployment/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.quarkiverse.jnosql</groupId>
<artifactId>quarkus-jnosql-keyvalue-couchbase-parent</artifactId>
<version>3.2.2.0</version>
</parent>
<artifactId>quarkus-jnosql-keyvalue-couchbase-deployment</artifactId>
<name>Quarkus JNoSQL - KeyValue - Couchbase - Deployment</name>
<dependencies>
<dependency>
<groupId>io.quarkiverse.jnosql</groupId>
<artifactId>quarkus-jnosql-core-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.jnosql</groupId>
<artifactId>quarkus-jnosql-keyvalue-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkiverse.jnosql</groupId>
<artifactId>quarkus-jnosql-keyvalue-couchbase</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5-internal</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-extension-processor</artifactId>
<version>${quarkus.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package io.quarkiverse.jnosql.keyvalue.couchbase.deployment;

import org.eclipse.jnosql.databases.couchbase.communication.QuarkusCouchbaseKeyValueConfiguration;
import org.jboss.logging.Logger;

import io.quarkiverse.jnosql.core.runtime.JvmOnlyRecorder;
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.ExecutionTime;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.pkg.steps.NativeBuild;

class Processor {

private static final Logger LOG = Logger.getLogger(Processor.class);

private static final String FEATURE = "jnosql-keyvalue-couchbase";

@BuildStep
FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}

/**
* Remove this once this extension starts supporting the native mode.
*/
@BuildStep(onlyIf = NativeBuild.class)
@Record(value = ExecutionTime.RUNTIME_INIT)
void warnJvmInNative(JvmOnlyRecorder recorder) {
JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time
recorder.warnJvmInNative(FEATURE); // warn at runtime
}

@BuildStep
void build(BuildProducer<AdditionalBeanBuildItem> additionalBeanProducer) {
additionalBeanProducer.produce(AdditionalBeanBuildItem.unremovableOf(QuarkusCouchbaseKeyValueConfiguration.class));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package io.quarkiverse.jnosql.document.test;

import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.test.QuarkusDevModeTest;

public class JNoSQLDevModeTest {

// Start hot reload (DevMode) test with your extension loaded
@RegisterExtension
static final QuarkusDevModeTest devModeTest = new QuarkusDevModeTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class));

@Test
public void writeYourOwnDevModeTest() {
// Write your dev mode tests here - see the testing extension guide https://quarkus.io/guides/writing-extensions#testing-hot-reload for more information
Assertions.assertTrue(true, "Add dev mode assertions to " + getClass().getName());
}
}
Loading