Interface Plugin


public interface Plugin

Interface to be implemented by all plugins.

See the package documentation for detailed a plugin specification.

  • Method Details

    • isCompatible

      static boolean isCompatible(SoftwareVersion pluginSpecVersion)

      Returns whether the given plugin specification version is compatible with that of the application (i.e. whether the plugin is compatible with the application).

      Versions are compared semantically, where major version advances break compatibility, and minor version advances only add functionality without breaking compatibility. For example:

      Version compatibility
      Application specification version Plugin specification version Compatible?
      1.0 1.0 Yes
      1.0 1.1 No
      1.1 1.0 Yes
      2.0 1.1 No
      Parameters:
      pluginSpecVersion - Plugin specification version.
      Returns:
      Whether the given plugin specification version is compatible with that of the application.
    • getPluginConfigKeys

      Set<String> getPluginConfigKeys()
      Returns:
      All configuration keys defined by the plugin.
    • getPluginName

      String getPluginName()
      Returns:
      Name of the plugin. This should be brief yet distinctive in order to avoid name clashes.
    • getPluginSpecificationVersion

      default SoftwareVersion getPluginSpecificationVersion()
      This default implementation reads the Specification-Version from META-INF/MANIFEST.MF. There should normally be no reason to override it.
      Returns:
      The Specification-Version from META-INF/MANIFEST.MF, or null if not running from a JAR.
    • getPluginVersion

      default SoftwareVersion getPluginVersion()
      This default implementation reads the Implementation-Version from META-INF/MANIFEST.MF. There should normally be no reason to override it.
      Returns:
      The Implementation-Version from META-INF/MANIFEST.MF, or null if not running from a JAR.
    • onApplicationStart

      void onApplicationStart()
      Invoked once on one instance upon application start. Implementations should use this instead of e.g. a static initializer to perform non-instance-specific setup.
    • initializePlugin

      void initializePlugin()

      Invoked on every instance immediately after instantiation.

      Implementations should use this method instead of a constructor to perform initialization.

    • onApplicationStop

      void onApplicationStop()
      Invoked once on one instance upon application stop. Implementations should use this instead of e.g. a VM shutdown hook to perform non-instance-specific shutdown.