~ubuntu-branches/ubuntu/precise/jenkins/precise-updates

« back to all changes in this revision

Viewing changes to core/src/main/java/hudson/model/listeners/RunListener.java

  • Committer: Package Import Robot
  • Author(s): James Page, Miguel Landaeta, James Page
  • Date: 2012-01-31 10:33:56 UTC
  • mfrom: (1.1.4) (5.1.3 sid)
  • Revision ID: package-import@ubuntu.com-20120131103356-kg3w0k3s5dfdnsw8
Tags: 1.424.2+dfsg-1
[ Miguel Landaeta ]
* Replace dependencies on Spring Framework 2.5 libraries with 3.0 ones.
  (Closes: #655906).

[ James Page ]
* New upstream release.
  - d/control: Add new dependencies on libjenkins-remoting-java, 
    libstapler-adjunct-codemirror-java and libmaven-hpi-plugin-java.
  - d/control: Dropped libjcaptcha-java; no longer needed.
* d/control: Switch to using packaged animal-sniffer.
* Refreshed patches:
  - d/patches/build/{debianize-antrun-war,animal-sniffer-annotation}.patch:
    dropped as no longer required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
import hudson.ExtensionListView;
28
28
import hudson.Extension;
29
29
import hudson.ExtensionList;
 
30
import hudson.FilePath;
 
31
import hudson.Launcher;
 
32
import hudson.model.AbstractBuild;
 
33
import hudson.model.BuildListener;
 
34
import hudson.model.Environment;
 
35
import hudson.model.JobProperty;
30
36
import hudson.model.Run;
31
37
import hudson.model.TaskListener;
32
 
import hudson.model.Hudson;
 
38
import jenkins.model.Jenkins;
 
39
import hudson.scm.SCM;
 
40
import hudson.tasks.BuildWrapper;
33
41
import hudson.util.CopyOnWriteList;
34
42
import org.jvnet.tiger_types.Types;
35
43
 
 
44
import java.io.File;
 
45
import java.io.IOException;
36
46
import java.lang.reflect.ParameterizedType;
37
47
import java.lang.reflect.Type;
38
48
 
98
108
    public void onStarted(R r, TaskListener listener) {}
99
109
 
100
110
    /**
 
111
     * Runs before the {@link SCM#checkout(AbstractBuild, Launcher, FilePath, BuildListener, File)} runs, and performs a set up.
 
112
     * Can contribute additional properties/env vars to the environment.
 
113
     *
 
114
     * <p>
 
115
     * A typical strategy is for implementations to check {@link JobProperty}s and other configuration
 
116
     * of the project to determine the environment to inject, which allows you to achieve the equivalent of
 
117
     * {@link BuildWrapper}, but without UI.
 
118
     *
 
119
     * @param build
 
120
     *      The build in progress for which an {@link Environment} object is created.
 
121
     *      Never null.
 
122
     * @param launcher
 
123
     *      This launcher can be used to launch processes for this build.
 
124
     *      If the build runs remotely, launcher will also run a job on that remote machine.
 
125
     *      Never null.
 
126
     * @param listener
 
127
     *      Can be used to send any message.
 
128
     * @return
 
129
     *      non-null if the build can continue, null if there was an error
 
130
     *      and the build needs to be aborted.
 
131
     * @throws IOException
 
132
     *      terminates the build abnormally. Hudson will handle the exception
 
133
     *      and reports a nice error message.
 
134
     * @since 1.409
 
135
     */
 
136
    public Environment setUpEnvironment( AbstractBuild build, Launcher launcher, BuildListener listener ) throws IOException, InterruptedException {
 
137
        return new Environment() {};
 
138
    }
 
139
 
 
140
    /**
101
141
     * Called right before a build is going to be deleted.
102
142
     *
103
143
     * @param r The build.
130
170
    public static final CopyOnWriteList<RunListener> LISTENERS = ExtensionListView.createCopyOnWriteList(RunListener.class);
131
171
 
132
172
    /**
133
 
     * Fires the {@link #onCompleted} event.
 
173
     * Fires the {@link #onCompleted(Run, TaskListener)} event.
134
174
     */
135
175
    public static void fireCompleted(Run r, TaskListener listener) {
136
176
        for (RunListener l : all()) {
140
180
    }
141
181
 
142
182
    /**
143
 
     * Fires the {@link #onStarted} event.
 
183
     * Fires the {@link #onStarted(Run, TaskListener)} event.
144
184
     */
145
185
    public static void fireStarted(Run r, TaskListener listener) {
146
186
        for (RunListener l : all()) {
173
213
     * Returns all the registered {@link RunListener} descriptors.
174
214
     */
175
215
    public static ExtensionList<RunListener> all() {
176
 
        return Hudson.getInstance().getExtensionList(RunListener.class);
 
216
        return Jenkins.getInstance().getExtensionList(RunListener.class);
177
217
    }
178
218
}