hudson.plugins.jobConfigHistory
クラス JobConfigHistoryBaseAction

java.lang.Object
  上位を拡張 hudson.plugins.jobConfigHistory.JobConfigHistoryBaseAction
すべての実装されたインタフェース:
hudson.model.Action, hudson.model.ModelObject
直系の既知のサブクラス:
JobConfigHistoryProjectAction, JobConfigHistoryRootAction

public abstract class JobConfigHistoryBaseAction
extends Object
implements hudson.model.Action

Implements some basic methods needed by the JobConfigHistoryRootAction and JobConfigHistoryProjectAction.

作成者:
mfriedenhagen

入れ子のクラスの概要
static class JobConfigHistoryBaseAction.SideBySideView
           
 
コンストラクタの概要
JobConfigHistoryBaseAction()
          Set the Hudson instance.
 
メソッドの概要
protected abstract  void checkConfigurePermission()
          See whether the current user may read configurations in the object returned by getAccessControlledObject().
 void doDiffFiles(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Parses the incoming POST request and redirects as GET showDiffFiles.
protected abstract  hudson.security.AccessControlled getAccessControlledObject()
          Returns the object for which we want to provide access control.
protected  hudson.XmlFile getConfigXml(String diffDir)
          Returns the configuration file (default is config.xml) located in diffDir.
protected  String getDiff(File file1, File file2, String[] file1Lines, String[] file2Lines)
          Returns a unified diff between two string arrays.
 String getDiffFile()
          Returns a textual diff between two config.xml files located in histDir1 and histDir2 directories given as parameters of Stapler.getCurrentRequest().
 List<JobConfigHistoryBaseAction.SideBySideView.Line> getDiffLines()
          Returns side-by-side (i.e. human-readable) diff view lines.
 String getDisplayName()
           Make method final, as we always want the same display name.
 String getFile()
          Returns getConfigXml(String) as String.
protected  hudson.model.Hudson getHudson()
          Returns the hudson instance.
 String getIconFileName()
           Make method final, as we always want the same icon file.
protected  JobConfigHistory getPlugin()
          Returns the JobConfigHistory plugin instance.
protected  String getRequestParameter(String parameterName)
          Returns the parameter named parameterName from current request.
 String getUrlName()
           Do not make this method final as JobConfigHistoryRootAction overrides this method.
protected abstract  boolean hasConfigurePermission()
          Returns whether the current user may read configurations in the object returned by getAccessControlledObject().
 boolean wantRawOutput()
          Do we want 'raw' output?
 boolean wantXmlOutput()
          Do we want 'xml' output?
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

JobConfigHistoryBaseAction

public JobConfigHistoryBaseAction()
Set the Hudson instance.

メソッドの詳細

getDisplayName

public final String getDisplayName()
Make method final, as we always want the same display name.

定義:
インタフェース hudson.model.Action 内の getDisplayName
定義:
インタフェース hudson.model.ModelObject 内の getDisplayName

getIconFileName

public final String getIconFileName()
Make method final, as we always want the same icon file. Returns null to hide the icon if the user is not allowed to configure jobs.

定義:
インタフェース hudson.model.Action 内の getIconFileName

getUrlName

public String getUrlName()
Do not make this method final as JobConfigHistoryRootAction overrides this method.

定義:
インタフェース hudson.model.Action 内の getUrlName

wantRawOutput

public final boolean wantRawOutput()
Do we want 'raw' output?

戻り値:
true if request parameter type is 'raw'.

wantXmlOutput

public final boolean wantXmlOutput()
Do we want 'xml' output?

戻り値:
true if request parameter type is 'xml'.

getFile

public final String getFile()
                     throws IOException
Returns getConfigXml(String) as String.

戻り値:
content of the config.xml found in directory given by the request parameter file.
例外:
IOException - if the config file could not be read or converted to an xml string.

getConfigXml

protected hudson.XmlFile getConfigXml(String diffDir)
Returns the configuration file (default is config.xml) located in diffDir. diffDir must either start with HUDSON_HOME and contain config-history or be located under the configured historyRootDir. It also must not contain a '..' pattern. Otherwise an IllegalArgumentException will be thrown.

This is to ensure that this plugin will not be abused to get arbitrary xml configuration files located anywhere on the system.

パラメータ:
diffDir - timestamped history directory.
戻り値:
xmlfile.

getRequestParameter

protected String getRequestParameter(String parameterName)
Returns the parameter named parameterName from current request.

パラメータ:
parameterName - name of the parameter.
戻り値:
value of the request parameter or null if it does not exist.

checkConfigurePermission

protected abstract void checkConfigurePermission()
See whether the current user may read configurations in the object returned by getAccessControlledObject().


hasConfigurePermission

protected abstract boolean hasConfigurePermission()
Returns whether the current user may read configurations in the object returned by getAccessControlledObject().

戻り値:
true if the current user may read configurations.

getHudson

protected final hudson.model.Hudson getHudson()
Returns the hudson instance.

戻り値:
the hudson

getPlugin

protected final JobConfigHistory getPlugin()
Returns the JobConfigHistory plugin instance.

戻り値:
the JobConfigHistory plugin

getAccessControlledObject

protected abstract hudson.security.AccessControlled getAccessControlledObject()
Returns the object for which we want to provide access control.

戻り値:
the access controlled object.

doDiffFiles

public final void doDiffFiles(org.kohsuke.stapler.StaplerRequest req,
                              org.kohsuke.stapler.StaplerResponse rsp)
                       throws javax.servlet.ServletException,
                              IOException
Parses the incoming POST request and redirects as GET showDiffFiles.

パラメータ:
req - incoming request
rsp - outgoing response
例外:
javax.servlet.ServletException - when parsing the request as MultipartFormDataParser does not succeed.
IOException - when the redirection does not succeed.

getDiffFile

public final String getDiffFile()
                         throws IOException
Returns a textual diff between two config.xml files located in histDir1 and histDir2 directories given as parameters of Stapler.getCurrentRequest().

戻り値:
diff
例外:
IOException - if reading one of the config files does not succeed.

getDiffLines

public final List<JobConfigHistoryBaseAction.SideBySideView.Line> getDiffLines()
                                                                        throws IOException
Returns side-by-side (i.e. human-readable) diff view lines.

戻り値:
diff lines
例外:
IOException - if reading one of the config files does not succeed.

getDiff

protected final String getDiff(File file1,
                               File file2,
                               String[] file1Lines,
                               String[] file2Lines)
Returns a unified diff between two string arrays.

パラメータ:
file1 - first config file.
file2 - second config file.
file1Lines - the lines of the first file.
file2Lines - the lines of the second file.
戻り値:
unified diff


Copyright © 2004-2011. All Rights Reserved.