Module aeonics.boot
Package aeonics

Class Plugin

  • Direct Known Subclasses:
    Boot

    public abstract class Plugin
    extends java.lang.Object
    This class serves as a service provider for the system extension plugins. Implementations of this class are intended to be used as service providers in the context of the Java module system's 'uses' directive.

    Plugins wishing to provide an implementation of this service should declare it using 'provides' directive in their module-info.java file and provide a parameterless constructor.

    Note: only one Plugin is supported per java module

    All 'requires' and 'export' directives from the module-info.java file can be used to manage inter-plugin communication.

    Example module declaration:

    module my.module {
         requires aeonics.boot;
         provides aeonics.Plugin with my.MyPlugin;
     }

    In order for the plugin lifecycle to proceed properly, it is important that nothing happens in the constructor. The start() method will be called when all plugins are preloaded in the system.

    Example plugin implementation:

    public class MyPlugin extends Plugin {
         public String summary() { return "My Plugin v1.0"; }
         public String description() { return "This is my plugin"; }
         public void start() {
             Lifecycle.on(Lifecycle.Phase.LOAD, Callback.once(() -> {
                 ...
             }));
         }
     }
    • Constructor Summary

      Constructors 
      Constructor Description
      Plugin()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.List<Plugin> all()
      Returns the list of all loaded plugins
      abstract java.lang.String description()
      Returns this plugin description.
      static java.lang.ModuleLayer getModuleLayer()
      Returns the module layer in which all plugins are loaded
      static void initialize()
      Initializes the plugin loading mechanism.
      java.lang.String name()
      Returns this plugin name.
      protected abstract void start()
      This method will be called by the lifecycle manager after all required dependencies are met.
      abstract java.lang.String summary()
      Returns this plugin summary.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Plugin

        public Plugin()
    • Method Detail

      • name

        public final java.lang.String name()
        Returns this plugin name. The plugin name is equal to the name of the java module that provides it.
        Returns:
        the plugin name
      • summary

        public abstract java.lang.String summary()
        Returns this plugin summary.
        Returns:
        the plugin summary
      • description

        public abstract java.lang.String description()
        Returns this plugin description.
        Returns:
        the plugin description
      • start

        protected abstract void start()
        This method will be called by the lifecycle manager after all required dependencies are met. You should register your callback functions for other lifecycle events in this method.
      • initialize

        public static void initialize()
        Initializes the plugin loading mechanism.
      • getModuleLayer

        public static java.lang.ModuleLayer getModuleLayer()
        Returns the module layer in which all plugins are loaded
        Returns:
        the module layer in which all plugins are loaded
      • all

        public static java.util.List<Plugin> all()
        Returns the list of all loaded plugins
        Returns:
        the list of all loaded plugins