hudson
Class PluginWrapper

java.lang.Object
  extended by hudson.PluginWrapper
All Implemented Interfaces:
ModelObject, Comparable<PluginWrapper>

@ExportedBean
public class PluginWrapper
extends Object
implements Comparable<PluginWrapper>, ModelObject

Represents a Jenkins plug-in and associated control information for Jenkins to control 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.

  1. Enabled/Disabled. If enabled, Jenkins is going to use it next time Jenkins runs. Otherwise the next run will ignore it.
  2. Activated/Deactivated. If activated, that means Jenkins is using the plugin in this session. Otherwise it's not.

For example, an activated but disabled plugin is still running but the next time it won't.

Author:
Kohsuke Kawaguchi

Nested Class Summary
static class PluginWrapper.Dependency
           
 
Field Summary
 URL baseResourceURL
          Base URL for loading static resources from this plugin.
 ClassLoader classLoader
          ClassLoader for loading classes from this plugin.
 PluginManager parent
          PluginManager to which this belongs to.
 
Constructor Summary
PluginWrapper(PluginManager parent, File archive, Manifest manifest, URL baseResourceURL, ClassLoader classLoader, File disableFile, List<PluginWrapper.Dependency> dependencies, List<PluginWrapper.Dependency> optionalDependencies)
           
 
Method Summary
 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()
           
 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

parent

public final PluginManager parent
PluginManager to which this belongs to.


classLoader

public final ClassLoader classLoader
ClassLoader for loading classes from this plugin. Null if disabled.


baseResourceURL

public final URL baseResourceURL
Base URL for loading static resources from this plugin. Null if disabled. The static resources are mapped under CONTEXTPATH/plugin/SHORTNAME/.

Constructor Detail

PluginWrapper

public PluginWrapper(PluginManager parent,
                     File archive,
                     Manifest manifest,
                     URL baseResourceURL,
                     ClassLoader classLoader,
                     File disableFile,
                     List<PluginWrapper.Dependency> dependencies,
                     List<PluginWrapper.Dependency> optionalDependencies)
Parameters:
archive - A .jpi archive file jar file, or a .jpl linked plugin.
manifest - The manifest for the plugin
baseResourceURL - A URL pointing to the resources for this plugin
classLoader - a classloader that loads classes from this plugin and its dependencies
disableFile - if this file exists on startup, the plugin will not be activated
dependencies - a list of mandatory dependencies
optionalDependencies - a list of optional dependencies
Method Detail

getDisplayName

public String getDisplayName()
Specified by:
getDisplayName in interface ModelObject

getApi

public Api getApi()

getIndexPage

public URL getIndexPage()
Returns the URL of the index page jelly script.


getDependencies

@Exported
public List<PluginWrapper.Dependency> getDependencies()

getOptionalDependencies

public List<PluginWrapper.Dependency> getOptionalDependencies()

getShortName

@Exported
public String getShortName()
Returns the short name suitable for URL.


getPlugin

public Plugin getPlugin()
Gets the instance of Plugin contributed by this plugin.


getUrl

@Exported
public String getUrl()
Gets the URL that shows more information about this plugin.

Returns:
null if this information is unavailable.
Since:
1.283

toString

public String toString()
Overrides:
toString in class Object

getLongName

@Exported
public String getLongName()
Returns a one-line descriptive name of this plugin.


supportsDynamicLoad

@Exported
public YesNoMaybe supportsDynamicLoad()
Does this plugin supports dynamic loading?


getVersion

@Exported
public String getVersion()
Returns the version number of this plugin


getVersionNumber

public hudson.util.VersionNumber getVersionNumber()
Returns the version number of this plugin


isOlderThan

public boolean isOlderThan(hudson.util.VersionNumber v)
Returns true if the version of this plugin is older than the given version.


stop

public void stop()
Terminates the plugin.


releaseClassLoader

public void releaseClassLoader()

enable

public void enable()
            throws IOException
Enables this plugin next time Jenkins runs.

Throws:
IOException

disable

public void disable()
             throws IOException
Disables this plugin next time Jenkins runs.

Throws:
IOException

isActive

@Exported
public boolean isActive()
Returns true if this plugin is enabled for this session.


hasCycleDependency

public boolean hasCycleDependency()

setHasCycleDependency

public void setHasCycleDependency(boolean hasCycle)

isBundled

@Exported
public boolean isBundled()

isEnabled

@Exported
public boolean isEnabled()
If true, the plugin is going to be activated next time Jenkins runs.


getManifest

public Manifest getManifest()

setPlugin

public void setPlugin(Plugin plugin)

getPluginClass

public String getPluginClass()

hasLicensesXml

public boolean hasLicensesXml()

getUpdateInfo

public UpdateSite.Plugin getUpdateInfo()
If the plugin has an update, returns the UpdateSite.Plugin object.

Returns:
This method may return null — for example, the user may have installed a plugin locally developed.

getInfo

public UpdateSite.Plugin getInfo()
returns the UpdateSite.Plugin object, or null.


hasUpdate

@Exported
public boolean hasUpdate()
Returns true if this plugin has update in the update center.

This method is conservative in the sense that if the version number is incomprehensible, it always returns false.


isPinned

@Exported
public boolean isPinned()

isDeleted

@Exported
public boolean isDeleted()
Returns true if this plugin is deleted. The plugin continues to function in this session, but in the next session it'll disappear.


compareTo

public int compareTo(PluginWrapper pw)
Sort by short name.

Specified by:
compareTo in interface Comparable<PluginWrapper>

isDowngradable

@Exported
public boolean isDowngradable()
returns true if backup of previous version of plugin exists


getBackupFile

public File getBackupFile()
Where is the backup file?


getBackupVersion

@Exported
public String getBackupVersion()
returns the version of the backed up plugin, or null if there's no back up.


doMakeEnabled

public org.kohsuke.stapler.HttpResponse doMakeEnabled()
                                               throws IOException
Throws:
IOException

doMakeDisabled

public org.kohsuke.stapler.HttpResponse doMakeDisabled()
                                                throws IOException
Throws:
IOException

doPin

public org.kohsuke.stapler.HttpResponse doPin()
                                       throws IOException
Throws:
IOException

doUnpin

public org.kohsuke.stapler.HttpResponse doUnpin()
                                         throws IOException
Throws:
IOException

doDoUninstall

public org.kohsuke.stapler.HttpResponse doDoUninstall()
                                               throws IOException
Throws:
IOException


Copyright © 2004-2013. All Rights Reserved.