Java 类hudson.model.listeners.ItemListener 实例源码

项目:multi-branch-project-plugin    文件:TemplateDrivenMultiBranchProject.java   
/**
 * 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();
}
项目:yaml-project-plugin    文件:YamlBuild.java   
/** 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;
}
项目:jenkins-inheritance-plugin    文件:InheritanceProject.java   
@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);
}
项目:rabbitmq-consumer-plugin    文件:ItemListenerImpl.java   
/**
 * Gets this extension's instance.
 * 
 * @return the instance of this extension.
 */
public static ItemListenerImpl get() {
    return ItemListener.all().get(ItemListenerImpl.class);
}