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 SoftwareVersionThis default implementation reads theSpecification-VersionfromMETA-INF/MANIFEST.MF.default SoftwareVersionThis default implementation reads theImplementation-VersionfromMETA-INF/MANIFEST.MF.voidInvoked on every instance immediately after instantiation.static booleanisCompatible(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).voidInvoked once on one instance upon application start.voidInvoked 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-VersionfromMETA-INF/MANIFEST.MF. There should normally be no reason to override it.- Returns:
- The
Specification-VersionfromMETA-INF/MANIFEST.MF, ornullif not running from a JAR.
-
getPluginVersion
This default implementation reads theImplementation-VersionfromMETA-INF/MANIFEST.MF. There should normally be no reason to override it.- Returns:
- The
Implementation-VersionfromMETA-INF/MANIFEST.MF, ornullif 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.
-