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 |
checkAndSetLatestUpdateCenter()
Determines if there is an update center for the version of Jenkins in the war file.
|
void |
downloadDependencies(List<Plugin> dependentPlugins)
Downloads a list of dependencies.
|
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 |
getAttributefromManifest(File file,
String key) |
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
|
org.json.JSONArray |
getPluginDependencyJsonArray(Plugin plugin,
org.json.JSONObject ucJson)
Gets the JSONArray containing plugin a
|
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
|
void |
getUCJson()
Gets update center json, which is later used to determine plugin dependencies and 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 plugins by using the update center plugin-versions json.
|
void |
resolveDependenciesFromManifest(Plugin plugin)
Resolves dependencies from downloaded plugin manifest.
|
void |
setJenkinsUCLatest(String updateCenterLatest)
Sets the update center url string
|
void |
setJenkinsVersion(hudson.util.VersionNumber jenkinsVersion)
Sets Jenkins Version.
|
void |
showAllSecurityWarnings()
Prints out all security warnings if isShowAllWarnings is set to true in the config file
|
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 showAllSecurityWarnings()
public void checkAndSetLatestUpdateCenter()
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 getUCJson()
public org.json.JSONArray getPluginDependencyJsonArray(Plugin plugin, org.json.JSONObject ucJson)
plugin - to get depedencies forucJson - update center json from which to parse dependenciespublic void resolveDependenciesFromManifest(Plugin plugin)
plugin - public void resolveDependencies(Plugin plugin)
plugin - for which to find and download dependenciespublic void downloadDependencies(List<Plugin> dependentPlugins)
dependentPlugins - public 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.