com.sonyericsson.hudson.plugins.gerrit.trigger.config
Class Config

java.lang.Object
  extended by com.sonyericsson.hudson.plugins.gerrit.trigger.config.Config
All Implemented Interfaces:
GerritConnectionConfig, IGerritHudsonTriggerConfig

public class Config
extends Object
implements IGerritHudsonTriggerConfig

Configuration bean for the global configuration.

Author:
Robert Sandell <robert.sandell@sonyericsson.com>

Field Summary
static boolean DEFAULT_ENABLE_MANUAL_TRIGGER
          Default verified vote to Gerrit when a build is successful.
static int DEFAULT_GERRIT_BUILD_FAILURE_CODE_REVIEW_VALUE
          Default code review vote to Gerrit when a build is failed.
static int DEFAULT_GERRIT_BUILD_FAILURE_VERIFIED_VALUE
          Default verified vote to Gerrit when a build is failed.
static int DEFAULT_GERRIT_BUILD_STARTED_CODE_REVIEW_VALUE
          Default code review vote to Gerrit when a build is started.
static int DEFAULT_GERRIT_BUILD_STARTED_VERIFIED_VALUE
          Default verified vote to Gerrit when a build is started.
static int DEFAULT_GERRIT_BUILD_SUCCESSFUL_CODE_REVIEW_VALUE
          Default code review vote to Gerrit when a build is successful.
static int DEFAULT_GERRIT_BUILD_SUCCESSFUL_VERIFIED_VALUE
          Default verified vote to Gerrit when a build is successful.
static int DEFAULT_GERRIT_BUILD_UNSTABLE_CODE_REVIEW_VALUE
          Default code review vote to Gerrit when a build is unstable.
static int DEFAULT_GERRIT_BUILD_UNSTABLE_VERIFIED_VALUE
          Default verified vote to Gerrit when a build is unstable.
 
Constructor Summary
Config()
          Constructs a config with default data.
Config(net.sf.json.JSONObject formData)
          Constructor.
Config(net.sf.json.JSONObject formData, org.kohsuke.stapler.StaplerRequest req)
          Unused Constructor?
 
Method Summary
 int getBuildScheduleDelay()
          Returns the BuildScheduleDelay.
 Authentication getGerritAuthentication()
           
 File getGerritAuthKeyFile()
           
 String getGerritAuthKeyFilePassword()
           
 int getGerritBuildFailedCodeReviewValue()
          The default code review value for build failed.
 int getGerritBuildFailedVerifiedValue()
          The default verified value for build failed.
 int getGerritBuildStartedCodeReviewValue()
          The default code review value for build started.
 int getGerritBuildStartedVerifiedValue()
          The default verified value for build started.
 int getGerritBuildSuccessfulCodeReviewValue()
          The default code review value for build successful.
 int getGerritBuildSuccessfulVerifiedValue()
          The default verified value for build successful.
 int getGerritBuildUnstableCodeReviewValue()
          The default code review value for build unstable.
 int getGerritBuildUnstableVerifiedValue()
          The default verified value for build unstable.
 String getGerritCmdBuildFailed()
          The command template to use when sending build-failed messages to Gerrit.
 String getGerritCmdBuildStarted()
          The command template to use when sending build-started messages to Gerrit.
 String getGerritCmdBuildSuccessful()
          The command template to use when sending build-successful messages to Gerrit.
 String getGerritCmdBuildUnstable()
          The command template to use when sending build-unstable messages to Gerrit.
 String getGerritFrontEndUrl()
          Base URL for the Gerrit UI.
 String getGerritFrontEndUrlFor(String changeSetNumber, String revision)
          Creates a URL to the provided changeset number.
 String getGerritHostName()
           
 int getGerritSshPort()
           
 String getGerritUserName()
           
 int getNumberOfReceivingWorkerThreads()
           
 int getNumberOfSendingWorkerThreads()
           
 boolean hasDefaultValues()
          If the plugin still has default values for hostname and frontendurl.
 boolean isEnableManualTrigger()
          If the manual trigger is enabled (shown to users) or not.
 void setBuildScheduleDelay(int buildScheduleDelay)
          Setting buildScheduleDelay.
 void setEnableManualTrigger(boolean enableManualTrigger)
          Sets if the manual trigger should be enabled or not.
 void setGerritAuthKeyFile(File gerritAuthKeyFile)
          GerritAuthKeyFile.
 void setGerritAuthKeyFilePassword(String gerritAuthKeyFilePassword)
          GerritAuthKeyFilePassword.
 void setGerritFrontEndURL(String gerritFrontEndURL)
          GerritFrontEndURL.
 void setGerritHostName(String gerritHostName)
          GerritHostName.
 void setGerritSshPort(int gerritSshPort)
          GerritSshPort.
 void setGerritUserName(String gerritUserName)
          GerritUserName.
 void setGerritVerifiedCmdBuildFailed(String cmd)
          GerritVerifiedCmdBuildFailed.
 void setGerritVerifiedCmdBuildStarted(String cmd)
          GerritVerifiedCmdBuildStarted.
 void setGerritVerifiedCmdBuildSuccessful(String cmd)
          GerritVerifiedCmdBuildSuccessful.
 void setGerritVerifiedCmdBuildUnstable(String cmd)
          GerritVerifiedCmdBuildUnstable.
 void setNumberOfReceivingWorkerThreads(int numberOfReceivingWorkerThreads)
          NumberOfWorkerThreads.
 void setValues(net.sf.json.JSONObject formData)
          Sets all config values from the provided JSONObject.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_GERRIT_BUILD_STARTED_VERIFIED_VALUE

