Class PluginLoader

All Implemented Interfaces:
Closeable, AutoCloseable

public class PluginLoader extends URLClassLoader

This class detects and then try to load all builtin or custom Plugins.

  • Field Details

  • Constructor Details

    • PluginLoader

      public PluginLoader()

      The core of the detection and loading

  • Method Details

    • initInstance

      public static void initInstance()

      Set the value to the INSTANCE variable, so we can access values everywhere in the code.

    • getResources

      public Set<String> getResources(Pattern pattern)
      Parameters:
      pattern -

      Returned file names will need to follow this Pattern.

      Returns:

      The path into a Plugin of all files following the provided Pattern.

    • getResourcesInPackage

      public Set<String> getResourcesInPackage(String pkg)
      Parameters:
      pkg -

      The path of directories the method will use to access wanted files. Sub folders need to be split with a dot.

      Returns:

      The path into a Plugin of all files inside the provided folder.

    • getResources

      public Set<String> getResources(@Nullable String pkg, @Nullable Pattern pattern)
      Parameters:
      pkg -

      The path of directories the method will use to access wanted files. Sub folders need to be split with a dot.

      pattern -

      Returned file names will need to follow this Pattern.

      Returns:

      The path into a Plugin of all files inside the provided folder following the provided Pattern .

    • getPlugins

      public Collection<Plugin> getPlugins()
      Returns:

      A List of all loaded plugins. Sorted by plugin weight.

    • getJavaPlugins

      protected Collection<JavaPlugin> getJavaPlugins()
      Returns:

      A List of all loaded Java plugins. Sorted by plugin weight.

    • getPluginUpdates

      public Collection<PluginUpdateInfo> getPluginUpdates()
      Returns:

      A list of all plugin updates detected.

    • getPluginModules

      public Collection<Module> getPluginModules()
      Returns:

      A list of all plugin modules.

    • getFailedPlugins

      public Collection<PluginLoadFailure> getFailedPlugins()