Class Config

  • All Implemented Interfaces:
    IGerritHudsonTriggerConfig, com.sonymobile.tools.gerrit.gerritevents.GerritConnectionConfig, com.sonymobile.tools.gerrit.gerritevents.GerritConnectionConfig2, com.sonymobile.tools.gerrit.gerritevents.rest.RestConnectionConfig, com.sonymobile.tools.gerrit.gerritevents.ssh.SshConnectionConfig

    public class Config
    extends Object
    implements IGerritHudsonTriggerConfig
    Configuration bean for the global configuration.
    Author:
    Robert Sandell <robert.sandell@sonyericsson.com>
    • 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_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_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_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_GERRIT_BUILD_NOT_BUILT_VERIFIED_VALUE

        public static final int DEFAULT_GERRIT_BUILD_NOT_BUILT_VERIFIED_VALUE
        Default verified vote to Gerrit when a build is not built.
        See Also:
        Constant Field Values
      • DEFAULT_GERRIT_BUILD_ABORTED_VERIFIED_VALUE

        public static final int DEFAULT_GERRIT_BUILD_ABORTED_VERIFIED_VALUE
        Default verified vote to Gerrit when a build is aborted.
        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_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_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_NOT_BUILT_CODE_REVIEW_VALUE

        public static final int DEFAULT_GERRIT_BUILD_NOT_BUILT_CODE_REVIEW_VALUE
        Default code review vote to Gerrit when a build is not built.
        See Also:
        Constant Field Values
      • DEFAULT_GERRIT_BUILD_ABORTED_CODE_REVIEW_VALUE

        public static final int DEFAULT_GERRIT_BUILD_ABORTED_CODE_REVIEW_VALUE
        Default code review vote to Gerrit when a build is aborted.
        See Also:
        Constant Field Values
      • DEFAULT_ENABLE_PROJECT_AUTO_COMPLETION

        public static final boolean DEFAULT_ENABLE_PROJECT_AUTO_COMPLETION
        Default value indicating if the Gerrit server should be used to fetch project names.
        See Also:
        Constant Field Values
      • DEFAULT_DYNAMIC_CONFIG_REFRESH_INTERVAL

        public static final int DEFAULT_DYNAMIC_CONFIG_REFRESH_INTERVAL
        Default value for the dynamic config refresh interval.
        See Also:
        Constant Field Values
      • DEFAULT_PROJECT_LIST_FETCH_DELAY

        public static final int DEFAULT_PROJECT_LIST_FETCH_DELAY
        Default value showing how many seconds between startup and initial project list fetch.
        See Also:
        Constant Field Values
      • DEFAULT_PROJECT_LIST_REFRESH_INTERVAL

        public static final int DEFAULT_PROJECT_LIST_REFRESH_INTERVAL
        Default value showing how many seconds between project list fetches.

        Only used for Gerrit servers with version < 2.12

        See Also:
        Constant Field Values
      • DEFAULT_GERRIT_WATCHDOG_TIMEOUT_MINUTES

        public static final int DEFAULT_GERRIT_WATCHDOG_TIMEOUT_MINUTES
        Default timeout value in minutes for the connection watchdog.
        See Also:
        Constant Field Values
      • DEFAULT_ENABLE_MANUAL_TRIGGER

        public static final boolean DEFAULT_ENABLE_MANUAL_TRIGGER
        Default manual trigger enabled.
        See Also:
        Constant Field Values
      • DEFAULT_ENABLE_PLUGIN_MESSAGES

        public static final boolean DEFAULT_ENABLE_PLUGIN_MESSAGES
        Default plug-in messages enabled.
        See Also:
        Constant Field Values
      • DEFAULT_ENABLE_TOPIC_ASSOCIATION

        public static final boolean DEFAULT_ENABLE_TOPIC_ASSOCIATION
        Default topic association enabled.
        See Also:
        Constant Field Values
      • DEFAULT_TRIGGER_ON_ALL_COMMENTS

        public static final boolean DEFAULT_TRIGGER_ON_ALL_COMMENTS
        Default value for the option to allow triggering on messages for any user.
        See Also:
        Constant Field Values
      • DEFAULT_NOTIFICATION_LEVEL

        public static final com.sonymobile.tools.gerrit.gerritevents.dto.rest.Notify DEFAULT_NOTIFICATION_LEVEL
        Global default for notification level.
    • Constructor Detail

      • Config

        public Config​(net.sf.json.JSONObject formData)
        Constructor.
        Parameters:
        formData - the data.
      • Config

        public Config​(IGerritHudsonTriggerConfig config)
        Copy constructor.
        Parameters:
        config - the Config object to be copied.
      • Config

        @DataBoundConstructor
        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 com.sonymobile.tools.gerrit.gerritevents.ssh.SshConnectionConfig
      • setGerritAuthKeyFile

        public void setGerritAuthKeyFile​(File gerritAuthKeyFile)
        GerritAuthKeyFile.
        Parameters:
        gerritAuthKeyFile - the file
        See Also:
        getGerritAuthKeyFile()
      • getGerritAuthKeyFilePassword

        public String getGerritAuthKeyFilePassword()
        Specified by:
        getGerritAuthKeyFilePassword in interface com.sonymobile.tools.gerrit.gerritevents.ssh.SshConnectionConfig
      • 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 com.sonymobile.tools.gerrit.gerritevents.GerritConnectionConfig
        Specified by:
        getGerritFrontEndUrl in interface IGerritHudsonTriggerConfig
        Specified by:
        getGerritFrontEndUrl in interface com.sonymobile.tools.gerrit.gerritevents.rest.RestConnectionConfig
        Returns:
        the gerrit front end URL. Always ends with '/'
      • setGerritFrontEndURL

        public void setGerritFrontEndURL​(String gerritFrontEndURL)
        GerritFrontEndURL.
        Parameters:
        gerritFrontEndURL - the URL
        See Also:
        getGerritFrontEndUrl()
      • setGerritFrontEndUrl

        public void setGerritFrontEndUrl​(String gerritFrontEndURL)
        This method is needed for configuration as code to discover this property. It would be ignored otherwise because of the "URL" vs. "Url" naming mismatch in old getter/setter.
        Parameters:
        gerritFrontEndURL - the Url
      • getGerritHostName

        public String getGerritHostName()
        Specified by:
        getGerritHostName in interface com.sonymobile.tools.gerrit.gerritevents.ssh.SshConnectionConfig
      • setGerritHostName

        public void setGerritHostName​(String gerritHostName)
        GerritHostName.
        Parameters:
        gerritHostName - the hostname
        See Also:
        getGerritHostName()
      • getGerritSshPort

        public int getGerritSshPort()
        Specified by:
        getGerritSshPort in interface com.sonymobile.tools.gerrit.gerritevents.ssh.SshConnectionConfig
      • setGerritSshPort

        public void setGerritSshPort​(int gerritSshPort)
        GerritSshPort.
        Parameters:
        gerritSshPort - the port
        See Also:
        getGerritSshPort()
      • getGerritProxy

        public String getGerritProxy()
        Specified by:
        getGerritProxy in interface com.sonymobile.tools.gerrit.gerritevents.rest.RestConnectionConfig
        Specified by:
        getGerritProxy in interface com.sonymobile.tools.gerrit.gerritevents.ssh.SshConnectionConfig
      • setGerritProxy

        public void setGerritProxy​(String gerritProxy)
        GerritProxy.
        Parameters:
        gerritProxy - the proxy url
        See Also:
        getGerritProxy()
      • setBuildScheduleDelay

        public void setBuildScheduleDelay​(int buildScheduleDelay)
        Setting buildScheduleDelay.
        Parameters:
        buildScheduleDelay - the delay time
        See Also:
        getBuildScheduleDelay()
      • setProjectListFetchDelay

        public void setProjectListFetchDelay​(int projectListFetchDelay)
        Sets the delay from Jenkins startup before the project list should be fetched.
        Parameters:
        projectListFetchDelay - the delay
        See Also:
        getProjectListFetchDelay(), isEnableProjectAutoCompletion()
      • setDynamicConfigRefreshInterval

        public void setDynamicConfigRefreshInterval​(int dynamicConfigRefreshInterval)
        Setting dynamicConfigRefreshInterval.
        Parameters:
        dynamicConfigRefreshInterval - the interval between the fetches.
        See Also:
        getDynamicConfigRefreshInterval()
      • getGerritUserName

        public String getGerritUserName()
        Specified by:
        getGerritUserName in interface com.sonymobile.tools.gerrit.gerritevents.ssh.SshConnectionConfig
      • setGerritUserName

        public void setGerritUserName​(String gerritUserName)
        GerritUserName.
        Parameters:
        gerritUserName - the username
        See Also:
        getGerritUserName()
      • getGerritEMail

        public String getGerritEMail()
        Specified by:
        getGerritEMail in interface com.sonymobile.tools.gerrit.gerritevents.GerritConnectionConfig
      • setGerritEMail

        public void setGerritEMail​(String gerritEMail)
        The e-mail address for the user in gerrit. Comments added from this e-mail address will be ignored.
        Parameters:
        gerritEMail - the e-mail address.
        See Also:
        getGerritEMail()
      • setNotificationLevel

        public void setNotificationLevel​(com.sonymobile.tools.gerrit.gerritevents.dto.rest.Notify notificationLevel)
        Sets the value for whom to notify.
        Parameters:
        notificationLevel - the notification level.
      • setNumberOfReceivingWorkerThreads

        @Deprecated
        public void setNumberOfReceivingWorkerThreads​(int numberOfReceivingWorkerThreads)
        Deprecated.
        NumberOfWorkerThreads.
        Parameters:
        numberOfReceivingWorkerThreads - nr of threads.
        See Also:
        getNumberOfReceivingWorkerThreads()
      • setBuildCurrentPatchesOnly

        public void setBuildCurrentPatchesOnly​(BuildCancellationPolicy buildCurrentPatchesOnly)
        Set build cancellation policy for current patches. Exposed for configuration as code.
        Parameters:
        buildCurrentPatchesOnly - new policy.
      • setVoteSameTopic

        public void setVoteSameTopic​(boolean voteSameTopic)
        Standard setter for the voteSameTopic value.
        Parameters:
        voteSameTopic - true if patchsets with same topic should be voted together.
      • getVoteSameTopicDescription

        public String getVoteSameTopicDescription()
        Returns the description message for the jelly entry.
        Returns:
        descriptionMsg for jelly.
      • setGerritVerifiedCmdBuildSuccessful

        @Deprecated
        public void setGerritVerifiedCmdBuildSuccessful​(String cmd)
        Deprecated.
        Set Gerrit Verified Cmd Build Successful.
        Parameters:
        cmd - the command
        See Also:
        getGerritCmdBuildSuccessful()
      • setGerritCmdBuildSuccessful

        public void setGerritCmdBuildSuccessful​(String cmd)
        Set Gerrit Verified Cmd Build Successful.
        Parameters:
        cmd - the Gerrit command for successful verification
        See Also:
        getGerritCmdBuildSuccessful()
      • setGerritVerifiedCmdBuildUnstable

        @Deprecated
        public void setGerritVerifiedCmdBuildUnstable​(String cmd)
        Deprecated.
        Set Gerrit Verified Cmd Build Unstable.
        Parameters:
        cmd - the command
        See Also:
        getGerritCmdBuildUnstable()
      • setGerritCmdBuildUnstable

        public void setGerritCmdBuildUnstable​(String cmd)
        Set Gerrit Verified Cmd Build Unstable.
        Parameters:
        cmd - the command
        See Also:
        getGerritCmdBuildUnstable()
      • setGerritVerifiedCmdBuildFailed

        @Deprecated
        public void setGerritVerifiedCmdBuildFailed​(String cmd)
        Deprecated.
        Set Gerrit Verified Cmd Build Failed.
        Parameters:
        cmd - the command
        See Also:
        getGerritCmdBuildFailed()
      • setGerritCmdBuildFailed

        public void setGerritCmdBuildFailed​(String cmd)
        Set Gerrit Verified Cmd Build Failed.
        Parameters:
        cmd - the command
        See Also:
        getGerritCmdBuildFailed()
      • setGerritVerifiedCmdBuildStarted

        @Deprecated
        public void setGerritVerifiedCmdBuildStarted​(String cmd)
        Deprecated.
        Set Gerrit Verified Cmd Build Started.
        Parameters:
        cmd - the command
        See Also:
        getGerritCmdBuildStarted()
      • setGerritCmdBuildStarted

        public void setGerritCmdBuildStarted​(String cmd)
        Set Gerrit Verified Cmd Build Started.
        Parameters:
        cmd - the command
        See Also:
        getGerritCmdBuildStarted()
      • setGerritVerifiedCmdBuildNotBuilt

        @Deprecated
        public void setGerritVerifiedCmdBuildNotBuilt​(String cmd)
        Deprecated.
        Set Gerrit Verified Cmd Build NotBuilt.
        Parameters:
        cmd - the command
        See Also:
        getGerritCmdBuildNotBuilt()
      • setGerritCmdBuildNotBuilt

        public void setGerritCmdBuildNotBuilt​(String cmd)
        Set Gerrit Verified Cmd Build NotBuilt.
        Parameters:
        cmd - the command
        See Also:
        getGerritCmdBuildNotBuilt()
      • setGerritVerifiedCmdBuildAborted

        @Deprecated
        public void setGerritVerifiedCmdBuildAborted​(String cmd)
        Deprecated.
        Set Gerrit Verified Cmd Build Aborted.
        Parameters:
        cmd - the command
        See Also:
        getGerritCmdBuildAborted()
      • setGerritCmdBuildAborted

        public void setGerritCmdBuildAborted​(String cmd)
        Set Gerrit Verified Cmd Build Aborted.
        Parameters:
        cmd - the command
        See Also:
        getGerritCmdBuildAborted()
      • setGerritBuildStartedVerifiedValue

        public void setGerritBuildStartedVerifiedValue​(Integer gerritBuildStartedVerifiedValue)
        Set Gerrit Build Started Verified Value.
        Parameters:
        gerritBuildStartedVerifiedValue - value
      • setGerritBuildSuccessfulVerifiedValue

        public void setGerritBuildSuccessfulVerifiedValue​(Integer gerritBuildSuccessfulVerifiedValue)
        Set Gerrit Build Sucessful Verified Value.
        Parameters:
        gerritBuildSuccessfulVerifiedValue - value
      • setGerritBuildFailedVerifiedValue

        public void setGerritBuildFailedVerifiedValue​(Integer gerritBuildFailedVerifiedValue)
        Set Gerrit Build Failed Verified Value.
        Parameters:
        gerritBuildFailedVerifiedValue - value
      • setGerritBuildUnstableVerifiedValue

        public void setGerritBuildUnstableVerifiedValue​(Integer gerritBuildUnstableVerifiedValue)
        Set Gerrit Build Unstable Verified Value.
        Parameters:
        gerritBuildUnstableVerifiedValue - value
      • setGerritBuildNotBuiltVerifiedValue

        public void setGerritBuildNotBuiltVerifiedValue​(Integer gerritBuildNotBuiltVerifiedValue)
        Set Gerrit Build Not Build Verified Value.
        Parameters:
        gerritBuildNotBuiltVerifiedValue - value
      • setGerritBuildAbortedVerifiedValue

        public void setGerritBuildAbortedVerifiedValue​(Integer gerritBuildAbortedVerifiedValue)
        Set Gerrit Build Aborted Verified Value.
        Parameters:
        gerritBuildAbortedVerifiedValue - value
      • setGerritBuildStartedCodeReviewValue

        public void setGerritBuildStartedCodeReviewValue​(Integer gerritBuildStartedCodeReviewValue)
        Set Gerrit Build Started Code Review Value.
        Parameters:
        gerritBuildStartedCodeReviewValue - value
      • setGerritBuildSuccessfulCodeReviewValue

        public void setGerritBuildSuccessfulCodeReviewValue​(Integer gerritBuildSuccessfulCodeReviewValue)
        Set Gerrit Build Successful Code Review Value.
        Parameters:
        gerritBuildSuccessfulCodeReviewValue - value
      • setGerritBuildFailedCodeReviewValue

        public void setGerritBuildFailedCodeReviewValue​(Integer gerritBuildFailedCodeReviewValue)
        Set Gerrit Build Failed Code Review Value.
        Parameters:
        gerritBuildFailedCodeReviewValue - value
      • setGerritBuildUnstableCodeReviewValue

        public void setGerritBuildUnstableCodeReviewValue​(Integer gerritBuildUnstableCodeReviewValue)
        Set Gerrit Build Unstable Code Review Value.
        Parameters:
        gerritBuildUnstableCodeReviewValue - value
      • setGerritBuildNotBuiltCodeReviewValue

        public void setGerritBuildNotBuiltCodeReviewValue​(Integer gerritBuildNotBuiltCodeReviewValue)
        Set Gerrit Build Not Build Code Review Value.
        Parameters:
        gerritBuildNotBuiltCodeReviewValue - value
      • setGerritBuildAbortedCodeReviewValue

        public void setGerritBuildAbortedCodeReviewValue​(Integer gerritBuildAbortedCodeReviewValue)
        Set Gerrit Build Aborted Code Review Value.
        Parameters:
        gerritBuildAbortedCodeReviewValue - value
      • 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 com.sonymobile.tools.gerrit.gerritevents.ssh.Authentication getGerritAuthentication()
        Specified by:
        getGerritAuthentication in interface com.sonymobile.tools.gerrit.gerritevents.ssh.SshConnectionConfig
      • setTriggerOnAllComments

        public void setTriggerOnAllComments​(boolean triggerOnAllComments)
        Sets triggerOnAllComments.
        Parameters:
        triggerOnAllComments - true if so
        See Also:
        isTriggerOnAllComments()
      • setReplicationConfig

        public void setReplicationConfig​(ReplicationConfig replicationConfig)
        Set replication config.
        Parameters:
        replicationConfig - The config
      • getWatchdogTimeoutSeconds

        public int getWatchdogTimeoutSeconds()
        Specified by:
        getWatchdogTimeoutSeconds in interface com.sonymobile.tools.gerrit.gerritevents.GerritConnectionConfig2
      • getWatchdogTimeoutMinutes

        public int getWatchdogTimeoutMinutes()
        Convenience getter for the jelly view.
        Specified by:
        getWatchdogTimeoutMinutes in interface com.sonymobile.tools.gerrit.gerritevents.GerritConnectionConfig2
        Returns:
        the watchdogTimeoutMinutes.
      • setWatchdogTimeoutMinutes

        public void setWatchdogTimeoutMinutes​(int watchdogTimeoutMinutes)
        Set watchdog timeout.
        Parameters:
        watchdogTimeoutMinutes - Number of minutes.
      • getExceptionData

        public com.sonymobile.tools.gerrit.gerritevents.watchdog.WatchTimeExceptionData getExceptionData()
        Specified by:
        getExceptionData in interface com.sonymobile.tools.gerrit.gerritevents.GerritConnectionConfig2
      • setExceptionData

        public void setExceptionData​(com.sonymobile.tools.gerrit.gerritevents.watchdog.WatchTimeExceptionData exceptionData)
        Set exception data.
        Parameters:
        exceptionData - The data.
      • setUseRestApi

        public void setUseRestApi​(boolean useRestApi)
        Sets useRestApi.
        Parameters:
        useRestApi - true if so
        See Also:
        isUseRestApi()
      • setGerritHttpPassword

        public void setGerritHttpPassword​(String gerritHttpPassword)
        Sets gerritHttpPassword.
        Parameters:
        gerritHttpPassword - the password
        See Also:
        getGerritHttpPassword()
      • setGerritHttpUserName

        public void setGerritHttpUserName​(String gerritHttpUserName)
        Sets gerritHttpUserName.
        Parameters:
        gerritHttpUserName - the username
        See Also:
        getGerritHttpUserName()
      • getHttpCredentials

        public org.apache.http.auth.Credentials getHttpCredentials()
        Specified by:
        getHttpCredentials in interface com.sonymobile.tools.gerrit.gerritevents.rest.RestConnectionConfig
      • setRestCodeReview

        public void setRestCodeReview​(boolean restCodeReview)
        Sets restCodeReview.
        Parameters:
        restCodeReview - true if include Code-Review label to REST API for ReviewInput.
      • setRestVerified

        public void setRestVerified​(boolean restVerified)
        Sets restVerified.
        Parameters:
        restVerified - true if include Verified label to REST API for ReviewInput.