Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ug-dbg/yop
YOP is a lightweight ORM wannabe. Hit and run, no session, no bytecode generation, SQL-like syntax with method references.
https://github.com/ug-dbg/yop
crud java java-8 lightweight orm yop
Last synced: about 1 month ago
JSON representation
YOP is a lightweight ORM wannabe. Hit and run, no session, no bytecode generation, SQL-like syntax with method references.
- Host: GitHub
- URL: https://github.com/ug-dbg/yop
- Owner: ug-dbg
- Created: 2018-03-13T09:26:18.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-04-23T09:07:47.000Z (over 5 years ago)
- Last Synced: 2024-09-29T23:05:54.104Z (about 2 months ago)
- Topics: crud, java, java-8, lightweight, orm, yop
- Language: Java
- Size: 3.14 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# YOP !
YOP is an **[ORM](https://en.wikipedia.org/wiki/Object-relational_mapping "Wikipedia → ORM") tool**.
And since I am such a nice guy, a [REST](https://en.wikipedia.org/wiki/Representational_state_transfer "Wikipedia → REST") stack is built on top of it.## Status
[![Build Status](http://hdmcl.no-ip.org:8081/job/yop-test-MySQL/badge/icon)](http://jenkins.y-op.org/job/yop-test-MySQL/)
Modules :
- [![Coverage](http://hdmcl.no-ip.org:8081/job/yop-test-MySQL/ws/reflection/target/jacoco.svg)](http://jenkins.y-op.org/job/yop-test-MySQL/lastBuild/jacoco)
[reflection](reflection/README.md "The reflection module README")
- [![Coverage](http://hdmcl.no-ip.org:8081/job/yop-test-MySQL/ws/orm/target/jacoco.svg)](http://jenkins.y-op.org/job/yop-test-MySQL/lastBuild/jacoco)
[orm](orm/README.md "The orm module README")
- [![Coverage](http://hdmcl.no-ip.org:8081/job/yop-test-MySQL/ws/ioc/target/jacoco.svg)](http://jenkins.y-op.org/job/yop-test-MySQL/lastBuild/jacoco)
[ioc](ioc/README.md "The ioc module README")
- [![Coverage](http://hdmcl.no-ip.org:8081/job/yop-test-MySQL/ws/rest/target/jacoco.svg)](http://jenkins.y-op.org/job/yop-test-MySQL/lastBuild/jacoco)
[rest](rest/README.md "The rest module README")
- [![Coverage](http://hdmcl.no-ip.org:8081/job/yop-test-MySQL/ws/swaggerui/target/jacoco.svg)](http://jenkins.y-op.org/job/yop-test-MySQL/lastBuild/jacoco)
[swaggerui](swaggerui/README.md "The swaggerui module README")
- [demo](demo/README.md "The demo module README")
## Maven
Yop modules are available on Maven central :
```xmlorg.y-op
reflection
0.9.0```
```xmlorg.y-op
ioc
0.9.0```
```xmlorg.y-op
orm
0.9.0```
```xmlorg.y-op
rest
0.9.0```
```xmlorg.y-op
swaggerui
0.9.0```
## About
Yop is an **ORM tool** with a conventional REST webservice Servlet.
Webservices are described using
[OpenAPI specifications](https://en.wikipedia.org/wiki/OpenAPI_Specification "Wikipedia → OpenAPI specification")## Structure :
The [ORM](orm) module brings a set of query builders with an SQL like syntax :```
Select
.from(Library.class)
.join(Library::getAuthors, Author::getBooks, Book::getChapters)
.join(Library::getEmployees)
.execute(connection);
```
The [REST](rest) module brings a set of annotations to directly expose the data objects as REST resources :
```
@Rest(
path="book",
summary = "Rest resource for books !",
description = "A collection of sheets of paper bound together to hinge at one edge."
)
@Table(name="book")
public class Book implements Yopable {}
```A REST servlet can expose the data objects as REST resources :
```
Wrapper wrapper = Tomcat.addServlet(context, YopRestServlet.class.getSimpleName(), new YopRestServlet());// The data objects packages exposed as REST resources
wrapper.addInitParameter(YopRestServlet.PACKAGE_INIT_PARAM, "org.yop");// The datasource JNDI name (or you can override the 'getConnection' method)
wrapper.addInitParameter(YopRestServlet.DATASOURCE_JNDI_INIT_PARAM, "datasource");// The exposition path for the data objects REST resources
context.addServletMappingDecoded("/yop/rest/*", YopRestServletWithConnection.class.getSimpleName());
```The [OpenAPI](https://www.openapis.org/ "Open API initiative") description of data objects can be generated
and exposed using a Servlet :
```
Wrapper wrapper = Tomcat.addServlet(context, OpenAPIServlet.class.getSimpleName(), new OpenAPIServlet());// The data objects packages exposed as REST resources
wrapper.addInitParameter(OpenAPIServlet.PACKAGE_INIT_PARAM, "org.yop");// The exposition path for the data objects REST resources
wrapper.addInitParameter(OpenAPIServlet.EXPOSITION_PATH_PARAM, "/yop/rest");// The exposition path for the generated OpenAPI description of the data objects REST resources
context.addServletMappingDecoded("/yop/openapi", OpenAPIServlet.class.getSimpleName());
```## Miscellaneous / Philosophy
- Data objects describe their REST and/or ORM features.
- CRUD behavior in REST services is conventional.
- Data objects carry any extra CRUD behavior (i.e beyond conventional) to be exposed in REST services.
- Explicit CRUD can be achieved using the orm module in an SQL like syntax.
- [DAO pattern](https://en.wikipedia.org/wiki/Data_access_object "Wikipedia → DAO") sucks.
- [DTO pattern](https://en.wikipedia.org/wiki/Data_transfer_object "Wikipedia → DTO") sucks.
- YOP naively aims at being a straightforward **Model-Driven ORM/REST** stack.