An open API service indexing awesome lists of open source software.

https://github.com/soujava/jnosql-rc1-sample


https://github.com/soujava/jnosql-rc1-sample

Last synced: 9 months ago
JSON representation

Awesome Lists containing this project

README

          

# Jakarta NoSQL Miliestone Version

Eclipse JNoSQL is a Java framework that streamlines the integration of Java applications with NoSQL databases. It defines a set of APIs and provides a standard implementation for most NoSQL databases. This clearly helps achieve very low coupling with the underlying NoSQL technologies used in applications. The objective of this session is to show how to use the Eclipse JNoSQL framework to connect with a NoSQL database and perform operations to manipulate and extract information.

## Requirements

* https://git-scm.com/book/en/v1/Getting-Started-Installing-Git[Git]
* http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html[Java 8]
* https://maven.apache.org/download.cgi[Maven 3 or higher Configured]
* https://docs.docker.com/install/#next-release[Docker 17.12.1-ce or higher]
* https://docs.docker.com/v17.09/compose/install/[Docker Compose 1.21.2 or higher]
* Any IDE that supports maven and Java 8
* https://www.eclipse.org/downloads/[Eclipse]
* https://netbeans.org/[NetBeans]
* https://www.jetbrains.com/idea/download/[IntelliJ]

## Servers

[cols="20%,80%", grid="none", frame="none", stripes="none"]
|===
|image:https://developers.redhat.com/blog/wp-content/uploads/2018/10/thorntail_vertical_rgb_600px_default.png[Thorntail,role="left", width="250"]
|Thorntail offers an innovative approach to packaging and running Java EE applications by packaging them with just enough of the server runtime to "java -jar" your application. It's MicroProfile compatible, too. And, it's all much, much cooler than that: https://thorntail.io/

|image:https://www.payara.fish/payara-site/media/gb/micro-logo-for-blue-fade-RGB.png[Payara,role="left", width="250"]
|Payara Micro is the open source, lightweight middleware platform of choice for containerized Java EE (Jakarta EE) microservices deployments. Less than 70MB in size, Payara Micro requires no installation or configuration and no need for code rewrites – so you can build and deploy a fully working app within minutes: https://www.payara.fish/software/payara-server/payara-micro/

|image:https://miro.medium.com/max/829/1*UorUp4zWjQfX3pE55qrtYQ.png[Helidon,role="left", width="250"]
|Helidon is a collection of Java libraries for writing microservices that run on a fast web core powered by Netty.: https://helidon.io/

|image:https://openliberty.io/img/twitter_card.jpg[Open Liberty,role="left", width="250"]
|A lightweight open framework for building fast and efficient cloud-native Java microservices.: https://openliberty.io/
|===

## Databases

[cols="20%,80%", grid="none", frame="none", stripes="none"]
|===
|image:https://i.dlpng.com/static/png/414627_preview.png[MongoDB, role="left", width="250"]
|MongoDB is a cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with schema. MongoDB is developed by MongoDB Inc. and licensed under the Server Side Public License

|image:https://upload.wikimedia.org/wikipedia/commons/thumb/5/5e/Cassandra_logo.svg/1280px-Cassandra_logo.svg.png[Cassandra, role="left", width="250"]
|Apache Cassandra is a free and open-source, distributed, wide column store, NoSQL database management system designed to handle large amounts of data across many commodity servers, providing high availability with no single point of failure.

|image:https://cdn.worldvectorlogo.com/logos/redis.svg[Redis, role="left", width="250"]
|Redis is an in-memory data structure project implementing a distributed, in-memory key-value database with optional durability.

|image:https://go.neo4j.com/rs/710-RRC-335/images/neo4j_logo.png[Neo4j, role="left", width="250"]
|Neo4j is a graph database management system developed by Neo4j, Inc. Described by its developers as an ACID-compliant transactional database with native graph storage and processing, Neo4j is the most popular graph database according to DB-Engines ranking, and the 22nd most popular database overall.
|===

## Run the code

