|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PluginService
Interface for service that keeps track of available plugins.
The plugin service keeps a master index of all plugins known to the system.
At heart, a plugin is a piece of functionality that extends a program's
capabilities. Plugins take many forms; see SciJavaPlugin
for details.
The default plugin service discovers available plugins on the classpath.
SciJavaPlugin
Method Summary | ||
---|---|---|
void |
addPlugin(PluginInfo<?> plugin)
Manually registers a plugin with the plugin service. |
|
|
addPlugins(Collection<T> plugins)
Manually registers plugins with the plugin service. |
|
|
createInstance(PluginInfo<PT> info)
Creates an instance of the given plugin. |
|
|
createInstances(List<PluginInfo<PT>> infos)
Creates an instance of each of the plugins on the given list. |
|
|
createInstancesOfType(Class<PT> type)
Creates one instance each of the available plugins of the given type. |
|
PluginIndex |
getIndex()
Gets the index of available plugins. |
|
|
getPlugin(Class<P> pluginClass)
Gets the first available plugin of the given class, or null if none. |
|
|
getPlugin(Class<P> pluginClass,
Class<PT> type)
Gets the first available plugin of the given class, or null if none. |
|
PluginInfo<SciJavaPlugin> |
getPlugin(String className)
Gets the first available plugin of the given class name, or null if none. |
|
List<PluginInfo<?>> |
getPlugins()
Gets the list of known plugins. |
|
|
getPluginsOfClass(Class<P> pluginClass)
Gets the list of plugins of the given class. |
|
|
getPluginsOfClass(Class<P> pluginClass,
Class<PT> type)
Gets the list of plugins of the given class. |
|
List<PluginInfo<SciJavaPlugin>> |
getPluginsOfClass(String className)
Gets the list of plugins with the given class name. |
|
|
getPluginsOfClass(String className,
Class<PT> type)
Gets the list of plugins with the given class name. |
|
|
getPluginsOfType(Class<PT> type)
Gets the list of plugins of the given type (e.g., Service ). |
|
void |
reloadPlugins()
Rediscovers all plugins available on the classpath. |
|
void |
removePlugin(PluginInfo<?> plugin)
Manually unregisters a plugin with the plugin service. |
|
|
removePlugins(Collection<T> plugins)
Manually unregisters plugins with the plugin service. |
Methods inherited from interface org.scijava.service.Service |
---|
initialize, registerEventHandlers |
Methods inherited from interface org.scijava.Contextual |
---|
context, getContext, setContext |
Methods inherited from interface org.scijava.Prioritized |
---|
getPriority, setPriority |
Methods inherited from interface java.lang.Comparable |
---|
compareTo |
Methods inherited from interface org.scijava.plugin.HasPluginInfo |
---|
getInfo, setInfo |
Methods inherited from interface org.scijava.Disposable |
---|
dispose |
Method Detail |
---|
PluginIndex getIndex()
void reloadPlugins()
void addPlugin(PluginInfo<?> plugin)
<T extends PluginInfo<?>> void addPlugins(Collection<T> plugins)
void removePlugin(PluginInfo<?> plugin)
<T extends PluginInfo<?>> void removePlugins(Collection<T> plugins)
List<PluginInfo<?>> getPlugins()
<P extends SciJavaPlugin> PluginInfo<SciJavaPlugin> getPlugin(Class<P> pluginClass)
P
- The class of the plugin to look up.<PT extends SciJavaPlugin,P extends PT> PluginInfo<PT> getPlugin(Class<P> pluginClass, Class<PT> type)
PT
- The type of the plugin to look up; e.g.,
Service.class
.P
- The class of the plugin to look up.PluginInfo<SciJavaPlugin> getPlugin(String className)
<PT extends SciJavaPlugin> List<PluginInfo<PT>> getPluginsOfType(Class<PT> type)
Service
).
PT
- The type of plugins to look up; e.g.,
Service.class
.<P extends SciJavaPlugin> List<PluginInfo<SciJavaPlugin>> getPluginsOfClass(Class<P> pluginClass)
Most classes will have only a single match, but some special classes (such
as ImageJ's LegacyCommand
) may match many entries.
Note that this method will result in PluginInfo
s with matching
class names to load their plugin Class
es so that they can
be compared with the given one.
NB: Classes are matched by strict equality, not assignability; subtypes of
the specified class will not match. For this behavior, use
getPluginsOfType(Class)
on a common parent interface.
P
- The class of plugins to look up.pluginClass
- The class for which to obtain the list of matching
plugins.<PT extends SciJavaPlugin,P extends PT> List<PluginInfo<PT>> getPluginsOfClass(Class<P> pluginClass, Class<PT> type)
Most classes will have only a single match, but some special classes (such
as ImageJ's LegacyCommand
) may match many entries.
Note that this method will result in PluginInfo
s with matching
class names and types to load their plugin Class
es so that
they can be compared with the given one.
NB: Classes are matched by strict equality, not assignability; subtypes of
the specified class will not match. For this behavior, use
getPluginsOfType(Class)
on a common parent interface.
PT
- The type of plugins to look up; e.g.,
Service.class
.P
- The class of plugins to look up.pluginClass
- The class for which to obtain the list of matching
plugins.type
- The type of plugins to which the search should be
limited.List<PluginInfo<SciJavaPlugin>> getPluginsOfClass(String className)
Most classes will have only a single match, but some special classes (such
as ImageJ's LegacyCommand
) may match many entries.
NB: Classes are matched by strict equality, not assignability; subtypes of
the specified class will not match. For this behavior, use
getPluginsOfType(Class)
on a common parent interface.
className
- The class name for which to obtain the list of matching
plugins.<PT extends SciJavaPlugin> List<PluginInfo<SciJavaPlugin>> getPluginsOfClass(String className, Class<PT> type)
Most classes will have only a single match, but some special classes (such
as ImageJ's LegacyCommand
) may match many entries.
NB: Classes are matched by strict equality, not assignability; subtypes of
the specified class will not match. For this behavior, use
getPluginsOfType(Class)
on a common parent interface.
PT
- The type of plugins to look up; e.g.,
Service.class
.className
- The class name for which to obtain the list of matching
plugins.type
- The type of plugins to which the search should be
limited.<PT extends SciJavaPlugin> List<PT> createInstancesOfType(Class<PT> type)
Note that in the case of commands, this method does not do any preprocessing on the command instances, so parameters will not be auto-populated, initializers will not be executed, etc.
PT
- The type of plugins to instantiate; e.g.,
Service.class
.<PT extends SciJavaPlugin> List<PT> createInstances(List<PluginInfo<PT>> infos)
If the plugin implements the Contextual
interface, the
appropriate context is injected. Similarly, if the plugin implements the
Prioritized
interface, the appropriate priority is
injected.
Note that in the case of commands, this method does not do any preprocessing on the command instances, so parameters will not be auto-populated, initializers will not be executed, etc.
PT
- The type of plugins to instantiate; e.g.,
Service.class
.<PT extends SciJavaPlugin> PT createInstance(PluginInfo<PT> info)
If the plugin implements the Contextual
interface, the
appropriate context is injected. Similarly, if the plugin implements the
Prioritized
interface, the appropriate priority is
injected.
Note that in the case of commands, this method does not do any preprocessing on the command instances, so parameters will not be auto-populated, initializers will not be executed, etc.
PT
- The type of plugin to instantiate; e.g.,
Service.class
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |