File D:\maven-qcr-plugin-testsunitaires\qcr4java\jenkins-master\target\site\qc\core\src\main\java\jenkins\model\GlobalPluginConfiguration.java.html

1 package jenkins.model;
2
3 import hudson.Extension;
4 import hudson.Plugin;
5 import hudson.StructuredForm;
6 import net.sf.json.JSONObject;
7 import org.kohsuke.stapler.StaplerRequest;
8
9 import javax.servlet.ServletException;
10 import java.io.IOException;
11
12 /**
13 * Include config.jelly defined for {@link Plugin}s.
14 *
15 * <p>
16 * This object just acts as a proxy to configure {@link Jenkins#clouds}
17 *
18 * @author Kohsuke Kawaguchi
19 */
20 @Extension(ordinal=100) // historically this was placed above general configuration from arbitrary descriptors
21 public class GlobalPluginConfiguration extends GlobalConfiguration {
22 @Override
23 public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
24 try {
25 for( JSONObject o : StructuredForm.toList(json, "plugin"))
26 Jenkins.getInstance().pluginManager.getPlugin(o.getString("name")).getPlugin().configure(req, o);
27 return true;
28 } catch (IOException e) {
29 throw new FormException(e,"plugin");
30 } catch (ServletException e) {
31 throw new FormException(e,"plugin");
32 }
33 }
34 }
35