Class PluginManager
java.lang.Object
is.galia.plugin.PluginManager
Provides programmatic access to plugins, including listing, installing, and removing them.
N.B.: There are two types of what are referred to by this class as plugins: plugin directories and plugin implementation classes. The former are expected to have the following name format: <plugin-name>-<version>.
-
Method Summary
Modifier and TypeMethodDescriptionstatic PluginInstallergetPluginBackupDirs(String pluginName) Similar togetPluginDir(String), but includes plugin backup directories.static PathgetPluginDir(String pluginName) N.B.: Do not use any of these instances. They may not have been initialized properly.static Pathstatic PluginRemoverstatic PluginUpdaterstatic SoftwareVersiongetVersion(String pluginName) Parses the name of the version from the directory of the installed plugin with the given name.static booleanisPluginInstalled(String pluginName) static voidsetPluginsDir(Path pluginsDir) Overrides the default plugin path.static voidsetRepositoryBaseURI(Reference baseURI) Overrides the artifact repository base URI used for plugin installation and updating.
-
Method Details
-
getPluginBackupDirs
Similar togetPluginDir(String), but includes plugin backup directories.- Throws:
IOException
-
getPluginDir
- Parameters:
pluginName- Plugin name.- Returns:
- The directory of the active plugin with the given name. Backup directories are not considered.
- Throws:
IOException- See Also:
-
getPluginDirNames
- Returns:
- Names of all non-backup plugin directories, excluding their version suffix,
- Throws:
IOException
-
getPluginDirs
- Returns:
- All plugin directories, excluding backups.
- Throws:
IOException
-
getPlugins
-
getPluginsDir
- Returns:
- Root plugins directory.
-
getInstaller
- Returns:
- Shared instance.
-
getRemover
- Returns:
- Shared instance.
-
getUpdater
- Returns:
- Shared instance.
-
getVersion
public static SoftwareVersion getVersion(String pluginName) throws IOException, PluginNotInstalledException Parses the name of the version from the directory of the installed plugin with the given name.- Parameters:
pluginName- Name of an installed plugin.- Returns:
- The version of the installed plugin.
- Throws:
IOException- if there are any file access issues.PluginNotInstalledException- if there is no installed plugin with the given name.
-
isPluginInstalled
- Throws:
IOException
-
setRepositoryBaseURI
Overrides the artifact repository base URI used for plugin installation and updating. This is used in testing.- Parameters:
baseURI- New base URI.
-
setPluginsDir
Overrides the default plugin path.- Parameters:
pluginsDir- New root plugin directory.
-