public static final int DEFAULT_GERRIT_BUILD_STARTED_VERIFIED_VALUE
Default verified vote to Gerrit when a build is started.

See Also:
Constant Field Values

DEFAULT_GERRIT_BUILD_STARTED_CODE_REVIEW_VALUE

public static final int DEFAULT_GERRIT_BUILD_STARTED_CODE_REVIEW_VALUE
Default code review vote to Gerrit when a build is started.

See Also:
Constant Field Values

DEFAULT_GERRIT_BUILD_UNSTABLE_VERIFIED_VALUE

public static final int DEFAULT_GERRIT_BUILD_UNSTABLE_VERIFIED_VALUE
Default verified vote to Gerrit when a build is unstable.

See Also:
Constant Field Values

DEFAULT_GERRIT_BUILD_UNSTABLE_CODE_REVIEW_VALUE

public static final int DEFAULT_GERRIT_BUILD_UNSTABLE_CODE_REVIEW_VALUE
Default code review vote to Gerrit when a build is unstable.

See Also:
Constant Field Values

DEFAULT_GERRIT_BUILD_FAILURE_VERIFIED_VALUE

public static final int DEFAULT_GERRIT_BUILD_FAILURE_VERIFIED_VALUE
Default verified vote to Gerrit when a build is failed.

See Also:
Constant Field Values

DEFAULT_GERRIT_BUILD_FAILURE_CODE_REVIEW_VALUE

public static final int DEFAULT_GERRIT_BUILD_FAILURE_CODE_REVIEW_VALUE
Default code review vote to Gerrit when a build is failed.

See Also:
Constant Field Values

DEFAULT_GERRIT_BUILD_SUCCESSFUL_CODE_REVIEW_VALUE

public static final int DEFAULT_GERRIT_BUILD_SUCCESSFUL_CODE_REVIEW_VALUE
Default code review vote to Gerrit when a build is successful.

See Also:
Constant Field Values

DEFAULT_GERRIT_BUILD_SUCCESSFUL_VERIFIED_VALUE

public static final int DEFAULT_GERRIT_BUILD_SUCCESSFUL_VERIFIED_VALUE
Default verified vote to Gerrit when a build is successful.

See Also:
Constant Field Values

DEFAULT_ENABLE_MANUAL_TRIGGER

public static final boolean DEFAULT_ENABLE_MANUAL_TRIGGER
Default verified vote to Gerrit when a build is successful.

See Also:
Constant Field Values
Constructor Detail

Config

public Config(net.sf.json.JSONObject formData)
Constructor.

Parameters:
formData - the data.

Config

public Config()
Constructs a config with default data.


Config

public Config(net.sf.json.JSONObject formData,
              org.kohsuke.stapler.StaplerRequest req)
Unused Constructor?

Parameters:
formData - the data
req - a path.
Method Detail

setValues

public void setValues(net.sf.json.JSONObject formData)
Description copied from interface: IGerritHudsonTriggerConfig
Sets all config values from the provided JSONObject.

Specified by:
setValues in interface IGerritHudsonTriggerConfig
Parameters:
formData - the JSON object with form data.

getGerritAuthKeyFile

public File getGerritAuthKeyFile()
Specified by:
getGerritAuthKeyFile in interface GerritConnectionConfig

setGerritAuthKeyFile

public void setGerritAuthKeyFile(File gerritAuthKeyFile)
GerritAuthKeyFile.

Parameters:
gerritAuthKeyFile - the file
See Also:
getGerritAuthKeyFile()

getGerritAuthKeyFilePassword

public String getGerritAuthKeyFilePassword()
Specified by:
getGerritAuthKeyFilePassword in interface GerritConnectionConfig

setGerritAuthKeyFilePassword

