Class Plugin
A Riskscape Plugin. So far, a riskscape plugin is used to help initialize an engine, the expectation being that the plugin can supply an engine with types, functions and models etc.
Derived from the Nutch project's plugin system
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidfinalize()List<Class<? extends PluginFeature>>Returns a list ofPluginFeatureclasses advertised by thisPluginas possible extension points.getId()initializeEngine(Engine engine) Initialize theEnginewith any services that are provided by this Plugin.voidinitializeEngine(Engine engine, ProblemSink problemSink) Initialize theEnginewith any services that are provided by this Plugin.initializeProject(Project project, Engine engine) Fill aProjectwith goodies, usually by scanning through the Project's Config.voidshutDown()Shutdown the plugin.protected voidWill be invoked on plugin start up and beforeinitializeEngine(Engine, ProblemSink)is called.void<T> Optional<T>supportsFeature(Class<T> spi) Deprecated.use the new ExtensionPoint API instead.
-
Constructor Details
-
Plugin
-
-
Method Details
-
getId
-
startUp
Will be invoked on plugin start up and before
initializeEngine(Engine, ProblemSink)is called. Gives plugins a change to bootstrap some expensive global state.- Throws:
PluginRuntimeException
-
startUp
-
shutDown
Shutdown the plugin. Might be called when the engine is destroyed.
- Throws:
PluginRuntimeException
-
finalize
-
initializeEngine
Initialize the
Enginewith any services that are provided by this Plugin. For example: -Models -BookmarkResolvers -ResourceLoaders- Parameters:
engine- the engine to populate with things.- Returns:
- any non-fatal warnings or errors generated that can be shown to the user
-
initializeEngine
Initialize the
Enginewith any services that are provided by this Plugin. For example: -Models -BookmarkResolvers -ResourceLoadersUse this method over
initializeEngine(Engine)to report problems immediately, which can be a better way to give feedback for the user, especially where things can happen over a greater period of time.- Parameters:
engine- the engine to populate with things.problemSink- a place to report any non-fatal warnings or errors generated that can be shown to the user
-
initializeProject
Fill a
Projectwith goodies, usually by scanning through the Project's Config. For example: -Types -IdentifiedFunctions - etc- Parameters:
project- the project to populateengine- containing services that may be required.- Returns:
- any non-fatal warnings or errors generated that can be shown to the user
-
supportsFeature
Deprecated.use the new ExtensionPoint API instead. We should start moving Features across to that as and when we touch them.Query a
Pluginto see if it supports the given 'service provider interface'. Support is currently limited to interfaces defined by the core engine classes - there is no support for plugins defining their own (yet) as this requires some class loader magic that we don't yet need.The current implementation, which isn't likely to last, queries the Plugin object itself to see if it implements the given interface.
The plan for the future might be to move things like resolvers and models etc in to SPI specific things to more precisely control the way the engine is built/augmented
- Parameters:
spi- the interface to look for in this plugin- Returns:
- an object implementing the spi if it is supported, or
Optional.empty()if this spi is not supported by thePlugin.
-
getI18nClassLoader
- Returns:
- the classloader this plugin provides for loading i18n resources. This method should be used in preference to the descriptor's default implementation in case the plugin wants to customize the class loader in someway.
-
getExtensionPoints
Returns a list of
PluginFeatureclasses advertised by thisPluginas possible extension points. While most extension points will be implemented in the core of the engine, it is possible for plugins to advertise their own for other dependent plugins to implement. -
getFeatures
- Returns:
- a list of
PluginFeatures implemented by thisPlugin
-
getDescriptor
-