public class UpdateManager extends Object
| Modifier and Type | Field and Description |
|---|---|
protected List<UpdateRepository> |
repositories |
| Constructor and Description |
|---|
UpdateManager(org.pf4j.PluginManager pluginManager) |
UpdateManager(org.pf4j.PluginManager pluginManager,
List<UpdateRepository> repos) |
UpdateManager(org.pf4j.PluginManager pluginManager,
Path repositoriesJson) |
| Modifier and Type | Method and Description |
|---|---|
void |
addRepository(String id,
URL url)
Add one
DefaultUpdateRepository. |
void |
addRepository(UpdateRepository newRepo)
Add a repo that was created by client.
|
protected Path |
downloadPlugin(String id,
String version)
Downloads a plugin with given coordinates, runs all
FileVerifiers
and returns a path to the downloaded file. |
protected PluginInfo.PluginRelease |
findReleaseForPlugin(String id,
String version)
Resolves Release from id and version.
|
List<PluginInfo> |
getAvailablePlugins() |
protected FileDownloader |
getFileDownloader(String pluginId)
Finds the
FileDownloader to use for this repository. |
protected FileVerifier |
getFileVerifier(String pluginId)
Gets a file verifier to use for this plugin.
|
PluginInfo.PluginRelease |
getLastPluginRelease(String id)
Returns the last release version of this plugin for given system version, regardless of release date.
|
List<PluginInfo> |
getPlugins()
Get the list of plugins from all repos.
|
Map<String,PluginInfo> |
getPluginsMap()
Get a map of all plugins from all repos where key is plugin id.
|
List<UpdateRepository> |
getRepositories() |
List<PluginInfo> |
getUpdates()
Return a list of plugins that are newer versions of already installed plugins.
|
boolean |
hasAvailablePlugins() |
boolean |
hasPluginUpdate(String id)
Finds whether the newer version of the plugin.
|
boolean |
hasUpdates()
Checks if Update Repositories has newer versions of some of the installed plugins.
|
protected void |
initRepositoriesFromJson() |
boolean |
installPlugin(String id,
String version)
Installs a plugin by id and version.
|
void |
refresh()
Refreshes all repositories, so they are forced to refresh list of plugins.
|
void |
removeRepository(String id)
Remove a repository by id.
|
void |
setRepositories(List<UpdateRepository> repositories)
Replace all repositories.
|
boolean |
uninstallPlugin(String id) |
boolean |
updatePlugin(String id,
String version)
Updates a plugin id to given version or to latest version if
version == null. |
protected List<UpdateRepository> repositories
public UpdateManager(org.pf4j.PluginManager pluginManager)
public UpdateManager(org.pf4j.PluginManager pluginManager,
Path repositoriesJson)
public UpdateManager(org.pf4j.PluginManager pluginManager,
List<UpdateRepository> repos)
public List<PluginInfo> getAvailablePlugins()
public boolean hasAvailablePlugins()
public List<PluginInfo> getUpdates()
public boolean hasUpdates()
public List<PluginInfo> getPlugins()
public Map<String,PluginInfo> getPluginsMap()
public List<UpdateRepository> getRepositories()
public void setRepositories(List<UpdateRepository> repositories)
repositories - list of new repositoriespublic void addRepository(String id, URL url)
DefaultUpdateRepository.id - of repourl - of repopublic void addRepository(UpdateRepository newRepo)
newRepo - the new UpdateRepository to add to the listpublic void removeRepository(String id)
id - of repository to removepublic void refresh()
public boolean installPlugin(String id, String version)
id - the id of plugin to installversion - the version of plugin to install, on SemVer format, or null for latestorg.pf4j.PluginRuntimeException - if plugin does not exist in repos or problems duringprotected Path downloadPlugin(String id, String version)
FileVerifiers
and returns a path to the downloaded file.id - of pluginversion - of plugin or null to download latestorg.pf4j.PluginRuntimeException - if download failedprotected FileDownloader getFileDownloader(String pluginId)
FileDownloader to use for this repository.pluginId - the plugin we wish to downloadprotected FileVerifier getFileVerifier(String pluginId)
CompoundVerifierpluginId - the plugin we wish to downloadprotected PluginInfo.PluginRelease findReleaseForPlugin(String id, String version)
id - of pluginversion - of plugin or null to locate latest versionorg.pf4j.PluginRuntimeException - if id or version does not existpublic boolean updatePlugin(String id, String version)
version == null.id - the id of plugin to updateversion - the version to update to, on SemVer format, or null for latestorg.pf4j.PluginRuntimeException - in case the given version is not available, plugin id not already installed etcpublic boolean uninstallPlugin(String id)
public PluginInfo.PluginRelease getLastPluginRelease(String id)
public boolean hasPluginUpdate(String id)
protected void initRepositoriesFromJson()
Copyright © 2020. All rights reserved.