* `git clone https://github.com/soujava/jnosql-rc1-sample.git`
* `cd oc1-hands-on-2018`
* `mvn clean install`
* Run databases
* Run Docker Compose

### Run as Docker-Compose

#### Start fresh environment

`docker-compose -f docker-compose.yml up -d`

#### Stop and Remove

`docker-compose -f docker-compose.yml down`

#### List services
`docker-compose -f docker-compose.yml ps`

## How to execute Helidon and Column API (Cassandra)

* `mvn -DskipTests clean package`
* `java -jar -Xmx512m target/column.jar`

### Insert Data

* `curl -X POST -H 'Content-Type: application/json' -i http://localhost:8080/heroes --data '{"id": "iron_man", "name": "Iron man", "powers": ["Rich", "Armor"]}'`

* `curl -X POST -H 'Content-Type: application/json' -i http://localhost:8080/heroes --data '{"id": "spider_man", "name": "Spider Man", "powers": ["Spider", "Strength", "Jump"]}'`

### Returning Data

* `curl -X GET -i http://localhost:8080/heroes`
* `curl -X GET -i http://localhost:8080/heroes/iron_man`

## How to execute Open Liberty and Document API (MongoDB)

* `mvn -DskipTests clean package`
* `java -jar -Xmx512m target/document.jar`

### Insert Data

* `curl -X POST -H 'Content-Type: application/json' -i http://localhost:9080/movies --data '{"id": "matriz", "name": "The Matrix", "year": 1999, "actors": [{"name": "Keanu Reeves", "character": "Neo"}, {"name": "Carrie-Anne Moss", "character": "Trinity"}, {"name": "Laurence Fishburne", "character": "Morpheus"}]}''`

* `curl -X POST -H 'Content-Type: application/json' -i http://localhost:9080/movies --data '{"id": "star_war_2", "name": "Star Wars: Episode II – Attack of the Clones", "year": 2002, "actors": [{"name": "Hayden Christensen", "character": "Darth Vader"}, {"name": "Portman", "character": "Padmé Amidala"},
{"name": "Ewan McGregor", "character": "Obi-Wan Kenobi"}]
}'`

### Returning Data

* `curl -X GET -i http://localhost:9080/movies`
* `curl -X GET -i http://localhost:9080/movies/matriz`

## How to execute Thorntail and Key-value API (Redis)

* `mvn -DskipTests clean package thorntail:package`
* `java -jar -Xmx512m target/key-value-thorntail.jar`

### Insert Data

* `curl -X POST -H 'Content-Type: application/json' -i http://localhost:8080/users/ --data '{"nick": "otaviojava", "email": "otavio@email.com", "settings": {"notification.email": "true", "language": "Portuguese"}}'`

### Returning Data

* `curl -X GET -i http://localhost:8080/users/otaviojava`

## How to execute Payara and Graph API (Neo4J)

* `mvn -DskipTests clean package payara-micro:bundle`
* `java -jar -Xmx512m target/graph-microbundle.jar`

### Insert Data

* `curl -X POST -H 'Content-Type: application/json' -i http://localhost:8080/animals/ --data '{"name": "lion"}'`
* `curl -X POST -H 'Content-Type: application/json' -i http://localhost:8080/animals/ --data '{"name": "zebra"}'`
* `curl -X POST -H 'Content-Type: application/json' -i http://localhost:8080/animals/ --data '{"name": "grass"}'`
* `curl -X POST -H 'Content-Type: application/json' -i http://localhost:8080/animals/ --data '{"name": "giraffe"}'`
* `curl -X POST -H 'Content-Type: application/json' -i http://localhost:8080/animals/lion/eats/zebra`
* `curl -X POST -H 'Content-Type: application/json' -i http://localhost:8080/animals/zebra/eats/grass`
* `curl -X POST -H 'Content-Type: application/json' -i http://localhost:8080/animals/giraffe/eats/grass`

### Returning Data

* `curl -X GET -i http://localhost:8080/animals/`