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, Version, boolean), 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,
Version hostVersion,
boolean updatePlugins)
Load plugin jars from a directory, which are signed with a particular private key.
|
public static void loadPlugins(File pluginDir, PublicKey publicKey, String descriptorPath, Version hostVersion, boolean updatePlugins)
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 and for checking the minimum required
host version of the plugins.public static <T> List<T> findPlugins(Class<T> type, String descriptorPath, ClassLoader classLoader)
loadPlugins(File, PublicKey, String, Version, boolean), 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.IOExceptionCopyright © 2011–2023 pepsoft.org. All rights reserved.