public void setGerritAuthKeyFilePassword(String gerritAuthKeyFilePassword)
GerritAuthKeyFilePassword.

Parameters:
gerritAuthKeyFilePassword - the password
See Also:
getGerritAuthKeyFilePassword()

getGerritFrontEndUrl

public String getGerritFrontEndUrl()
Description copied from interface: IGerritHudsonTriggerConfig
Base URL for the Gerrit UI.

Specified by:
getGerritFrontEndUrl in interface IGerritHudsonTriggerConfig
Returns:
the gerrit front end URL. Always ends with '/'

setGerritFrontEndURL

public void setGerritFrontEndURL(String gerritFrontEndURL)
GerritFrontEndURL.

Parameters:
gerritFrontEndURL - the URL
See Also:
getGerritFrontEndUrl()

getGerritHostName

public String getGerritHostName()
Specified by:
getGerritHostName in interface GerritConnectionConfig

setGerritHostName

public void setGerritHostName(String gerritHostName)
GerritHostName.

Parameters:
gerritHostName - the hostname
See Also:
getGerritHostName()

getGerritSshPort

public int getGerritSshPort()
Specified by:
getGerritSshPort in interface GerritConnectionConfig

setGerritSshPort

public void setGerritSshPort(int gerritSshPort)
GerritSshPort.

Parameters:
gerritSshPort - the port
See Also:
getGerritSshPort()

getBuildScheduleDelay

public int getBuildScheduleDelay()
Description copied from interface: IGerritHudsonTriggerConfig
Returns the BuildScheduleDelay.

Specified by:
getBuildScheduleDelay in interface IGerritHudsonTriggerConfig
Returns:
the value.

setBuildScheduleDelay

public void setBuildScheduleDelay(int buildScheduleDelay)
Setting buildScheduleDelay.

Parameters:
buildScheduleDelay - the delay time
See Also:
getBuildScheduleDelay()

getGerritUserName

public String getGerritUserName()
Specified by:
getGerritUserName in interface GerritConnectionConfig

setGerritUserName

public void setGerritUserName(String gerritUserName)
GerritUserName.

Parameters:
gerritUserName - the username
See Also:
getGerritUserName()

getNumberOfReceivingWorkerThreads

public int getNumberOfReceivingWorkerThreads()
Specified by:
getNumberOfReceivingWorkerThreads in interface GerritConnectionConfig

getNumberOfSendingWorkerThreads

public int getNumberOfSendingWorkerThreads()
Specified by:
getNumberOfSendingWorkerThreads in interface GerritConnectionConfig

setNumberOfReceivingWorkerThreads

public void setNumberOfReceivingWorkerThreads(int numberOfReceivingWorkerThreads)
NumberOfWorkerThreads.

Parameters:
numberOfReceivingWorkerThreads - nr of threads.
See Also:
getNumberOfReceivingWorkerThreads()

getGerritCmdBuildSuccessful

public String getGerritCmdBuildSuccessful()
Description copied from interface: IGerritHudsonTriggerConfig
The command template to use when sending build-successful messages to Gerrit.

Specified by:
getGerritCmdBuildSuccessful in interface IGerritHudsonTriggerConfig
Returns:
the command template.

setGerritVerifiedCmdBuildSuccessful

public void setGerritVerifiedCmdBuildSuccessful(String cmd)
GerritVerifiedCmdBuildSuccessful.

Parameters:
cmd - the command
See Also:
getGerritCmdBuildSuccessful()

getGerritCmdBuildUnstable

public String getGerritCmdBuildUnstable()
Description copied from interface: IGerritHudsonTriggerConfig
The command template to use when sending build-unstable messages to Gerrit.

Specified by:
getGerritCmdBuildUnstable in interface IGerritHudsonTriggerConfig
Returns:
the command template.

setGerritVerifiedCmdBuildUnstable

public void setGerritVerifiedCmdBuildUnstable(String cmd)
GerritVerifiedCmdBuildUnstable.

Parameters:
cmd - the command
See Also:
getGerritCmdBuildUnstable()

getGerritCmdBuildFailed

public String getGerritCmdBuildFailed()
Description copied from interface: IGerritHudsonTriggerConfig
The command template to use when sending build-failed messages to Gerrit.

Specified by:
getGerritCmdBuildFailed in interface IGerritHudsonTriggerConfig
Returns:
the command template.

setGerritVerifiedCmdBuildFailed

public void setGerritVerifiedCmdBuildFailed(String cmd)
GerritVerifiedCmdBuildFailed.

Parameters:
cmd - the command
See Also:
setGerritVerifiedCmdBuildFailed(java.lang.String)

getGerritCmdBuildStarted

