@ExportedBean public class PluginWrapper extends Object implements Comparable<PluginWrapper>, ModelObject
Plugin
.
A plug-in is packaged into a jar file whose extension is ".jpi" (or ".hpi" for backward compatability), A plugin needs to have a special manifest entry to identify what it is.
At the runtime, a plugin has two distinct state axis.
For example, an activated but disabled plugin is still running but the next time it won't.
Modifier and Type | Class and Description |
---|---|
static class |
PluginWrapper.Dependency |
Modifier and Type | Field and Description |
---|---|
URL |
baseResourceURL
Base URL for loading static resources from this plugin.
|
ClassLoader |
classLoader
ClassLoader for loading classes from this plugin. |
static String |
MANIFEST_FILENAME
Name of the plugin manifest file (to help find where we parse them.)
|
PluginManager |
parent
PluginManager to which this belongs to. |
Constructor and Description |
---|
PluginWrapper(PluginManager parent,
File archive,
Manifest manifest,
URL baseResourceURL,
ClassLoader classLoader,
File disableFile,
List<PluginWrapper.Dependency> dependencies,
List<PluginWrapper.Dependency> optionalDependencies) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(PluginWrapper pw)
Sort by short name.
|
void |
disable()
Disables this plugin next time Jenkins runs.
|
org.kohsuke.stapler.HttpResponse |
doDoUninstall() |
org.kohsuke.stapler.HttpResponse |
doMakeDisabled() |
org.kohsuke.stapler.HttpResponse |
doMakeEnabled() |
org.kohsuke.stapler.HttpResponse |
doPin() |
org.kohsuke.stapler.HttpResponse |
doUnpin() |
void |
enable()
Enables this plugin next time Jenkins runs.
|
Api |
getApi() |
File |
getBackupFile()
Where is the backup file?
|
String |
getBackupVersion()
returns the version of the backed up plugin,
or null if there's no back up.
|
List<PluginWrapper.Dependency> |
getDependencies() |
String |
getDisplayName() |
URL |
getIndexPage()
Returns the URL of the index page jelly script.
|
UpdateSite.Plugin |
getInfo()
returns the
UpdateSite.Plugin object, or null. |
String |
getLongName()
Returns a one-line descriptive name of this plugin.
|
Manifest |
getManifest() |
List<PluginWrapper.Dependency> |
getOptionalDependencies() |
Plugin |
getPlugin()
Gets the instance of
Plugin contributed by this plugin. |
String |
getPluginClass() |
String |
getShortName()
Returns the short name suitable for URL.
|
UpdateSite.Plugin |
getUpdateInfo()
If the plugin has
an update ,
returns the UpdateSite.Plugin object. |
String |
getUrl()
Gets the URL that shows more information about this plugin.
|
String |
getVersion()
Returns the version number of this plugin
|
hudson.util.VersionNumber |
getVersionNumber()
Returns the version number of this plugin
|
boolean |
hasCycleDependency() |
boolean |
hasLicensesXml() |
boolean |
hasUpdate()
Returns true if this plugin has update in the update center.
|
boolean |
isActive()
Returns true if this plugin is enabled for this session.
|
boolean |
isBundled() |
boolean |
isDeleted()
Returns true if this plugin is deleted.
|
boolean |
isDowngradable()
returns true if backup of previous version of plugin exists
|
boolean |
isEnabled()
If true, the plugin is going to be activated next time
Jenkins runs.
|
boolean |
isOlderThan(hudson.util.VersionNumber v)
Returns true if the version of this plugin is older than the given version.
|
boolean |
isPinned() |
boolean |
isPinningForcingOldVersion()
Checks if this plugin is pinned and that's forcing us to use an older version than the bundled one.
|
void |
releaseClassLoader() |
void |
setHasCycleDependency(boolean hasCycle) |
void |
setPlugin(Plugin plugin) |
void |
stop()
Terminates the plugin.
|
YesNoMaybe |
supportsDynamicLoad()
Does this plugin supports dynamic loading?
|
String |
toString() |
public final PluginManager parent
PluginManager
to which this belongs to.public final ClassLoader classLoader
ClassLoader
for loading classes from this plugin.
Null if disabled.public final URL baseResourceURL
public static final String MANIFEST_FILENAME
public PluginWrapper(PluginManager parent, File archive, Manifest manifest, URL baseResourceURL, ClassLoader classLoader, File disableFile, List<PluginWrapper.Dependency> dependencies, List<PluginWrapper.Dependency> optionalDependencies)
archive
- A .jpi archive file jar file, or a .jpl linked plugin.manifest
- The manifest for the pluginbaseResourceURL
- A URL pointing to the resources for this pluginclassLoader
- a classloader that loads classes from this plugin and its dependenciesdisableFile
- if this file exists on startup, the plugin will not be activateddependencies
- a list of mandatory dependenciesoptionalDependencies
- a list of optional dependenciespublic String getDisplayName()
getDisplayName
in interface ModelObject
public Api getApi()
public URL getIndexPage()
@Exported public List<PluginWrapper.Dependency> getDependencies()
public List<PluginWrapper.Dependency> getOptionalDependencies()
@Exported public String getShortName()
@CheckForNull public Plugin getPlugin()
Plugin
contributed by this plugin.@Exported public String getUrl()
@Exported public String getLongName()
@Exported public YesNoMaybe supportsDynamicLoad()
@Exported public String getVersion()
public hudson.util.VersionNumber getVersionNumber()
public boolean isOlderThan(hudson.util.VersionNumber v)
public void stop()
public void releaseClassLoader()
public void enable() throws IOException
IOException
public void disable() throws IOException
IOException
@Exported public boolean isActive()
public boolean hasCycleDependency()
public void setHasCycleDependency(boolean hasCycle)
@Exported public boolean isBundled()
@Exported public boolean isEnabled()
public Manifest getManifest()
public void setPlugin(Plugin plugin)
public String getPluginClass()
public boolean hasLicensesXml()
public UpdateSite.Plugin getUpdateInfo()
an update
,
returns the UpdateSite.Plugin
object.public UpdateSite.Plugin getInfo()
UpdateSite.Plugin
object, or null.@Exported public boolean hasUpdate()
This method is conservative in the sense that if the version number is incomprehensible, it always returns false.
@Exported public boolean isPinned()
@Exported public boolean isDeleted()
public int compareTo(PluginWrapper pw)
compareTo
in interface Comparable<PluginWrapper>
@Exported public boolean isDowngradable()
public File getBackupFile()
@Exported public String getBackupVersion()
public boolean isPinningForcingOldVersion()
public org.kohsuke.stapler.HttpResponse doMakeEnabled() throws IOException
IOException
public org.kohsuke.stapler.HttpResponse doMakeDisabled() throws IOException
IOException
public org.kohsuke.stapler.HttpResponse doPin() throws IOException
IOException
public org.kohsuke.stapler.HttpResponse doUnpin() throws IOException
IOException
public org.kohsuke.stapler.HttpResponse doDoUninstall() throws IOException
IOException
Copyright © 2016. All rights reserved.