public final class PluginManager extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> List<T> |
findPlugins(Class<T> type,
String descriptorPath,
ClassLoader classLoader)
Obtain a list of instances of all plugins available through a particular
classloader, or from plugin jars discovered by a previous invocation of
loadPlugins(File, PublicKey, String), which implement a
particular type. |
static @NotNull List<String> |
getErrors()
Get the list of errors, if any, that occurred while loading the plugins.
|
static @NotNull List<String> |
getMessages()
Get the list of informational messages, if any, that were generated while
loading the plugins.
|
static ClassLoader |
getPluginClassLoader()
Get a classloader which gives access to the classes of all the plugins.
|
static Descriptor |
loadDescriptor(InputStream in,
String name)
Load a plugin descriptor from an input stream.
|
static void |
loadPlugins(File pluginDir,
PublicKey publicKey,
String descriptorPath)
Load plugin jars from a directory, which are signed with a particular
private key.
|
static void |
loadPlugins(File pluginDir,
PublicKey publicKey,
String descriptorPath,
Version hostVersion)
Load plugin jars from a directory, which are signed with a particular
private key.
|
public static void loadPlugins(File pluginDir, PublicKey publicKey, String descriptorPath)
This method should be invoked only once. Any discovered and properly
signed plugin jars will be available to be returned by later invocations
of the findPlugins(Class, String, ClassLoader) method.
pluginDir - The directory from which to load the plugins.publicKey - The public key corresponding to the private key with
which the plugins must have been signed.descriptorPath - The resource path of the file containing the plugin
descriptor.public static void loadPlugins(File pluginDir, PublicKey publicKey, String descriptorPath, Version hostVersion)
This method should be invoked only once. Any discovered and properly
signed plugin jars will be available to be returned by later invocations
of the findPlugins(Class, String, ClassLoader) method.
pluginDir - The directory from which to load the plugins.publicKey - The public key corresponding to the private key with
which the plugins must have been signed.descriptorPath - The resource path of the file containing the plugin
descriptor.hostVersion - The version of the host, for the update checking
process, or null if no update check should be
performed.public static <T> List<T> findPlugins(Class<T> type, String descriptorPath, ClassLoader classLoader)
loadPlugins(File, PublicKey, String), which implement a
particular type.T - The type of plugin to return.type - The type of plugin to return.descriptorPath - The resource path of the file containing the plugin
descriptor.classLoader - The classloader from which to discover plugins.public static ClassLoader getPluginClassLoader()
@NotNull public static @NotNull List<String> getMessages()
null.@NotNull public static @NotNull List<String> getErrors()
null.public static Descriptor loadDescriptor(InputStream in, String name) throws IOException
in - The input stream from which to read the descriptor. Will be
closed.name - A name associated with the input stream, to be used as a fall
back plugin name. May be null if not available.IOException