yop

YOP is a lightweight wannabe REST/ORM stack. Ω≡{Ⓐ}

License

License

Postcard Public License
GroupId

GroupId

org.y-op
ArtifactId

ArtifactId

yop
Last Version

Last Version

0.9.0
Release Date

Release Date

Type

Type

jar
Description

Description

yop
YOP is a lightweight wannabe REST/ORM stack. Ω≡{Ⓐ}
Project URL

Project URL

https://github.com/ug-dbg/yop
Source Code Management

Source Code Management

https://github.com/ug-dbg/yop

Download yop

How to add to project

<!-- https://jarcasting.com/artifacts/org.y-op/yop/ -->
<dependency>
    <groupId>org.y-op</groupId>
    <artifactId>yop</artifactId>
    <version>0.9.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.y-op/yop/
implementation 'org.y-op:yop:0.9.0'
// https://jarcasting.com/artifacts/org.y-op/yop/
implementation ("org.y-op:yop:0.9.0")
'org.y-op:yop:jar:0.9.0'
<dependency org="org.y-op" name="yop" rev="0.9.0">
  <artifact name="yop" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.y-op', module='yop', version='0.9.0')
)
libraryDependencies += "org.y-op" % "yop" % "0.9.0"
[org.y-op/yop "0.9.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

  • reflection
  • ioc
  • orm
  • rest
  • swaggerui
  • demo

YOP !

YOP is an ORM tool.
And since I am such a nice guy, a REST stack is built on top of it.

Status

Build Status

Modules :

Maven

Yop modules are available on Maven central :

<dependency>
    <groupId>org.y-op</groupId>
    <artifactId>reflection</artifactId>
    <version>0.9.0</version>
</dependency>
<dependency>
    <groupId>org.y-op</groupId>
    <artifactId>ioc</artifactId>
    <version>0.9.0</version>
</dependency>
<dependency>
    <groupId>org.y-op</groupId>
    <artifactId>orm</artifactId>
    <version>0.9.0</version>
</dependency>
<dependency>
    <groupId>org.y-op</groupId>
    <artifactId>rest</artifactId>
    <version>0.9.0</version>
</dependency>
<dependency>
    <groupId>org.y-op</groupId>
    <artifactId>swaggerui</artifactId>
    <version>0.9.0</version>
</dependency>

About

Yop is an ORM tool with a conventional REST webservice Servlet. Webservices are described using OpenAPI specifications

Structure :

The 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 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 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 sucks.
  • DTO pattern sucks.
  • YOP naively aims at being a straightforward Model-Driven ORM/REST stack.

Versions

Version
0.9.0
0.8.0
0.7.0
0.6.0
0.5.0
0.4
0.3.0