Skip to content
This repository has been archived by the owner on Dec 8, 2023. It is now read-only.

Latest commit

 

History

History
52 lines (35 loc) · 2.59 KB

README.md

File metadata and controls

52 lines (35 loc) · 2.59 KB

Booty

Booty leverages on the LifeCycle interface to define an application and handle it's bootstrap.

alt text
Please don't click on this

A common application is made up of several modules, each either developed by you, your teammate, an open community, some big coorporation, etc... These modules are things like logging, database access, TPC listening and also etc...

Although you can make a Java application as a monolithic block on top of the JREs, this is seldom the case. You can use Booty to help you with the handling of all the modules in your application, still keeping them separated.

Prerequisites

Each of your application's modules must somehow implement LifeCycle. This is the minimum contract Booty needs in order to handle them. If you don't want to change your module dependencies, you can simply create anonymous LifeCycle classes that wrap them. Either way you end up having to implement the following methods for each of your modules: void start(), void stop(), boolean isRunning(). Chances are the behaviours themselves are already implemented in each module.

Usage

public static void main(String[] args) {
  LifeCycle logging = new MyLogging();
  LifeCycle httpServer = new MyHTTPServer();
  LifeCycle dao = MyDatabaseAccess();
  
  BootyConfig config = new BootyConfig();
  config.setLifecycleSupplier(()->Arrays.asList(logging,httpServer,dao));
  Booty.build(config).start();
}

Notes

How the modules communicate with one another is outside of the scope of this project and should be solved by correcty modeling your application.
It is also possible to use Booty in a servlet container. To do so, it should be called in the application Context Listener.