org.jenkinsci.plugins.ParameterizedRemoteTrigger
Class RemoteBuildConfiguration

java.lang.Object
  extended by hudson.tasks.BuildStepCompatibilityLayer
      extended by hudson.tasks.Builder
          extended by org.jenkinsci.plugins.ParameterizedRemoteTrigger.RemoteBuildConfiguration
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.model.Describable<hudson.tasks.Builder>, hudson.tasks.BuildStep

public class RemoteBuildConfiguration
extends hudson.tasks.Builder

Author:
Maurice W.

Nested Class Summary
static class RemoteBuildConfiguration.DescriptorImpl
           
 
Nested classes/interfaces inherited from interface hudson.tasks.BuildStep
hudson.tasks.BuildStep.PublisherList
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
 
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS
 
Constructor Summary
RemoteBuildConfiguration(String remoteJenkinsName, boolean shouldNotFailBuild, boolean preventRemoteBuildQueue, boolean blockBuildUntilComplete, int pollInterval, String job, String token, String parameters)
           
RemoteBuildConfiguration(String remoteJenkinsName, boolean shouldNotFailBuild, String job, String token, String parameters, net.sf.json.JSONObject overrideAuth, net.sf.json.JSONObject loadParamsFromFile, boolean preventRemoteBuildQueue, boolean blockBuildUntilComplete, int pollInterval)
           
 
Method Summary
 RemoteJenkinsServer findRemoteHost(String displayName)
          Lookup up a Remote Jenkins Server based on display name
 Auth[] getAuth()
           
 boolean getBlockBuildUntilComplete()
           
 String getBuildStatus(String buildUrlString, hudson.model.AbstractBuild build, hudson.model.BuildListener listener)
           
 int getConnectionRetryLimit()
           
 RemoteBuildConfiguration.DescriptorImpl getDescriptor()
           
 String getJob()
           
 boolean getLoadParamsFromFile()
           
 boolean getOverrideAuth()
           
 String getParameterFile()
           
 String getParameters()
           
 int getPollInterval()
           
 boolean getPreventRemoteBuildQueue()
           
 String getQueryString()
           
 String getRemoteJenkinsName()
           
 boolean getShouldNotFailBuild()
           
 String getToken()
           
 boolean perform(hudson.model.AbstractBuild build, hudson.Launcher launcher, hudson.model.BuildListener listener)
           
 net.sf.json.JSONObject sendHTTPCall(String urlString, String requestType, hudson.model.AbstractBuild build, hudson.model.BuildListener listener)
          Orchestrates all calls to the remote server.
 net.sf.json.JSONObject sendHTTPCall(String urlString, String requestType, hudson.model.AbstractBuild build, hudson.model.BuildListener listener, int numberOfAttempts)
          Same as sendHTTPCall, but keeps track of the number of failed connection attempts (aka: the number of times this method has been called).
 
Methods inherited from class hudson.tasks.Builder
all, getRequiredMonitorService, prebuild
 
Methods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, 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
 

Constructor Detail

RemoteBuildConfiguration

@DataBoundConstructor
public RemoteBuildConfiguration(String remoteJenkinsName,
                                                     boolean shouldNotFailBuild,
                                                     String job,
                                                     String token,
                                                     String parameters,
                                                     net.sf.json.JSONObject overrideAuth,
                                                     net.sf.json.JSONObject loadParamsFromFile,
                                                     boolean preventRemoteBuildQueue,
                                                     boolean blockBuildUntilComplete,
                                                     int pollInterval)
                         throws MalformedURLException
Throws:
MalformedURLException

RemoteBuildConfiguration

public RemoteBuildConfiguration(String remoteJenkinsName,
                                boolean shouldNotFailBuild,
                                boolean preventRemoteBuildQueue,
                                boolean blockBuildUntilComplete,
                                int pollInterval,
                                String job,
                                String token,
                                String parameters)
                         throws MalformedURLException
Throws:
MalformedURLException
Method Detail

findRemoteHost

public RemoteJenkinsServer findRemoteHost(String displayName)
Lookup up a Remote Jenkins Server based on display name

Parameters:
displayName - Name of the configuration you are looking for
Returns:
A RemoteSitez object

perform

public boolean perform(hudson.model.AbstractBuild build,
                       hudson.Launcher launcher,
                       hudson.model.BuildListener listener)
                throws InterruptedException,
                       IOException,
                       IllegalArgumentException
Specified by:
perform in interface hudson.tasks.BuildStep
Overrides:
perform in class hudson.tasks.BuildStepCompatibilityLayer
Throws:
InterruptedException
IOException
IllegalArgumentException

getBuildStatus

public String getBuildStatus(String buildUrlString,
                             hudson.model.AbstractBuild build,
                             hudson.model.BuildListener listener)
                      throws IOException
Throws:
IOException

sendHTTPCall

public net.sf.json.JSONObject sendHTTPCall(String urlString,
                                           String requestType,
                                           hudson.model.AbstractBuild build,
                                           hudson.model.BuildListener listener)
                                    throws IOException
Orchestrates all calls to the remote server. Also takes care of any credentials or failed-connection retries.

Parameters:
urlString - the URL that needs to be called
requestType - the type of request (GET, POST, etc)
build - the build that is being triggered
listener - build listener
Returns:
a valid JSON object, or null
Throws:
IOException

sendHTTPCall

public net.sf.json.JSONObject sendHTTPCall(String urlString,
                                           String requestType,
                                           hudson.model.AbstractBuild build,
                                           hudson.model.BuildListener listener,
                                           int numberOfAttempts)
                                    throws IOException
Same as sendHTTPCall, but keeps track of the number of failed connection attempts (aka: the number of times this method has been called). In the case of a failed connection, the method calls it self recursively and increments numberOfAttempts

Parameters:
numberOfAttempts - number of time that the connection has been attempted
Returns:
Throws:
IOException
See Also:
sendHTTPCall

getRemoteJenkinsName

public String getRemoteJenkinsName()

getJob

public String getJob()

getShouldNotFailBuild

public boolean getShouldNotFailBuild()

getPreventRemoteBuildQueue

public boolean getPreventRemoteBuildQueue()

getBlockBuildUntilComplete

public boolean getBlockBuildUntilComplete()

getPollInterval

public int getPollInterval()

getConnectionRetryLimit

public int getConnectionRetryLimit()
Returns:
the connectionRetryLimit

getToken

public String getToken()

getLoadParamsFromFile

public boolean getLoadParamsFromFile()

getParameterFile

public String getParameterFile()

getOverrideAuth

public boolean getOverrideAuth()

getAuth

public Auth[] getAuth()

getParameters

public String getParameters()

getQueryString

public String getQueryString()

getDescriptor

public RemoteBuildConfiguration.DescriptorImpl getDescriptor()
Specified by:
getDescriptor in interface hudson.model.Describable<hudson.tasks.Builder>
Overrides:
getDescriptor in class hudson.tasks.Builder


Copyright © 2004-2014. All Rights Reserved.