本文整理汇总了Java中hudson.model.listeners.ItemListener类的典型用法代码示例。如果您正苦于以下问题:Java ItemListener类的具体用法?Java ItemListener怎么用?Java ItemListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ItemListener类属于hudson.model.listeners包,在下文中一共展示了ItemListener类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: submit
import hudson.model.listeners.ItemListener; //导入依赖的package包/类
/**
* Sets various implementation-specific fields and forwards wrapped req/rsp objects on to the
* {@link #template}'s {@link AbstractProject#doConfigSubmit(StaplerRequest, StaplerResponse)} method.
* <br>
* {@inheritDoc}
*/
@Override
public void submit(StaplerRequest req, StaplerResponse rsp)
throws ServletException, Descriptor.FormException, IOException {
super.submit(req, rsp);
makeDisabled(req.getParameter("disable") != null);
template.doConfigSubmit(
new TemplateStaplerRequestWrapper(req),
new TemplateStaplerResponseWrapper(req.getStapler(), rsp));
ItemListener.fireOnUpdated(this);
// notify the queue as the project might be now tied to different node
Jenkins.getActiveInstance().getQueue().scheduleMaintenance();
// this is to reflect the upstream build adjustments done above
Jenkins.getActiveInstance().rebuildDependencyGraphAsync();
}
示例2: newProject
import hudson.model.listeners.ItemListener; //导入依赖的package包/类
/** Instantiate a new project from the json loaded from the DSL file */
private AbstractProject newProject(JSONObject json, String hash)
throws IOException {
final YamlProject<T> parent = YamlBuild.this.getParent();
final String displayName =
String.format("v%04d", parent.getItems().size());
final String jobName = String.format("%s-%s", displayName, hash);
final Binder binder = parent.getModule().getBinder(parent);
final T project = (T) binder.bindJob(parent, jobName, json);
project.setDisplayName(displayName);
// Validate that the embedded project doesn't specify source control,
// and instate our own DelegateSCM to inject our SCM into it.
checkState(project.getScm() instanceof NullSCM,
Messages.YamlBuild_DSLWithSCMError());
project.setScm(new DelegateSCM(YamlProject.class));
project.onCreatedFromScratch();
parent.addItem(project);
project.save();
ItemListener.fireOnCreated(project);
checkNotNull(Jenkins.getInstance()).rebuildDependencyGraph();
return project;
}
示例3: updateByXml
import hudson.model.listeners.ItemListener; //导入依赖的package包/类
@Override
public void updateByXml(Source source) throws IOException {
//Check if the job is a transient job; in which case this must fail
if (this.getIsTransient()) {
String msg = String.format(
"Updating %s by XML upload is not allowed: Transient project",
this.getFullName()
);
log.warning(msg);
throw new IOException(msg);
}
//Instruct the parent to update us
super.updateByXml(source);
//Then, save a new version
clearBuffers(this);
this.dumpConfigToNewVersion("New version uploaded as XML via API/CLI");
clearBuffers(this);
//Notify that this project may have changed
ItemListener.fireOnUpdated(this);
}
示例4: get
import hudson.model.listeners.ItemListener; //导入依赖的package包/类
/**
* Gets this extension's instance.
*
* @return the instance of this extension.
*/
public static ItemListenerImpl get() {
return ItemListener.all().get(ItemListenerImpl.class);
}