public String getGerritCmdBuildStarted()
Description copied from interface: IGerritHudsonTriggerConfig
The command template to use when sending build-started messages to Gerrit.

Specified by:
getGerritCmdBuildStarted in interface IGerritHudsonTriggerConfig
Returns:
the command template.

setGerritVerifiedCmdBuildStarted

public void setGerritVerifiedCmdBuildStarted(String cmd)
GerritVerifiedCmdBuildStarted.

Parameters:
cmd - the command
See Also:
getGerritCmdBuildStarted()

getGerritBuildStartedVerifiedValue

public int getGerritBuildStartedVerifiedValue()
Description copied from interface: IGerritHudsonTriggerConfig
The default verified value for build started.

Specified by:
getGerritBuildStartedVerifiedValue in interface IGerritHudsonTriggerConfig
Returns:
the value.

getGerritBuildStartedCodeReviewValue

public int getGerritBuildStartedCodeReviewValue()
Description copied from interface: IGerritHudsonTriggerConfig
The default code review value for build started.

Specified by:
getGerritBuildStartedCodeReviewValue in interface IGerritHudsonTriggerConfig
Returns:
the value.

getGerritBuildSuccessfulVerifiedValue

public int getGerritBuildSuccessfulVerifiedValue()
Description copied from interface: IGerritHudsonTriggerConfig
The default verified value for build successful.

Specified by:
getGerritBuildSuccessfulVerifiedValue in interface IGerritHudsonTriggerConfig
Returns:
the falue.

getGerritBuildSuccessfulCodeReviewValue

public int getGerritBuildSuccessfulCodeReviewValue()
Description copied from interface: IGerritHudsonTriggerConfig
The default code review value for build successful.

Specified by:
getGerritBuildSuccessfulCodeReviewValue in interface IGerritHudsonTriggerConfig
Returns:
the value.

getGerritBuildFailedVerifiedValue

public int getGerritBuildFailedVerifiedValue()
Description copied from interface: IGerritHudsonTriggerConfig
The default verified value for build failed.

Specified by:
getGerritBuildFailedVerifiedValue in interface IGerritHudsonTriggerConfig
Returns:
the value.

getGerritBuildFailedCodeReviewValue

public int getGerritBuildFailedCodeReviewValue()
Description copied from interface: IGerritHudsonTriggerConfig
The default code review value for build failed.

Specified by:
getGerritBuildFailedCodeReviewValue in interface IGerritHudsonTriggerConfig
Returns:
the value.

getGerritBuildUnstableVerifiedValue

public int getGerritBuildUnstableVerifiedValue()
Description copied from interface: IGerritHudsonTriggerConfig
The default verified value for build unstable.

Specified by:
getGerritBuildUnstableVerifiedValue in interface IGerritHudsonTriggerConfig
Returns:
the value.

getGerritBuildUnstableCodeReviewValue

public int getGerritBuildUnstableCodeReviewValue()
Description copied from interface: IGerritHudsonTriggerConfig
The default code review value for build unstable.

Specified by:
getGerritBuildUnstableCodeReviewValue in interface IGerritHudsonTriggerConfig
Returns:
the value.

getGerritFrontEndUrlFor

public String getGerritFrontEndUrlFor(String changeSetNumber,
                                      String revision)
Description copied from interface: IGerritHudsonTriggerConfig
Creates a URL to the provided changeset number.

Specified by:
getGerritFrontEndUrlFor in interface IGerritHudsonTriggerConfig
Parameters:
changeSetNumber - the changeset number
revision - the patch set number (currently not used)
Returns:
a URL based on IGerritHudsonTriggerConfig.getGerritFrontEndUrl() + / + number
See Also:
IGerritHudsonTriggerConfig.getGerritFrontEndUrl()

isEnableManualTrigger

public boolean isEnableManualTrigger()
Description copied from interface: IGerritHudsonTriggerConfig
If the manual trigger is enabled (shown to users) or not.

Specified by:
isEnableManualTrigger in interface IGerritHudsonTriggerConfig
Returns:
true if so.

setEnableManualTrigger

public void setEnableManualTrigger(boolean enableManualTrigger)
Sets if the manual trigger should be enabled or not.

Parameters:
enableManualTrigger - true if it should be enabled/shown.
See Also:
isEnableManualTrigger()

getGerritAuthentication

public Authentication getGerritAuthentication()
Specified by:
getGerritAuthentication in interface GerritConnectionConfig

hasDefaultValues

public boolean hasDefaultValues()
Description copied from interface: IGerritHudsonTriggerConfig
If the plugin still has default values for hostname and frontendurl.

Specified by:
hasDefaultValues in interface IGerritHudsonTriggerConfig
Returns:
true if so.


Copyright © 2004-2011. All Rights Reserved.