org.jenkinsci.plugins.periodicreincarnation
Class PeriodicReincarnationGlobalConfiguration

java.lang.Object
  extended by hudson.model.Descriptor<jenkins.model.GlobalConfiguration>
      extended by jenkins.model.GlobalConfiguration
          extended by org.jenkinsci.plugins.periodicreincarnation.PeriodicReincarnationGlobalConfiguration
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.model.Describable<jenkins.model.GlobalConfiguration>, hudson.model.Saveable

@Extension
public class PeriodicReincarnationGlobalConfiguration
extends jenkins.model.GlobalConfiguration

Implements the interface GlobalConfiguration from Jenkins. Gives the option to configure how this plugin works, what should be restarted and when it should be restarted.. With the help of the load() and save() method the configuration is loaded when instancing this class and saved when changing it. This class has a corresponding jelly file that represents a section in the global configuration.

Author:
yboev

Nested Class Summary
 
Nested classes/interfaces inherited from class hudson.model.Descriptor
hudson.model.Descriptor.FormException, hudson.model.Descriptor.PropertyType, hudson.model.Descriptor.Self
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
 
Fields inherited from class hudson.model.Descriptor
clazz
 
Fields inherited from interface hudson.model.Saveable
NOOP
 
Constructor Summary
PeriodicReincarnationGlobalConfiguration()
          Constructor.
PeriodicReincarnationGlobalConfiguration(String activeTrigger, String maxDepth, String activeCron, String cronTime, List<RegEx> regExprs, String noChange)
          Constructor.
 
Method Summary
 boolean configure(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject json)
           This method defines what happens when we save to configuration.
 hudson.util.FormValidation doCheckCronTime(String value)
          Check method for the cron time.
 hudson.util.FormValidation doCheckRegExCronTime(String value)
          Checks if a cron tab for a regEx can be compiled.
 hudson.util.FormValidation doCheckRegExValue(String value)
          Checks if a regular expression entered be compiled.
static PeriodicReincarnationGlobalConfiguration get()
          Finds and returns the configuration class.
 String getActiveCron()
          Returns the field activeCron.
 String getActiveTrigger()
          Returns the field activeTrigger.
 String getCronTime()
          Returns the field cron time.
 int getMaxDepth()
          returns the maximal number of consecutive afterbuild retries.
 String getNoChange()
          Returns the field noChange.
 List<RegEx> getRegExprs()
          Returns a list containing all regular expressions.
 boolean isCronActive()
          Tells if the cron restart is activated or not.
 boolean isRestartUnchangedJobsEnabled()
          See noChange.
 boolean isTriggerActive()
          Tells if the afterbuild restart is activated or not.
 
Methods inherited from class jenkins.model.GlobalConfiguration
all, getCategory, getDescriptor, getDisplayName, getGlobalConfigPage
 
Methods inherited from class hudson.model.Descriptor
addHelpFileRedirect, calcAutoCompleteSettings, calcFillSettings, configure, doHelp, find, find, getCheckUrl, getConfigFile, getConfigPage, getCurrentDescriptorByNameUrl, getDescriptorFullUrl, getDescriptorUrl, getGlobalPropertyType, getHelpFile, getHelpFile, getHelpFile, getId, getJsonSafeClassName, getKlass, getPlugin, getPossibleViewNames, getPropertyType, getPropertyType, getPropertyTypeOrDie, getT, getViewPage, isInstance, isSubTypeOf, load, newInstance, newInstance, newInstancesFromHeteroList, newInstancesFromHeteroList, save, self, toArray, toList, toMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PeriodicReincarnationGlobalConfiguration

public PeriodicReincarnationGlobalConfiguration()
Constructor. Loads the configuration upon invoke.


PeriodicReincarnationGlobalConfiguration

@DataBoundConstructor
public PeriodicReincarnationGlobalConfiguration(String activeTrigger,
                                                                     String maxDepth,
                                                                     String activeCron,
                                                                     String cronTime,
                                                                     List<RegEx> regExprs,
                                                                     String noChange)
Constructor. DataBound because this constructor is used to populate values entered from the user.

Parameters:
activeTrigger - shows if plugin trigger restart is enabled.
activeCron - shows if plugin cron restart is enabled.
cronTime - contains the cron time.
regExprs - list of all regular expressions.
maxDepth - max restart depth.
noChange - shows if no change option is enabled or disabled.
Method Detail

configure

public boolean configure(org.kohsuke.stapler.StaplerRequest req,
                         net.sf.json.JSONObject json)
                  throws hudson.model.Descriptor.FormException
This method defines what happens when we save to configuration. All values are taken from the json file and set to the variabled in this class.

Overrides:
configure in class hudson.model.Descriptor<jenkins.model.GlobalConfiguration>
Throws:
hudson.model.Descriptor.FormException

doCheckCronTime

public hudson.util.FormValidation doCheckCronTime(@QueryParameter
                                                  String value)
                                           throws antlr.ANTLRException,
                                                  NullPointerException
Check method for the cron time. Returns an error message if the cron time was invalid.

Returns:
Returns ok if cron time was correct, error message otherwise.
Throws:
antlr.ANTLRException
NullPointerException - cronTime was null.

doCheckRegExValue

public hudson.util.FormValidation doCheckRegExValue(@QueryParameter
                                                    String value)
Checks if a regular expression entered be compiled.

Returns:
true if the RegEx can be compiled, false otherwise.

doCheckRegExCronTime

public hudson.util.FormValidation doCheckRegExCronTime(@QueryParameter
                                                       String value)
                                                throws NullPointerException,
                                                       antlr.ANTLRException
Checks if a cron tab for a regEx can be compiled.

Returns:
true if the cron tab can be compiled, false otherwise.
Throws:
antlr.ANTLRException
NullPointerException

get

public static PeriodicReincarnationGlobalConfiguration get()
Finds and returns the configuration class.

Returns:
the ReincarnateFailedJobsConfiguration.

getNoChange

public String getNoChange()
Returns the field noChange.

Returns:
the field noChange.

isRestartUnchangedJobsEnabled

public boolean isRestartUnchangedJobsEnabled()
See noChange.

Returns:
true if the option is enabled, false otherwise.

getRegExprs

public List<RegEx> getRegExprs()
Returns a list containing all regular expressions.

Returns:
the list with reg exs.

getCronTime

public String getCronTime()
Returns the field cron time.

Returns:
cronTime.

getActiveCron

public String getActiveCron()
Returns the field activeCron.

Returns:
activeCron.

isCronActive

public boolean isCronActive()
Tells if the cron restart is activated or not.

Returns:
true if activated, false otherwise.

getActiveTrigger

public String getActiveTrigger()
Returns the field activeTrigger.

Returns:
activeTrigger.

isTriggerActive

public boolean isTriggerActive()
Tells if the afterbuild restart is activated or not.

Returns:
true if activated, false otherwise.

getMaxDepth

public int getMaxDepth()
returns the maximal number of consecutive afterbuild retries.

Returns:
the number from the configuration as String


Copyright © 2004-2013. All Rights Reserved.