Skip to content

dmart28/ressor

develop
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Ressor

GitHub Build Status Join the chat at https://gitter.im/dmart28/ressor Maven Central

Ressor is a framework which ease the development of resource-based Java services. It translates your static or dynamic resources (files, http endpoints, git repositories, etc) into a complete Java service instance, implicitly reloading it when the source data is changing.

See the Basic Concepts page for the more details.

How it works?

Ressor generates a special proxy class at runtime, which inherits the class/interface of your service. It delegates the calls to an actual instance of your service, which is created and stored inside this proxy, filled with the resource data.

As a result, you generate a single instance once and use it everywhere for the whole application lifetime. When the source data changes, it reloads the service and just swap to the new instance under the hood.

Project Status & Contributing

Ressor is currently at its early stages, so the feature set can be not complete and some bugs occur.

Feel free to participate in Ressor development in any form via contributions, issues, feature requests, etc.

Quick Example

Let's suppose you have a service which provides book titles by the ISBN:

public class BookRepository {
  private final Map<String, String> data = new HashMap<>();

  public BookRepository(List<Book> node) {
      node.forEach(b -> data.put(b.getIsbn(), b.getTitle()));
  }

  public String getTitle(String isbn) {
    return data.get(isbn);
  }
}

Also, there is a /etc/books.json file with all the data. Now we can simply tell Ressor to create a service instance, based on that file and use JSON format:

var ressor = Ressor.create();
var bookService = ressor.service(BookRepository.class)
        .fileSource("/etc/books.json")
        .translator(jsonList(Book.class))
        .build();

Now we can just use it:

var title = bookService.getTitle("0679760806"); // The Master and Margarita

What will happen if the books.json file will be changed? In case of file on local File System you can just subscribe for the changes:

ressor.listen(bookService);

That's all, you can continue using bookService instance, which will be always up-to-date with the books.json file contents.

Documentation

See our Project Website.

Javadoc is here.

Import

Releases are available via Maven Central.

Java 11+

  implementation 'xyz.ressor:ressor-core:1.3.0'
  implementation 'xyz.ressor:ressor-git-source:1.3.0'
  implementation 'xyz.ressor:ressor-http-source:1.3.0'
  implementation 'xyz.ressor:ressor-s3-source:1.3.0'

Java 8

  implementation 'xyz.ressor:ressor-core-jdk8:1.3.0'
  implementation 'xyz.ressor:ressor-git-source-jdk8:1.3.0'
  implementation 'xyz.ressor:ressor-http-source-jdk8:1.3.0'
  implementation 'xyz.ressor:ressor-s3-source-jdk8:1.3.0'

Versioning

We use SemVer for versioning. For the versions available, see the releases on this repository.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

About

Framework for working with dynamic resource-based services

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages