hudson.plugins.jobConfigHistory
クラス JobConfigHistory

java.lang.Object
  上位を拡張 hudson.Plugin
      上位を拡張 hudson.plugins.jobConfigHistory.JobConfigHistory
すべての実装されたインタフェース:
hudson.model.Saveable

public class JobConfigHistory
extends hudson.Plugin

Class supporting global configuration settings, along with methods associated with the plugin itself.

作成者:
jborghi

入れ子のクラスの概要
 
クラス hudson.Plugin から継承された入れ子のクラス/インタフェース
hudson.Plugin.DummyImpl
 
フィールドの概要
static FileFilter HISTORY_FILTER
          A filter to return only those directories of a file listing that represent configuration history directories.
 
インタフェース hudson.model.Saveable から継承されたフィールド
NOOP
 
コンストラクタの概要
JobConfigHistory()
           
 
メソッドの概要
protected  void checkForPurgeByQuantity(File itemHistoryRoot)
          Checks if we should purge old history entries under the specified root using the maxHistoryEntries value as the criteria, and if required calls the appropriate method to perform the purge.
 void configure(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject formData)
           
 hudson.util.FormValidation doCheckExcludePattern(String value)
          Validates the user entry for the regular expression of system file names to exclude from saving.
 hudson.util.FormValidation doCheckMaxHistoryEntries(String value)
          Validates the user entry for the maximum number of history items to keep.
protected  File getConfigFile(File historyDir)
          Returns the configuration data file stored in the specified history directory.
protected  File getConfiguredHistoryRootDir()
          Returns the File object representing the configured root history directory.
 String getDefaultExcludePattern()
          Used by the configuration page.
 String getExcludePattern()
           
protected  Pattern getExcludeRegexpPattern()
          Used for testing to verify invalid pattern not loaded.
protected  File getHistoryDir(hudson.XmlFile xmlFile)
          Returns the configuration history directory for the given configuration file.
 String getHistoryRootDir()
           
 String getMaxHistoryEntries()
           
 boolean getSaveSystemConfiguration()
           
 boolean getSkipDuplicateHistory()
           
protected  File getSystemHistoryDir()
          Returns the directory for storing system configurations.
protected  boolean isSaveable(hudson.model.Saveable item, hudson.XmlFile xmlFile)
          Returns true if configuration for this item should be saved, based on the plugin settings, the type of item and the configuration file specified.
protected  void setMaxHistoryEntries(String maxHistoryEntries)
          This method is for convenience in testing.
 void start()
           
 
クラス hudson.Plugin から継承されたメソッド
configure, doDynamic, getConfigXml, getWrapper, load, postInitialize, save, setServletContext, stop
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

HISTORY_FILTER

public static final FileFilter HISTORY_FILTER
A filter to return only those directories of a file listing that represent configuration history directories.

コンストラクタの詳細

JobConfigHistory

public JobConfigHistory()
メソッドの詳細

start

public void start()
           throws Exception
オーバーライド:
クラス hudson.Plugin 内の start
例外:
Exception

configure

public void configure(org.kohsuke.stapler.StaplerRequest req,
                      net.sf.json.JSONObject formData)
               throws IOException,
                      javax.servlet.ServletException,
                      hudson.model.Descriptor.FormException
オーバーライド:
クラス hudson.Plugin 内の configure
例外:
IOException
javax.servlet.ServletException
hudson.model.Descriptor.FormException

getHistoryRootDir

public String getHistoryRootDir()
戻り値:
The configured history root directory.

getMaxHistoryEntries

public String getMaxHistoryEntries()
戻り値:
The maximum number of history entries to keep.

setMaxHistoryEntries

protected void setMaxHistoryEntries(String maxHistoryEntries)
This method is for convenience in testing.

パラメータ:
maxHistoryEntries - The maximum number of history entries to keep

getSaveSystemConfiguration

public boolean getSaveSystemConfiguration()
戻り値:
true if we should save 'system' configurations.

getSkipDuplicateHistory

public boolean getSkipDuplicateHistory()
戻り値:
true if we should skip saving history that duplicates the prior saved configuration.

getExcludePattern

public String getExcludePattern()
戻り値:
The regular expression for 'system' file names to exclude from saving.

getDefaultExcludePattern

public String getDefaultExcludePattern()
Used by the configuration page.

戻り値:
The default regular expression for 'system' file names to exclude from saving.

getExcludeRegexpPattern

protected Pattern getExcludeRegexpPattern()
Used for testing to verify invalid pattern not loaded.

戻り値:
The loaded regexp pattern, or null if pattern was invalid.

getConfiguredHistoryRootDir

protected File getConfiguredHistoryRootDir()
Returns the File object representing the configured root history directory.

戻り値:
The configured root history File object, or null if this configuration has not been set.

getHistoryDir

protected File getHistoryDir(hudson.XmlFile xmlFile)
Returns the configuration history directory for the given configuration file.

パラメータ:
xmlFile - The configuration file whose content we are saving.
戻り値:
The base directory where to store the history, or null if the file is not a valid Hudson configuration file.

getSystemHistoryDir

protected File getSystemHistoryDir()
Returns the directory for storing system configurations.

戻り値:
The directory used for storing system configurations.

getConfigFile

protected File getConfigFile(File historyDir)
Returns the configuration data file stored in the specified history directory. It looks for a file with an 'xml' extension that is not named JobConfigHistoryConsts.HISTORY_FILE.

Relies on the assumption that random '.xml' files will not appear in the history directories.

Checks that we are in an actual 'history directory' to prevent use for getting random xml files.

パラメータ:
historyDir - The history directory to look under.
戻り値:
The configuration file or null if no file is found.

isSaveable

protected boolean isSaveable(hudson.model.Saveable item,
                             hudson.XmlFile xmlFile)
Returns true if configuration for this item should be saved, based on the plugin settings, the type of item and the configuration file specified.

If the item is an instance of AbstractProject or the configuration file is stored directly in HUDSON_ROOT, it is considered for saving. If the plugin is configured to skip saving duplicated history, we also evaluate if this configuration duplicates the previous saved history (if such history exists).

パラメータ:
item - The item whose configuration is under consideration.
xmlFile - The configuration file for the above item.
戻り値:
true if the item configuration should be saved.

checkForPurgeByQuantity

protected void checkForPurgeByQuantity(File itemHistoryRoot)
Checks if we should purge old history entries under the specified root using the maxHistoryEntries value as the criteria, and if required calls the appropriate method to perform the purge.

パラメータ:
itemHistoryRoot - The directory to consider purging history under.

doCheckMaxHistoryEntries

public hudson.util.FormValidation doCheckMaxHistoryEntries(@QueryParameter
                                                           String value)
Validates the user entry for the maximum number of history items to keep. Must be blank or a non-negative integer.

パラメータ:
value - The form input entered by the user.
戻り値:
ok if the entry is blank or a non-negative integer.

doCheckExcludePattern

public hudson.util.FormValidation doCheckExcludePattern(@QueryParameter
                                                        String value)
Validates the user entry for the regular expression of system file names to exclude from saving.

パラメータ:
value - The form input entered by the user.
戻り値:
ok if the entry is a valid regular expression.


Copyright © 2004-2011. All Rights Reserved.