Class DefaultPluginManager

java.lang.Object
dev.siea.jonion.manager.AbstractPluginManager
dev.siea.jonion.manager.DefaultPluginManager
All Implemented Interfaces:
PluginManager

public class DefaultPluginManager extends AbstractPluginManager
Default implementation of AbstractPluginManager that adds start/stop lifecycle support for SimplePlugin instances.

After plugins are loaded (by the parent class), start() invokes SimplePlugin.start() on each loaded plugin. stop() invokes SimplePlugin.stop() on each loaded plugin and then unloads all plugins. Only wrappers in PluginState.LOADED state are started or stopped; failures are logged and the wrapper's state is set to PluginState.FAILED.

Note: This manager assumes all loaded plugins are instances of SimplePlugin. Plugins that extend Plugin but not SimplePlugin will throw ClassCastException when started or stopped.

See Also:
  • Constructor Details

    • DefaultPluginManager

      public DefaultPluginManager()
      Creates a manager that scans the default plugins directory with the default YAML descriptor finder.
    • DefaultPluginManager

      public DefaultPluginManager(Path directory)
      Creates a manager that scans the given directory with the default YAML descriptor finder.
      Parameters:
      directory - the path to the plugin directory (created if it does not exist)
    • DefaultPluginManager

      public DefaultPluginManager(Path directory, PluginDescriptorFinder descriptorFinder)
      Creates a manager with a custom descriptor finder and default YAML configuration finder.
      Parameters:
      directory - the path to the plugin directory (created if it does not exist)
      descriptorFinder - the finder used to read plugin descriptors from JARs
  • Method Details