Class AbstractExtensionFinder

java.lang.Object
org.pf4j.AbstractExtensionFinder
All Implemented Interfaces:
EventListener, ExtensionFinder, PluginStateListener
Direct Known Subclasses:
LegacyExtensionFinder, ServiceProviderExtensionFinder

public abstract class AbstractExtensionFinder extends Object implements ExtensionFinder, PluginStateListener
Author:
Decebal Suiu
  • Field Details

  • Constructor Details

    • AbstractExtensionFinder

      public AbstractExtensionFinder(PluginManager pluginManager)
  • Method Details

    • readPluginsStorages

      public abstract Map<String, Set<String>> readPluginsStorages()
    • readClasspathStorages

      public abstract Map<String, Set<String>> readClasspathStorages()
    • find

      public <T> List<ExtensionWrapper<T>> find(Class<T> type)
      Description copied from interface: ExtensionFinder
      Retrieves a list with all extensions found for an extension point.
      Specified by:
      find in interface ExtensionFinder
    • find

      public <T> List<ExtensionWrapper<T>> find(Class<T> type, String pluginId)
      Description copied from interface: ExtensionFinder
      Retrieves a list with all extensions found for an extension point and a plugin.
      Specified by:
      find in interface ExtensionFinder
    • find

      public List<ExtensionWrapper> find(String pluginId)
      Description copied from interface: ExtensionFinder
      Retrieves a list with all extensions found for a plugin
      Specified by:
      find in interface ExtensionFinder
    • findClassNames

      public Set<String> findClassNames(String pluginId)
      Description copied from interface: ExtensionFinder
      Retrieves a list with all extension class names found for a plugin.
      Specified by:
      findClassNames in interface ExtensionFinder
    • pluginStateChanged

      public void pluginStateChanged(PluginStateEvent event)
      Description copied from interface: PluginStateListener
      Invoked when a plugin's state (for example DISABLED, STARTED) is changed.
      Specified by:
      pluginStateChanged in interface PluginStateListener
    • isCheckForExtensionDependencies

      public final boolean isCheckForExtensionDependencies()
      Returns true, if the extension finder checks extensions for its required plugins. This feature has to be enabled, in order check the availability of Extension.plugins() configured by an extension.

      This feature is enabled by default, if at least one available plugin makes use of optional plugin dependencies. Those optional plugins might not be available at runtime. Therefore any extension is checked by default against available plugins before its instantiation.

      Notice: This feature requires the optional ASM library to be available on the applications classpath.

      Returns:
      true, if the extension finder checks extensions for its required plugins
    • setCheckForExtensionDependencies

      public void setCheckForExtensionDependencies(boolean checkForExtensionDependencies)
      Plugin developers may enable / disable checks for required plugins of an extension. This feature has to be enabled, in order check the availability of Extension.plugins() configured by an extension.

      This feature is enabled by default, if at least one available plugin makes use of optional plugin dependencies. Those optional plugins might not be available at runtime. Therefore any extension is checked by default against available plugins before its instantiation.

      Notice: This feature requires the optional ASM library to be available on the applications classpath.

      Parameters:
      checkForExtensionDependencies - true to enable checks for optional extensions, otherwise false
    • debugExtensions

      protected void debugExtensions(Set<String> extensions)