com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger
Class GerritDelayedApprover

java.lang.Object
  extended by hudson.tasks.BuildStepCompatibilityLayer
      extended by hudson.tasks.Publisher
          extended by hudson.tasks.Notifier
              extended by com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritDelayedApprover
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.model.Describable<hudson.tasks.Publisher>, hudson.tasks.BuildStep

public class GerritDelayedApprover
extends hudson.tasks.Notifier

Triggers a build previously run to send its report to Gerrit, if it hadn't yet.

Author:
Yannick Bréhon <yannick.brehon@smartmatic.com>

Nested Class Summary
static class GerritDelayedApprover.GerritDelayedApproverDescriptor
          Descriptor class.
 
Nested classes/interfaces inherited from class hudson.tasks.Publisher
hudson.tasks.Publisher.DescriptorExtensionListImpl
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Nested classes/interfaces inherited from interface hudson.tasks.BuildStep
hudson.tasks.BuildStep.PublisherList
 
Field Summary
static GerritDelayedApprover.GerritDelayedApproverDescriptor DESCRIPTOR
          The associated descriptor instance.
 
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS
 
Constructor Summary
GerritDelayedApprover(String delayedJob, String delayedBuildNumber)
          Default DataBound Constructor.
 
Method Summary
 String getDelayedBuildNumber()
          The delayedBuildNumber, ie number of the build which may need a delayed approval.
 String getDelayedJob()
          The delayedJob, ie the name of the job which may need a delayed approval.
 hudson.tasks.BuildStepDescriptor<hudson.tasks.Publisher> getDescriptor()
          getter for the Descriptor.
 hudson.tasks.BuildStepMonitor getRequiredMonitorService()
          No concurrency management is required, new style extension.
 hudson.model.AbstractBuild locateBuild(String jobName, int buildNumber)
          Finds a build based on the project name and build number.
 boolean needsToRunAfterFinalized()
          This extension needs to run after the build is completed.
 boolean perform(hudson.model.AbstractBuild<?,?> build, hudson.Launcher launcher, hudson.model.BuildListener listener)
          The actual performer method which will run in a post-build step and close a Gerrit Triggered event.
 void performLogger(PrintStream consoleLogger, String message)
          Logging method which will log to the build's output if possible (not possible during unit-tests).
 void setDelayedBuildNumber(String delayedBuildNumber)
          Sets the delayedBuildNumber.
 void setDelayedJob(String delayedJob)
          Sets the delayedJob.
 
Methods inherited from class hudson.tasks.Publisher
all, getProjectAction, prebuild
 
Methods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, getProjectActions, perform, prebuild
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hudson.tasks.BuildStep
getProjectAction, getProjectActions, prebuild
 

Field Detail

DESCRIPTOR

public static final GerritDelayedApprover.GerritDelayedApproverDescriptor DESCRIPTOR
The associated descriptor instance.

Constructor Detail

GerritDelayedApprover

@DataBoundConstructor
public GerritDelayedApprover(String delayedJob,
                                                  String delayedBuildNumber)
Default DataBound Constructor.

Parameters:
delayedJob - the name of the job which may need a delayed approval. buildVariables are expanded.
delayedBuildNumber - the number of the build which may need a delayed approval. buildVariables are expanded.
Method Detail

getDelayedBuildNumber

public String getDelayedBuildNumber()
The delayedBuildNumber, ie number of the build which may need a delayed approval.

Returns:
the delayedBuildNumber

setDelayedBuildNumber

public void setDelayedBuildNumber(String delayedBuildNumber)
Sets the delayedBuildNumber.

Parameters:
delayedBuildNumber - the delayedBuildNumber

getDelayedJob

public String getDelayedJob()
The delayedJob, ie the name of the job which may need a delayed approval.

Returns:
the delayedJob

setDelayedJob

public void setDelayedJob(String delayedJob)
Sets the delayedJob.

Parameters:
delayedJob - the delayedJob

getRequiredMonitorService

public hudson.tasks.BuildStepMonitor getRequiredMonitorService()
No concurrency management is required, new style extension.

Returns:
BuildStepMonitor.NONE

needsToRunAfterFinalized

public boolean needsToRunAfterFinalized()
This extension needs to run after the build is completed.

Overrides:
needsToRunAfterFinalized in class hudson.tasks.Publisher
Returns:
true

perform

public boolean perform(hudson.model.AbstractBuild<?,?> build,
                       hudson.Launcher launcher,
                       hudson.model.BuildListener listener)
                throws InterruptedException
The actual performer method which will run in a post-build step and close a Gerrit Triggered event.

Specified by:
perform in interface hudson.tasks.BuildStep
Overrides:
perform in class hudson.tasks.BuildStepCompatibilityLayer
Parameters:
build - current build
launcher - launcher
listener - the build listener
Returns:
boolean indicating whether this perform step succeeded
Throws:
InterruptedException - if interrupted

performLogger

public void performLogger(PrintStream consoleLogger,
                          String message)
Logging method which will log to the build's output if possible (not possible during unit-tests).

Parameters:
consoleLogger - the logger to use for logging
message - the message to log

locateBuild

public hudson.model.AbstractBuild locateBuild(String jobName,
                                              int buildNumber)
Finds a build based on the project name and build number.

Parameters:
jobName - the name of the project inspected
buildNumber - the number of the build searched
Returns:
the build found (may be null)

getDescriptor

public hudson.tasks.BuildStepDescriptor<hudson.tasks.Publisher> getDescriptor()
getter for the Descriptor.

Specified by:
getDescriptor in interface hudson.model.Describable<hudson.tasks.Publisher>
Overrides:
getDescriptor in class hudson.tasks.Notifier
Returns:
the associated descriptor


Copyright © 2004-2014. All Rights Reserved.