Class Module

java.lang.Object
io.inverno.core.v1.Module
Direct Known Subclasses:
Base, Boot, Client, Jose, Ldap, Lettuce, Server, Server, Vertx

public abstract class Module extends Object

The Module base class.

Generated module classes inherit this class which provides base module lifecycle implementation.

The following describes module startup steps:

  1. Start the required Inverno modules included in the module.
  2. Create the module beans that weren't already created.

Dependencies between beans determine the order in which they are created, as a result a bean can be created before the enclosing module is actually started.

The following describes the module destroy steps:

  1. Destroy the module beans in the reverse creation order.
  2. Stop the required Inverno modules included in the module.

A module should always be built using a Module.ModuleBuilder.

Since:
1.0
Author:
Jeremy Kuhn
  • Constructor Details

    • Module

      protected Module(String moduleName)

      Creates a new Module with the specified name.

      Parameters:
      moduleName - the module name
  • Method Details

    • with

      protected <T extends Module> T with(Module.ModuleLinker<T> moduleLinker)

      Creates a module with the specified module linker and register it in this module.

      A module can only be registered once to exactly one module.

      Type Parameters:
      T - the type of the module to create
      Parameters:
      moduleLinker - the module linker to use to create the module
      Returns:
      the registered module
    • with

      protected <T> Module.Bean<T> with(Module.ModuleBeanBuilder<T,?> beanBuilder)

      Creates a module bean with the specified bean builder and registers it in this module.

      A bean can only be registered once to exactly one module.

      Type Parameters:
      T - the type of the bean
      Parameters:
      beanBuilder - the bean builder to use to create the bean
      Returns:
      the registered bean
    • with

      protected <T> Module.Bean<T> with(Module.WrapperBeanBuilder<T,?,?> beanBuilder)

      Creates a wrapper bean with the specified bean builder and registers it in this module.

      A bean can only be registered once to exactly one module.

      Type Parameters:
      T - the type of the bean
      Parameters:
      beanBuilder - the bean builder to use to create the bean
      Returns:
      the registered bean
    • getName

      public String getName()

      Returns the name of the module.

      Returns:
      the name of the module
    • isActive

      public boolean isActive()

      Determines whether the module is active (ie. started).

      Returns:
      true if the module is active, false otherwise.
    • start

      public void start() throws IllegalStateException

      Starts the module.

      It creates and wires the beans defined within the module and the required Inverno modules it includes, the bean dependency graph determines the order into which beans are created. When the module is stopped, beans are destroyed in the reverse order.

      Throws:
      IllegalStateException - if the module is active.
    • stop

      public void stop()

      Stops the module.

      This methods basically destroy the beans created during startup in the reverse order.