|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthudson.model.AbstractModelObject
hudson.PluginManager
@ExportedBean public abstract class PluginManager
Manages PluginWrapper
s.
Nested Class Summary | |
---|---|
static class |
PluginManager.FailedPlugin
Remembers why a plugin failed to deploy. |
static class |
PluginManager.PluginCycleDependenciesMonitor
AdministrativeMonitor that checks if there are any plugins with cycle dependencies. |
static class |
PluginManager.PluginUpdateMonitor
AdministrativeMonitor that informs the administrator about a required plugin update. |
class |
PluginManager.UberClassLoader
ClassLoader that can see all plugins. |
Field Summary | |
---|---|
protected List<PluginWrapper> |
activePlugins
All active plugins, topologically sorted so that when X depends on Y, Y appears in the list before X does. |
static Permission |
CONFIGURE_UPDATECENTER
|
javax.servlet.ServletContext |
context
Deprecated. as of 1.355 PluginManager can now live longer than Jenkins instance, so
use Hudson.getInstance().servletContext instead. |
protected List<PluginManager.FailedPlugin> |
failedPlugins
|
static boolean |
FAST_LOOKUP
|
protected List<PluginWrapper> |
plugins
All discovered plugins. |
boolean |
pluginUploaded
Once plugin is uploaded, this flag becomes true. |
File |
rootDir
Plug-in root directory. |
ClassLoader |
uberClassLoader
PluginManager.UberClassLoader that can load all the publicly visible classes from plugins
(and including the classloader that loads Hudson itself.) |
static Permission |
UPLOAD_PLUGINS
|
Constructor Summary | |
---|---|
PluginManager(javax.servlet.ServletContext context,
File rootDir)
|
Method Summary | ||
---|---|---|
protected void |
copyBundledPlugin(URL src,
String fileName)
Copies the bundled plugin from the given URL to the destination of the given file name (like 'abc.jpi'), with a reasonable up-to-date check. |
|
protected PluginStrategy |
createPluginStrategy()
Creates a hudson.PluginStrategy, looking at the corresponding system property. |
|
|
discover(Class<T> spi)
Discover all the service provider implementations of the given class, via META-INF/services. |
|
void |
doInstall(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Performs the installation of the plugins. |
|
org.kohsuke.stapler.HttpResponse |
doInstallNecessaryPlugins(org.kohsuke.stapler.StaplerRequest req)
Runs prevalidateConfig(java.io.InputStream) on posted XML and redirects to the UpdateCenter . |
|
net.sf.json.JSONArray |
doPrevalidateConfig(org.kohsuke.stapler.StaplerRequest req)
Like doInstallNecessaryPlugins(StaplerRequest) but only checks if everything is installed
or if some plugins need updates or installation. |
|
org.kohsuke.stapler.HttpResponse |
doProxyConfigure(org.kohsuke.stapler.StaplerRequest req)
|
|
org.kohsuke.stapler.HttpResponse |
doSiteConfigure(String site)
Bare-minimum configuration mechanism to change the update center. |
|
org.kohsuke.stapler.HttpResponse |
doUpdateSources(org.kohsuke.stapler.StaplerRequest req)
|
|
org.kohsuke.stapler.HttpResponse |
doUploadPlugin(org.kohsuke.stapler.StaplerRequest req)
Uploads a plugin. |
|
void |
dynamicLoad(File arc)
TODO: revisit where/how to expose this. |
|
Api |
getApi()
|
|
String |
getDisplayName()
|
|
List<PluginManager.FailedPlugin> |
getFailedPlugins()
|
|
PluginWrapper |
getPlugin(Class<? extends Plugin> pluginClazz)
Get the plugin instance that implements a specific class, use to find your plugin singleton. |
|
PluginWrapper |
getPlugin(String shortName)
Get the plugin instance with the given short name. |
|
List<PluginWrapper> |
getPlugins()
All discovered plugins. |
|
List<PluginWrapper> |
getPlugins(Class<? extends Plugin> pluginSuperclass)
Get the plugin instances that extend a specific class, use to find similar plugins. |
|
PluginStrategy |
getPluginStrategy()
|
|
Descriptor<ProxyConfiguration> |
getProxyDescriptor()
|
|
String |
getSearchUrl()
Returns the URL of this item relative to the parent SearchItem . |
|
org.jvnet.hudson.reactor.TaskBuilder |
initTasks(InitStrategy initStrategy)
Called immediately after the construction. |
|
boolean |
isPluginUploaded()
Returns true if any new plugin was added. |
|
protected abstract Collection<String> |
loadBundledPlugins()
If the war file has any "/WEB-INF/plugins/[*.jpi | *.hpi]", extract them into the plugin directory. |
|
Map<String,hudson.util.VersionNumber> |
parseRequestedPlugins(InputStream configXml)
Parses configuration XML files and picks up references to XML files. |
|
List<Future<UpdateCenter.UpdateCenterJob>> |
prevalidateConfig(InputStream configXml)
Prepares plugins for some expected XML configuration. |
|
void |
stop()
Orderly terminates all the plugins. |
|
PluginWrapper |
whichPlugin(Class c)
Return the PluginWrapper that loaded the given class 'c'. |
Methods inherited from class hudson.model.AbstractModelObject |
---|
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final List<PluginWrapper> plugins
protected final List<PluginWrapper> activePlugins
protected final List<PluginManager.FailedPlugin> failedPlugins
public final File rootDir
public final javax.servlet.ServletContext context
PluginManager
can now live longer than Jenkins
instance, so
use Hudson.getInstance().servletContext
instead.public final ClassLoader uberClassLoader
PluginManager.UberClassLoader
that can load all the publicly visible classes from plugins
(and including the classloader that loads Hudson itself.)
public volatile boolean pluginUploaded
public static boolean FAST_LOOKUP
public static final Permission UPLOAD_PLUGINS
public static final Permission CONFIGURE_UPDATECENTER
Constructor Detail |
---|
public PluginManager(javax.servlet.ServletContext context, File rootDir)
Method Detail |
---|
public Api getApi()
public org.jvnet.hudson.reactor.TaskBuilder initTasks(InitStrategy initStrategy)
Jenkins.pluginManager
.
public void dynamicLoad(File arc) throws IOException, InterruptedException, RestartRequiredException
IOException
InterruptedException
RestartRequiredException
protected abstract Collection<String> loadBundledPlugins() throws Exception
Exception
- Any exception will be reported and halt the startup.protected void copyBundledPlugin(URL src, String fileName) throws IOException
loadBundledPlugins()
.
IOException
protected PluginStrategy createPluginStrategy()
public PluginStrategy getPluginStrategy()
public boolean isPluginUploaded()
@Exported public List<PluginWrapper> getPlugins()
public List<PluginManager.FailedPlugin> getFailedPlugins()
public PluginWrapper getPlugin(String shortName)
shortName
- the short name of the plugin
null
if a plugin with the given short name does not exist.public PluginWrapper getPlugin(Class<? extends Plugin> pluginClazz)
pluginClazz
- The class that your plugin implements.
null
if for some reason the plugin is not loaded.public List<PluginWrapper> getPlugins(Class<? extends Plugin> pluginSuperclass)
pluginSuperclass
- The class that your plugin is derived from.
public String getDisplayName()
getDisplayName
in interface ModelObject
public String getSearchUrl()
SearchItem
SearchItem
.
getSearchUrl
in interface SearchItem
public <T> Collection<Class<? extends T>> discover(Class<T> spi)
public PluginWrapper whichPlugin(Class c)
PluginWrapper
that loaded the given class 'c'.
public void stop()
public org.kohsuke.stapler.HttpResponse doUpdateSources(org.kohsuke.stapler.StaplerRequest req) throws IOException
IOException
public void doInstall(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
public org.kohsuke.stapler.HttpResponse doSiteConfigure(@QueryParameter String site) throws IOException
IOException
public org.kohsuke.stapler.HttpResponse doProxyConfigure(org.kohsuke.stapler.StaplerRequest req) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
public org.kohsuke.stapler.HttpResponse doUploadPlugin(org.kohsuke.stapler.StaplerRequest req) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
public Descriptor<ProxyConfiguration> getProxyDescriptor()
public List<Future<UpdateCenter.UpdateCenterJob>> prevalidateConfig(InputStream configXml) throws IOException
config.xml
)
needs some plugins to be installed (or updated), those jobs
will be triggered.
Plugins are dynamically loaded whenever possible.
Requires Jenkins.ADMINISTER
.
configXml
- configuration that might be uploaded
IOException
- if loading or parsing the configuration failedItemGroupMixIn.createProjectFromXML(java.lang.String, java.io.InputStream)
,
AbstractItem.updateByXml(javax.xml.transform.Source)
,
XStream2
,
UpdateSite.Plugin.deploy(boolean)
,
PluginWrapper.supportsDynamicLoad()
,
UpdateCenter.DownloadJob.SuccessButRequiresRestart
public net.sf.json.JSONArray doPrevalidateConfig(org.kohsuke.stapler.StaplerRequest req) throws IOException
doInstallNecessaryPlugins(StaplerRequest)
but only checks if everything is installed
or if some plugins need updates or installation.
This method runs without side-effect. I'm still requiring the ADMINISTER permission since
XML file can contain various external references and we don't configure parsers properly against
that.
IOException
public org.kohsuke.stapler.HttpResponse doInstallNecessaryPlugins(org.kohsuke.stapler.StaplerRequest req) throws IOException
prevalidateConfig(java.io.InputStream)
on posted XML and redirects to the UpdateCenter
.
IOException
public Map<String,hudson.util.VersionNumber> parseRequestedPlugins(InputStream configXml) throws IOException
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |