提交 f495a6ed 编写于 作者: V Vojtech Juranek

Merge branch 'transient-build-action' of git://github.com/lvotypko/jenkins into pull421

......@@ -87,6 +87,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
......@@ -882,6 +883,25 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
public Calendar due() {
return getTimestamp();
}
/**
* Add all transient action for this build
*
*/
protected List<Action> createTransientActions() {
Vector<Action> ta = new Vector<Action>();
for (TransientBuildActionFactory tpaf : TransientBuildActionFactory.all())
ta.addAll(Util.fixNull(tpaf.createFor(this)));
return ta;
}
@Override
public synchronized List<Action> getActions() {
List<Action> actions = new Vector<Action>(super.getActions());
//add transient actions too
actions.addAll(createTransientActions());
return actions;
}
/**
* Builds up a set of variable names that contain sensitive values that
......
package hudson.model;
import hudson.Extension;
import hudson.ExtensionList;
import hudson.ExtensionPoint;
import jenkins.model.Jenkins;
import java.util.Collection;
/**
* Extension point for inserting transient {@link Action}s into {@link AbstractBuild}s.
*
* To register your implementation, put {@link Extension} on your subtype.
*
* @author Lucie Votypkova
* @since 1.458
* @see Action
*/
public abstract class TransientBuildActionFactory implements ExtensionPoint {
/**
* Creates actions for the given build.
*
* @param project for which the action objects are requested. Never null.
* @return Can be empty but must not be null.
*/
public abstract Collection<? extends Action> createFor(AbstractBuild target);
/**
* Returns all the registered {@link TransientBuildActionFactory}s.
*/
public static ExtensionList<TransientBuildActionFactory> all() {
return Jenkins.getInstance().getExtensionList(TransientBuildActionFactory.class);
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册