public class PluginManager extends Object
| Constructor and Description |
|---|
PluginManager(Config cfg) |
| Modifier and Type | Method and Description |
|---|---|
List<String> |
bundledPlugins()
Finds the plugins and their versions bundled in the war file specified in the Config class.
|
void |
checkAndSetVersionSpecificUpdateCenter()
Determines if there is an update center for the version of Jenkins in the war file.
|
boolean |
downloadPlugin(Plugin plugin)
Downloads a plugin, skipping if already installed or bundled in the war.
|
void |
downloadPlugins(List<Plugin> plugins)
Downloads a list of plugins
|
boolean |
downloadToFile(String urlString,
Plugin plugin)
Downloads a plugin from a url
|
String |
getJenkinsUCLatest()
Gets the update center url string
|
hudson.util.VersionNumber |
getJenkinsVersion()
Gets the Jenkins version
|
hudson.util.VersionNumber |
getJenkinsVersionFromWar()
Gets the Jenkins version from the manifest in the Jenkins war specified in the Config class
|
org.json.JSONObject |
getJson(String urlString)
Gets the json object at the given url
|
String |
getPluginDownloadUrl(Plugin plugin)
Determines the plugin download url.
|
String |
getPluginVersion(File file)
Finds the plugin version by reading the manifest of a .hpi or .jpi file
|
void |
getSecurityWarnings()
Gets the security warnings for plugins from the update center json and creates a list of all the security
warnings
|
List<String> |
installedPlugins()
Finds all the plugins and their versions currently in the plugin directory specified in the Config class
|
void |
outputFailedPlugins()
Prints out plugins that failed to download.
|
void |
resolveDependencies(Plugin plugin)
Finds the dependencies for a plugin using the update center plugin-versions json.
|
void |
setJenkinsUCLatest(String updateCenterLatest)
Sets the update center url string
|
void |
setJenkinsVersion(hudson.util.VersionNumber jenkinsVersion)
Sets Jenkins Version.
|
void |
start()
Drives the process to download plugins.
|
public static final String SEPARATOR
public PluginManager(Config cfg)
public void start()
public void getSecurityWarnings()
public void checkAndSetVersionSpecificUpdateCenter()
public void outputFailedPlugins()
public void downloadPlugins(List<Plugin> plugins)
plugins - list of plugins to downloadpublic org.json.JSONObject getJson(String urlString)
urlString - string representing the url from which to get the json objectpublic void resolveDependencies(Plugin plugin)
plugin - for which to find and download dependenciespublic boolean downloadPlugin(Plugin plugin)
plugin - to downloadpublic String getPluginDownloadUrl(Plugin plugin)
plugin - to downloadpublic boolean downloadToFile(String urlString, Plugin plugin)
urlString - url to download the plugin fromplugin - Plugin object representing plugin to be downloadedpublic hudson.util.VersionNumber getJenkinsVersionFromWar()
public String getPluginVersion(File file)
file - plugin .hpi or .jpi of which to get the versionpublic List<String> installedPlugins()
public List<String> bundledPlugins()
public void setJenkinsVersion(hudson.util.VersionNumber jenkinsVersion)
jenkinsVersion - version of Jenkins, used for checking/setting version specific update centerpublic hudson.util.VersionNumber getJenkinsVersion()
public String getJenkinsUCLatest()
public void setJenkinsUCLatest(String updateCenterLatest)
updateCenterLatest - String in which to set the update center url stringCopyright © 2004–2019. All rights reserved.