public class UpdateManager extends Object
| Modifier and Type | Field and Description |
|---|---|
ro.fortsoft.pf4j.PluginManager |
pluginManager |
protected List<UpdateRepository> |
repositories |
| Constructor and Description |
|---|
UpdateManager(ro.fortsoft.pf4j.PluginManager pluginManager) |
UpdateManager(ro.fortsoft.pf4j.PluginManager pluginManager,
List<UpdateRepository> repos) |
UpdateManager(ro.fortsoft.pf4j.PluginManager pluginManager,
java.nio.file.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 java.nio.file.Path |
downloadPlugin(String id,
String version)
Downloads a plugin with given coordinates and returns a path to the file
|
protected URL |
findUrlForPlugin(String id,
String version)
Resolves url from id and version
|
List<PluginInfo> |
getAvailablePlugins() |
protected FileDownloader |
getFileDownloader(String pluginId)
Finds the FileDownloader to use for this repository
|
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 |
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 ro.fortsoft.pf4j.PluginManager pluginManager
public UpdateManager(ro.fortsoft.pf4j.PluginManager pluginManager)
public UpdateManager(ro.fortsoft.pf4j.PluginManager pluginManager,
java.nio.file.Path repositoriesJson)
public UpdateManager(ro.fortsoft.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)
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) throws ro.fortsoft.pf4j.PluginException
id - the id of plugin to installversion - the version of plugin to install, on SemVer format, or null for latestro.fortsoft.pf4j.PluginException - if plugin does not exist in repos or problems duringprotected java.nio.file.Path downloadPlugin(String id, String version) throws ro.fortsoft.pf4j.PluginException
id - of pluginversion - of plugin or null to download latestro.fortsoft.pf4j.PluginException - if download failedprotected FileDownloader getFileDownloader(String pluginId)
pluginId - the plugin we wish to downloadprotected URL findUrlForPlugin(String id, String version) throws ro.fortsoft.pf4j.PluginException
id - of pluginversion - of plugin or null to locate latest versionro.fortsoft.pf4j.PluginException - if id or version does not existpublic boolean updatePlugin(String id, String version) throws ro.fortsoft.pf4j.PluginException
id - the id of plugin to updateversion - the version to update to, on SemVer format, or null for latestro.fortsoft.pf4j.PluginException - in case the given version is not available, plugin id not already installed etcpublic boolean uninstallPlugin(String id)
protected void initRepositoriesFromJson()
Copyright © 2017. All Rights Reserved.