Interface Plugin
public interface Plugin
Interface to be implemented by all plugins.
See the package documentation for detailed a plugin specification.
-
Method Summary
Modifier and TypeMethodDescriptiondefault SoftwareVersion
This default implementation reads theSpecification-Version
fromMETA-INF/MANIFEST.MF
.default SoftwareVersion
This default implementation reads theImplementation-Version
fromMETA-INF/MANIFEST.MF
.void
Invoked on every instance immediately after instantiation.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).void
Invoked once on one instance upon application start.void
Invoked once on one instance upon application stop.
-
Method Details
-
isCompatible
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
-
getPluginName
String getPluginName()- Returns:
- Name of the plugin. This should be brief yet distinctive in order to avoid name clashes.
-
getPluginSpecificationVersion
This default implementation reads theSpecification-Version
fromMETA-INF/MANIFEST.MF
. There should normally be no reason to override it.- Returns:
- The
Specification-Version
fromMETA-INF/MANIFEST.MF
, ornull
if not running from a JAR.
-
getPluginVersion
This default implementation reads theImplementation-Version
fromMETA-INF/MANIFEST.MF
. There should normally be no reason to override it.- Returns:
- The
Implementation-Version
fromMETA-INF/MANIFEST.MF
, ornull
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.
-