Skip to content

Simple Dropwizard GuicePersist application using MongoDB and Hibernate OGM as a NoSQL JPA implementation

Notifications You must be signed in to change notification settings

PauloPortugal/dropwizard-guice-mongodb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Codacy BadgeCoverage Status

Dropwizard Guice and MongoDB (JPA) application

This is a dockerized RESTful Dropwizard application, to provide an example on how to integrate MongoDB and JPA in Dropwizard, using dependency injection. This is using a Instead of using Morphia, MongoJack or MongoDB Java driver the decision was to investigate how to integrate MongoDB with JPA. Please read more about Hibernate OGM Reference Guide The example is a simple RESTful interface to easily manage a task planner.

  • using Dropwizard v1.1.0 framework
  • dependency injection achieve through Google Guice
  • JPA implementation through Hibernate OGM
  • FongoDB is an in-memory java implementation of MongoDB, intercepting call to the standard mongo-java-driver
  • API documentation provided by swagger.io and swagger UI
  • Docker as the containerisation solution
  • using Hate library as HATEOAS with HAL implementation

How to start the DropwizardGuice application

  1. Run mvn clean verify to build your application
  2. Start application with java -jar target/dropwizard-guice-1.0-SNAPSHOT-uber.jar server target/config.yml
  3. To check that the application is running enter url http://localhost:8080
  4. To interact with the application using Swagger UI endpoints enter url http://localhost:8080/swagger
  5. To run the application inside a docker container, ./docker-run.sh

API Paths

Creates a new task

POST /tasks

Description

Creates a new task. Task descriptions are not unique.

Parameters

Type Name Description Schema
Body body
required
payload A new task

Responses

HTTP Code Description Schema
201 Created A new task

Consumes

  • application/json

Produces

  • application/json

Get all the tasks

GET /tasks

Description

Returns all the tasks save on the database

Responses

HTTP Code Schema
200 < Task Entity > array

Produces

  • application/json

Get task by id

GET /tasks/{taskId}

Description

Returns task by Id. If it does not exist it will return a HTTP 404

Parameters

Type Name Description Schema
Path taskId
required
taskId string(uuid)

Responses

HTTP Code Description Schema
200 Task Entity
404 Not Found No Content

Produces

  • application/json

Updates task by id

PUT /tasks/{taskId}

Description

Updates a task description if available in the database

Parameters

Type Name Description Schema
Path taskId
required
taskId string(uuid)
Body body
required
payload A new task

Responses

HTTP Code Description Schema
200 Updated No Content
404 Not Found No Content

Consumes

  • application/json

Produces

  • application/json

Deletes task by id

DELETE /tasks/{taskId}

Description

Deletes a if available in the database

Parameters

Type Name Description Schema
Path taskId
required
taskId string(uuid)

Responses

HTTP Code Description Schema
204 No Content No Content
404 Not Found No Content

Consumes

  • application/json

Produces

  • application/json

About

Simple Dropwizard GuicePersist application using MongoDB and Hibernate OGM as a NoSQL JPA implementation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published