hudson.plugins.sitemonitor
Class SiteMonitorDescriptor

java.lang.Object
  extended by hudson.model.Descriptor<T>
      extended by hudson.tasks.BuildStepDescriptor<hudson.tasks.Publisher>
          extended by hudson.plugins.sitemonitor.SiteMonitorDescriptor
All Implemented Interfaces:
hudson.model.Saveable

@Extension
public class SiteMonitorDescriptor
extends hudson.tasks.BuildStepDescriptor<hudson.tasks.Publisher>

Handles the global and job configuration management.

Author:
cliffano

Nested Class Summary
 
Nested classes/interfaces inherited from class hudson.model.Descriptor
hudson.model.Descriptor.FormException, hudson.model.Descriptor.PropertyType
 
Field Summary
private static java.lang.Integer DEFAULT_TIMEOUT_IN_SECS
          Default timeout (in seconds), used when global config timeout setting is not set to any value.
private static java.util.logging.Logger LOGGER
          Logger.
private  java.util.List<java.lang.Integer> mSuccessResponseCodes
          The response codes used to indicate that the web site is up.
private  java.lang.Integer mTimeout
          The HTTP connection timeout value (in seconds).
private  SiteMonitorValidator mValidator
          The form validator.
 
Fields inherited from class hudson.model.Descriptor
clazz
 
Fields inherited from interface hudson.model.Saveable
NOOP
 
Constructor Summary
SiteMonitorDescriptor()
          Constructs SiteMonitorDescriptor.
 
Method Summary
 boolean configure(org.kohsuke.stapler.StaplerRequest request, net.sf.json.JSONObject json)
          Handles SiteMonitor global configuration per Hudson instance.
 hudson.util.FormValidation doCheckResponseCodes(java.lang.String value)
           
 hudson.util.FormValidation doCheckTimeout(java.lang.String value)
           
 hudson.util.FormValidation doCheckUrl(java.lang.String value)
           
 java.lang.String getDisplayName()
           
 java.util.List<java.lang.Integer> getSuccessResponseCodes()
           
 java.lang.String getSuccessResponseCodesCsv()
           
 java.lang.Integer getTimeout()
           
 boolean isApplicable(java.lang.Class<? extends hudson.model.AbstractProject> clazz)
          Checks whether this descriptor is applicable.
 hudson.tasks.Publisher newInstance(org.kohsuke.stapler.StaplerRequest request, net.sf.json.JSONObject json)
          Handles SiteMonitor configuration for each job.
 
Methods inherited from class hudson.tasks.BuildStepDescriptor
filter
 
Methods inherited from class hudson.model.Descriptor
configure, configure, convert, doHelp, find, find, getCheckUrl, getConfigPage, getGlobalConfigPage, getHelpFile, getHelpFile, getJsonSafeClassName, getPropertyType, getViewPage, isInstance, load, newInstance, newInstancesFromHeteroList, save, toArray, toList, toMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final java.util.logging.Logger LOGGER
Logger.


DEFAULT_TIMEOUT_IN_SECS

private static final java.lang.Integer DEFAULT_TIMEOUT_IN_SECS
Default timeout (in seconds), used when global config timeout setting is not set to any value.


mValidator

private SiteMonitorValidator mValidator
The form validator.


mSuccessResponseCodes

private java.util.List<java.lang.Integer> mSuccessResponseCodes
The response codes used to indicate that the web site is up.


mTimeout

private java.lang.Integer mTimeout
The HTTP connection timeout value (in seconds).

Constructor Detail

SiteMonitorDescriptor

public SiteMonitorDescriptor()
Constructs SiteMonitorDescriptor.

Method Detail

getDisplayName

public final java.lang.String getDisplayName()
Specified by:
getDisplayName in class hudson.model.Descriptor<hudson.tasks.Publisher>
Returns:
the plugin's display name, used in the job's build drop down list

isApplicable

public final boolean isApplicable(java.lang.Class<? extends hudson.model.AbstractProject> clazz)
Checks whether this descriptor is applicable.

Specified by:
isApplicable in class hudson.tasks.BuildStepDescriptor<hudson.tasks.Publisher>
Parameters:
clazz - the class
Returns:
true

getSuccessResponseCodes

public final java.util.List<java.lang.Integer> getSuccessResponseCodes()
Returns:
the success response codes

getSuccessResponseCodesCsv

public final java.lang.String getSuccessResponseCodesCsv()
Returns:
the success response codes in comma-separated value format

getTimeout

public final java.lang.Integer getTimeout()
Returns:
the timeout value in seconds

newInstance

public final hudson.tasks.Publisher newInstance(org.kohsuke.stapler.StaplerRequest request,
                                                net.sf.json.JSONObject json)
Handles SiteMonitor configuration for each job.

Overrides:
newInstance in class hudson.model.Descriptor<hudson.tasks.Publisher>
Parameters:
request - the stapler request
json - the JSON data containing job configuration values
Returns:
the builder with specified sites to be monitored

configure

public final boolean configure(org.kohsuke.stapler.StaplerRequest request,
                               net.sf.json.JSONObject json)
Handles SiteMonitor global configuration per Hudson instance.

Overrides:
configure in class hudson.model.Descriptor<hudson.tasks.Publisher>
Parameters:
request - the stapler request
json - the JSON data containing job configuration values
Returns:
true (after configuration is saved)

doCheckUrl

public final hudson.util.FormValidation doCheckUrl(@QueryParameter
                                                   java.lang.String value)
Parameters:
value - the value to validate
Returns:
true if value is a valid URL, false otherwise

doCheckResponseCodes

public final hudson.util.FormValidation doCheckResponseCodes(@QueryParameter
                                                             java.lang.String value)
Parameters:
value - the value to validate
Returns:
true if value is a valid comma-separated response codes, false otherwise

doCheckTimeout

public final hudson.util.FormValidation doCheckTimeout(@QueryParameter
                                                       java.lang.String value)
Parameters:
value - the value to validate
Returns:
true if value is a valid timeout, false otherwise


Copyright © 2010. All Rights Reserved.