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

1 /*
2 * The MIT License
3 *
4 * Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Erik Ramfelt
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24 package hudson.model;
25
26 import hudson.ExtensionPoint;
27 import hudson.Plugin;
28 import hudson.Extension;
29 import hudson.ExtensionList;
30 import hudson.util.DescriptorList;
31 import jenkins.model.Jenkins;
32
33 import java.util.List;
34
35 /**
36 * Participates in the rendering of HTML pages for all pages of Hudson.
37 *
38 * <p>
39 * This class provides a few hooks to augument the HTML generation process of Hudson, across
40 * all the HTML pages that Hudson delivers.
41 *
42 * <p>
43 * For example, if you'd like to add a Google Analytics stat to Hudson, then you need to inject
44 * a small script fragment to all Hudson pages. This extension point provides a means to do that.
45 *
46 * <h2>Life-cycle</h2>
47 * <p>
48 * {@link Plugin}s that contribute this extension point
49 * should implement a new decorator and put {@link Extension} on the class.
50 *
51 * <h2>Associated Views</h2>
52 * <h4>global.jelly</h4>
53 * <p>
54 * If this extension point needs to expose a global configuration, write this jelly page.
55 * See {@link Descriptor} for more about this. Optional.
56 *
57 * <h4>footer.jelly</h4>
58 * <p>
59 * This page is added right before the &lt;/body> tag. Convenient place for adding tracking beacons, etc.
60 *
61 * <h4>header.jelly</h4>
62 * <p>
63 * This page is added right before the &lt;/head> tag. Convenient place for additional stylesheet,
64 * &lt;meta> tags, etc.
65 *
66 * <h4>httpHeaders.jelly</h4>
67 * <p>
68 * This is a generalization of the X-Jenkins header that aids auto-discovery.
69 * This fragment can write additional &lt;st:header name="..." value="..." /> tags that go along with it.
70 *
71 * @author Kohsuke Kawaguchi
72 * @since 1.235
73 */
74 public abstract class PageDecorator extends Descriptor<PageDecorator> implements ExtensionPoint, Describable<PageDecorator> {
75 /**
76 * @param yourClass
77 * pass-in "this.getClass()" (except that the constructor parameters cannot use 'this',
78 * so you'd have to hard-code the class name.
79 * @deprecated as of 1.425
80 * Use the default constructor that's less error prone
81 */
82 protected PageDecorator(Class<? extends PageDecorator> yourClass) {
83 super(yourClass);
84 }
85
86 protected PageDecorator() {
87 super(self());
88 }
89
90 // this will never work because Descriptor and Describable are the same thing.
91 // protected PageDecorator() {
92 // }
93
94 public final Descriptor<PageDecorator> getDescriptor() {
95 return this;
96 }
97
98 /**
99 * Unless this object has additional web presence, display name is not used at all.
100 * So default to "".
101 */
102 public String getDisplayName() {
103 return "";
104 }
105
106 /**
107 * Obtains the URL of this object, excluding the context path.
108 *
109 * <p>
110 * Every {@link PageDecorator} is bound to URL via {@link Jenkins#getDescriptor()}.
111 * This method returns such an URL.
112 */
113 public final String getUrl() {
114 return "descriptor/"+clazz.getName();
115 }
116
117 /**
118 * All the registered instances.
119 * @deprecated as of 1.286
120 * Use {@link #all()} for read access, and use {@link Extension} for registration.
121 */
122 public static final List<PageDecorator> ALL = (List)new DescriptorList<PageDecorator>(PageDecorator.class);
123
124 /**
125 * Returns all the registered {@link PageDecorator} descriptors.
126 */
127 public static ExtensionList<PageDecorator> all() {
128 return Jenkins.getInstance().<PageDecorator,PageDecorator>getDescriptorList(PageDecorator.class);
129 }
130 }
131