提交 6404417a 编写于 作者: M mindless

Add RunListener.onDeleted so plugins can watch for deleted builds.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@15941 71c3de6d-444a-0410-be80-ed276b4c234a
上级 722d24ed
......@@ -798,6 +798,8 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
* if we fail to delete.
*/
public synchronized void delete() throws IOException {
RunListener.fireDeleted(this);
// if we have a symlink, delete it, too
File link = new File(project.getBuildDir(), String.valueOf(getNumber()));
link.delete();
......
......@@ -88,6 +88,13 @@ public abstract class RunListener<R extends Run> implements ExtensionPoint {
*/
public void onStarted(R r, TaskListener listener) {}
/**
* Called right before a build is going to be deleted.
*
* @param r The build.
*/
public void onDeleted(R r) {}
/**
* Registers this object as an active listener so that it can start getting
* callbacks invoked.
......@@ -143,6 +150,16 @@ public abstract class RunListener<R extends Run> implements ExtensionPoint {
}
}
/**
* Fires the {@link #onFinalized(Run)} event.
*/
public static void fireDeleted(Run r) {
for (RunListener l : all()) {
if(l.targetType.isInstance(r))
l.onDeleted(r);
}
}
/**
* Returns all the registered {@link RunListener} descriptors.
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册