hudson.plugins.clearcase
Class ClearToolExec

java.lang.Object
  extended by hudson.plugins.clearcase.ClearToolExec
All Implemented Interfaces:
ClearTool
Direct Known Subclasses:
ClearToolDynamic, ClearToolSnapshot

public abstract class ClearToolExec
extends java.lang.Object
implements ClearTool


Nested Class Summary
 
Nested classes/interfaces inherited from interface hudson.plugins.clearcase.ClearTool
ClearTool.DefaultPromotionLevel, ClearTool.DiffBlOptions, ClearTool.SetcsOption
 
Field Summary
protected  ClearToolLauncher launcher
           
protected  java.lang.String optionalMkviewParameters
           
protected  hudson.util.VariableResolver<java.lang.String> variableResolver
           
 
Constructor Summary
ClearToolExec(hudson.util.VariableResolver<java.lang.String> variableResolver, ClearToolLauncher launcher, java.lang.String optionalMkviewParameters)
           
 
Method Summary
 java.lang.String catcs(java.lang.String viewTag)
          Retrieves the config spec for the specified view name
 java.io.Reader describe(java.lang.String format, java.lang.String objectSelector)
          Call the cleartool describe with the provided format on the specified object selector See http://www.ipnom.com/ClearCase-Commands/describe.html for valid options
 java.io.Reader diffbl(java.util.EnumSet<ClearTool.DiffBlOptions> type, java.lang.String baseline1, java.lang.String baseline2, java.lang.String viewPath)
          Call diffbl using the two provided baselines (can be stream or baseline)
 boolean doesStreamExist(java.lang.String streamSelector)
           
 boolean doesViewExist(java.lang.String viewTag)
          Checks whether the given view tag already exists in the ClearCase region.
 void endView(java.lang.String viewTag)
          Ends the view
 ClearToolLauncher getLauncher()
          Get the inner CLearToolLauncher.
protected abstract  hudson.FilePath getRootViewPath(ClearToolLauncher launcher)
           
 java.util.Properties getViewData(java.lang.String viewTag)
          Gets the view UUID, for thorough view deletion.
 boolean lock(java.lang.String comment, java.lang.String objectSelector)
          Lock an object.
 void logRedundantCleartoolError(java.lang.String[] cmd, java.lang.Exception ex)
           
 java.io.Reader lsactivity(java.lang.String activity, java.lang.String commandFormat, java.lang.String viewPath)
          Call lsactivity (see on Rational ClearCase Commands Reference for details)
 java.lang.String lsbl(java.lang.String baselineName, java.lang.String format)
          List attributes of a baseline
 java.lang.String lscurrentview(java.lang.String viewPath)
          Given a relative path, return the associated view tag if it exists.
 java.io.Reader lshistory(java.lang.String format, java.util.Date lastBuildDate, java.lang.String viewPath, java.lang.String branch, java.lang.String[] pathsInView, boolean getMinor)
          Returns Reader containing output from lshistory.
 java.lang.String lsproject(java.lang.String viewTag, java.lang.String format)
          List attributes of a project
 java.lang.String lsstream(java.lang.String stream, java.lang.String viewTag, java.lang.String format)
          List attributes of a stream
 java.util.List<java.lang.String> lsview(boolean onlyActiveDynamicViews)
          Lists view registry entries.
 java.util.List<java.lang.String> lsvob(boolean onlyMounted)
          Lists VOB registry entries
 java.util.List<Baseline> mkbl(java.lang.String name, java.lang.String viewTag, java.lang.String comment, boolean fullBaseline, boolean identical, java.util.List<java.lang.String> components, java.lang.String dDependsOn, java.lang.String aDependsOn)
          Creates a new baseline
 void mklabel(java.lang.String viewName, java.lang.String label)
          Attaches version labels to versions of elements
 void mkstream(java.lang.String parentStream, java.lang.String stream)
          Make a new stream
 void mkview(java.lang.String viewPath, java.lang.String viewTag, java.lang.String streamSelector)
          Creates and registers a view
 void mkview(java.lang.String viewPath, java.lang.String viewTag, java.lang.String streamSelector, java.lang.String defaultStorageDir)
          for dynamic views : viewPath == viewTag
 void mountVobs()
          Mounts all VOBs.
 java.lang.String pwv(java.lang.String viewPath)
          Retrieves the canonical working directory for a given view.
 void rebaseDynamic(java.lang.String viewTag, java.lang.String baseline)
          Rebase a dynamic view
 void recommendBaseline(java.lang.String streamSelector)
          Recommend the latest baselines on the stream that matches the minimum promotion level of the stream
 void rmtag(java.lang.String viewTag)
          Removes a view tag or a VOB tag from the networkwide storage registry
 void rmview(java.lang.String viewPath)
          Removes the view from a VOB
 void rmviewtag(java.lang.String viewTag)
          Removes the view tag from the ClearCase registry - used when the view storage in the workspace has already been deleted.
 void rmviewUuid(java.lang.String viewUuid)
          Removes the view (as identified by UUID) from all VOBs
protected  java.lang.String runAndProcessOutput(hudson.util.ArgumentListBuilder cmd, java.io.InputStream in, hudson.FilePath workFolder, boolean catchExceptions, java.util.List<java.io.IOException> exceptions)
           
 void setBaselinePromotionLevel(java.lang.String baselineName, ClearTool.DefaultPromotionLevel promotionLevel)
           
 void setBaselinePromotionLevel(java.lang.String baselineName, java.lang.String promotionLevel)
          Set the baseline promotion level to the given level.
 void setcs(java.lang.String viewPath, ClearTool.SetcsOption option, java.lang.String configSpec)
          To set the config spec of a snapshot view, you must be in or under the snapshot view root directory.
 void setcsCurrent(java.lang.String viewPath)
          To set the config spec of a snapshot view, you must be in or under the snapshot view root directory.
 void setcsTag(java.lang.String viewTag, ClearTool.SetcsOption option, java.lang.String configSpec)
          Synchronize the dynamic view with the latest recommended baseline for the stream.
 void startView(java.lang.String viewTags)
          Starts or connects to a dynamic view's view_server process
 void unlock(java.lang.String comment, java.lang.String objectSelector)
          Unlock an object
 void unregisterView(java.lang.String uuid)
          Unregisters the view tag for a given UUID.
 void update(java.lang.String viewPath, java.lang.String[] loadRules)
          Updates the elements in the view
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

launcher

protected ClearToolLauncher launcher

variableResolver

protected hudson.util.VariableResolver<java.lang.String> variableResolver

optionalMkviewParameters

protected java.lang.String optionalMkviewParameters
Constructor Detail

ClearToolExec

public ClearToolExec(hudson.util.VariableResolver<java.lang.String> variableResolver,
                     ClearToolLauncher launcher,
                     java.lang.String optionalMkviewParameters)
Method Detail

catcs

public java.lang.String catcs(java.lang.String viewTag)
                       throws java.io.IOException,
                              java.lang.InterruptedException
Description copied from interface: ClearTool
Retrieves the config spec for the specified view name

Specified by:
catcs in interface ClearTool
Parameters:
viewTag - The view tag the client want the config spec for.
Returns:
a string containing the config spec
Throws:
java.io.IOException
java.lang.InterruptedException

describe

public java.io.Reader describe(java.lang.String format,
                               java.lang.String objectSelector)
                        throws java.io.IOException,
                               java.lang.InterruptedException
Description copied from interface: ClearTool
Call the cleartool describe with the provided format on the specified object selector See http://www.ipnom.com/ClearCase-Commands/describe.html for valid options

Specified by:
describe in interface ClearTool
Returns:
A reader to the command output
Throws:
java.io.IOException - If cleartool throws an error code
java.lang.InterruptedException - If the process is interrupted

diffbl

public java.io.Reader diffbl(java.util.EnumSet<ClearTool.DiffBlOptions> type,
                             java.lang.String baseline1,
                             java.lang.String baseline2,
                             java.lang.String viewPath)
                      throws java.io.IOException
Description copied from interface: ClearTool
Call diffbl using the two provided baselines (can be stream or baseline)

Specified by:
diffbl in interface ClearTool
Parameters:
type - see http://www.ipnom.com/ClearCase-Commands/diffbl.html
viewPath - A view path name needed to retrieve versions from
Returns:
Throws:
java.io.IOException - if unable to do I/O operations

doesStreamExist

public boolean doesStreamExist(java.lang.String streamSelector)
                        throws java.io.IOException,
                               java.lang.InterruptedException
Specified by:
doesStreamExist in interface ClearTool
Returns:
true if the specified stream exists
Throws:
java.io.IOException
java.lang.InterruptedException

doesViewExist

public boolean doesViewExist(java.lang.String viewTag)
                      throws java.io.IOException,
                             java.lang.InterruptedException
Description copied from interface: ClearTool
Checks whether the given view tag already exists in the ClearCase region.

Specified by:
doesViewExist in interface ClearTool
Parameters:
viewTag - the view tag to check
Returns:
true if the view tag exists, false otherwise.
Throws:
java.io.IOException
java.lang.InterruptedException

endView

public void endView(java.lang.String viewTag)
             throws java.io.IOException,
                    java.lang.InterruptedException
Description copied from interface: ClearTool
Ends the view

Specified by:
endView in interface ClearTool
Parameters:
viewTag - the view tag
Throws:
java.io.IOException
java.lang.InterruptedException

getLauncher

public ClearToolLauncher getLauncher()
Description copied from interface: ClearTool
Get the inner CLearToolLauncher.

Specified by:
getLauncher in interface ClearTool
Returns:
The inner CLearToolLauncher.

getRootViewPath

protected abstract hudson.FilePath getRootViewPath(ClearToolLauncher launcher)
Parameters:
launcher -
Returns:
The root view path

getViewData

public java.util.Properties getViewData(java.lang.String viewTag)
                                 throws java.io.IOException,
                                        java.lang.InterruptedException
Description copied from interface: ClearTool
Gets the view UUID, for thorough view deletion.

Specified by:
getViewData in interface ClearTool
Throws:
java.io.IOException
java.lang.InterruptedException

lock

public boolean lock(java.lang.String comment,
                    java.lang.String objectSelector)
             throws java.io.IOException,
                    java.lang.InterruptedException
Description copied from interface: ClearTool
Lock an object. See http://www.ipnom.com/ClearCase-Commands/lock.html

Specified by:
lock in interface ClearTool
Parameters:
comment - Can be null
objectSelector - Object select. Cannot be null
Returns:
true if the lock succeeded.
Throws:
java.io.IOException
java.lang.InterruptedException

logRedundantCleartoolError

public void logRedundantCleartoolError(java.lang.String[] cmd,
                                       java.lang.Exception ex)
Specified by:
logRedundantCleartoolError in interface ClearTool

lsactivity

public java.io.Reader lsactivity(java.lang.String activity,
                                 java.lang.String commandFormat,
                                 java.lang.String viewPath)
                          throws java.io.IOException,
                                 java.lang.InterruptedException
Description copied from interface: ClearTool
Call lsactivity (see on Rational ClearCase Commands Reference for details)

Specified by:
lsactivity in interface ClearTool
Parameters:
activity - Specifies one or more activities to list.
You can specify an activity as a simple name or as an object selector of the form [activity]:name@vob-selector, where vob-selector specifies a project VOB (see the cleartool reference page).
If you specify a simple name and the current directory is not a project VOB, this command assumes that the activity resides in the project VOB associated with the stream attached to the current view.
If the current directory is a project VOB, that project VOB is the context for identifying the activity.
commandFormat - The output format to be used (-fmt <commandFormat>)
viewPath - view path name to use in order to list activity
Returns:
A reader to the lsactivity command output
Throws:
java.io.IOException
java.lang.InterruptedException

lsbl

public java.lang.String lsbl(java.lang.String baselineName,
                             java.lang.String format)
                      throws java.io.IOException,
                             java.lang.InterruptedException
Description copied from interface: ClearTool
List attributes of a baseline

Specified by:
lsbl in interface ClearTool
Returns:
Throws:
java.io.IOException
java.lang.InterruptedException

lscurrentview

public java.lang.String lscurrentview(java.lang.String viewPath)
                               throws java.io.IOException,
                                      java.lang.InterruptedException
Description copied from interface: ClearTool
Given a relative path, return the associated view tag if it exists. Otherwise, it will return null

Specified by:
lscurrentview in interface ClearTool
Returns:
Throws:
java.io.IOException
java.lang.InterruptedException

lshistory

public java.io.Reader lshistory(java.lang.String format,
                                java.util.Date lastBuildDate,
                                java.lang.String viewPath,
                                java.lang.String branch,
                                java.lang.String[] pathsInView,
                                boolean getMinor)
                         throws java.io.IOException,
                                java.lang.InterruptedException
Description copied from interface: ClearTool
Returns Reader containing output from lshistory.

Specified by:
lshistory in interface ClearTool
Parameters:
format - format that should be used by the lshistory command
lastBuildDate - lists events recorded since (that is, at or after) the specified date-time
viewPath - the name of the view
branch - the name of the branch to get history events for; if null then history events for all branches are listed
pathsInView - view paths that should be added to the lshistory command. The view paths must be relative.
Returns:
Reader containing output from command
Throws:
java.io.IOException
java.lang.InterruptedException

lsproject

public java.lang.String lsproject(java.lang.String viewTag,
                                  java.lang.String format)
                           throws java.lang.InterruptedException,
                                  java.io.IOException
Description copied from interface: ClearTool
List attributes of a project

Specified by:
lsproject in interface ClearTool
Parameters:
viewTag - View tag of a view attached to a stream of the project
Returns:
Throws:
java.lang.InterruptedException
java.io.IOException

lsstream

public java.lang.String lsstream(java.lang.String stream,
                                 java.lang.String viewTag,
                                 java.lang.String format)
                          throws java.io.IOException,
                                 java.lang.InterruptedException
Description copied from interface: ClearTool
List attributes of a stream

Specified by:
lsstream in interface ClearTool
Parameters:
stream - TODO
viewTag - The view tag of a view on the wanted stream
Returns:
Throws:
java.io.IOException
java.lang.InterruptedException

lsview

public java.util.List<java.lang.String> lsview(boolean onlyActiveDynamicViews)
                                        throws java.io.IOException,
                                               java.lang.InterruptedException
Description copied from interface: ClearTool
Lists view registry entries. This command needs to be run inside a view.

Specified by:
lsview in interface ClearTool
Parameters:
onlyActiveDynamicViews - true for only return active dynamic views; false all views are returned
Returns:
list of view names
Throws:
java.io.IOException
java.lang.InterruptedException

lsvob

public java.util.List<java.lang.String> lsvob(boolean onlyMounted)
                                       throws java.io.IOException,
                                              java.lang.InterruptedException
Description copied from interface: ClearTool
Lists VOB registry entries

Specified by:
lsvob in interface ClearTool
Parameters:
onlyMounted - true for only return mounted vobs; false all vobs are returned
Returns:
list of vob names
Throws:
java.io.IOException
java.lang.InterruptedException

mkbl

public java.util.List<Baseline> mkbl(java.lang.String name,
                                     java.lang.String viewTag,
                                     java.lang.String comment,
                                     boolean fullBaseline,
                                     boolean identical,
                                     java.util.List<java.lang.String> components,
                                     java.lang.String dDependsOn,
                                     java.lang.String aDependsOn)
                              throws java.io.IOException,
                                     java.lang.InterruptedException
Description copied from interface: ClearTool
Creates a new baseline

Specified by:
mkbl in interface ClearTool
Parameters:
name - The base name for the baseline
viewTag - The view from which to create baseline. Baselines are created in the stream linked to this view
dDependsOn - TODO
aDependsOn - TODO
Returns:
Throws:
java.io.IOException
java.lang.InterruptedException

mklabel

public void mklabel(java.lang.String viewName,
                    java.lang.String label)
             throws java.io.IOException,
                    java.lang.InterruptedException
Description copied from interface: ClearTool
Attaches version labels to versions of elements

Specified by:
mklabel in interface ClearTool
Parameters:
viewName - The view path name (relative to the workspace)
label - the label name
Throws:
java.io.IOException
java.lang.InterruptedException

mkstream

public void mkstream(java.lang.String parentStream,
                     java.lang.String stream)
              throws java.io.IOException,
                     java.lang.InterruptedException
Description copied from interface: ClearTool
Make a new stream

Specified by:
mkstream in interface ClearTool
Parameters:
parentStream - The parent stream name
stream - The new stream name
Throws:
java.io.IOException
java.lang.InterruptedException

mkview

public void mkview(java.lang.String viewPath,
                   java.lang.String viewTag,
                   java.lang.String streamSelector)
            throws java.io.IOException,
                   java.lang.InterruptedException
Description copied from interface: ClearTool
Creates and registers a view

Specified by:
mkview in interface ClearTool
Parameters:
viewPath - The view path name (relative to the workspace)
viewTag - the name of the view
streamSelector - optional stream selector, null if not used.
Throws:
java.io.IOException
java.lang.InterruptedException

mkview

public void mkview(java.lang.String viewPath,
                   java.lang.String viewTag,
                   java.lang.String streamSelector,
                   java.lang.String defaultStorageDir)
            throws java.io.IOException,
                   java.lang.InterruptedException
for dynamic views : viewPath == viewTag

Specified by:
mkview in interface ClearTool
Parameters:
viewPath - The view path name (relative to the workspace)
viewTag - The view tag (unique server identifier for the view)
streamSelector - optional stream selector, null if not used.
Throws:
java.io.IOException
java.lang.InterruptedException

mountVobs

public void mountVobs()
               throws java.io.IOException,
                      java.lang.InterruptedException
Description copied from interface: ClearTool
Mounts all VOBs.

Specified by:
mountVobs in interface ClearTool
Throws:
java.io.IOException
java.lang.InterruptedException

setBaselinePromotionLevel

public void setBaselinePromotionLevel(java.lang.String baselineName,
                                      ClearTool.DefaultPromotionLevel promotionLevel)
                               throws java.io.IOException,
                                      java.lang.InterruptedException
Specified by:
setBaselinePromotionLevel in interface ClearTool
Throws:
java.io.IOException
java.lang.InterruptedException

setBaselinePromotionLevel

public void setBaselinePromotionLevel(java.lang.String baselineName,
                                      java.lang.String promotionLevel)
                               throws java.io.IOException,
                                      java.lang.InterruptedException
Description copied from interface: ClearTool
Set the baseline promotion level to the given level. The predefined promotion levels are defined in ClearTool.DefaultPromotionLevel.

Specified by:
setBaselinePromotionLevel in interface ClearTool
Throws:
java.io.IOException
java.lang.InterruptedException

pwv

public java.lang.String pwv(java.lang.String viewPath)
                     throws java.io.IOException,
                            java.lang.InterruptedException
Description copied from interface: ClearTool
Retrieves the canonical working directory for a given view.

Specified by:
pwv in interface ClearTool
Parameters:
viewPath - The view path to use to execute pwv
Returns:
the return from "cleartool pwv"
Throws:
java.io.IOException
java.lang.InterruptedException

rebaseDynamic

public void rebaseDynamic(java.lang.String viewTag,
                          java.lang.String baseline)
                   throws java.io.IOException,
                          java.lang.InterruptedException
Description copied from interface: ClearTool
Rebase a dynamic view

Specified by:
rebaseDynamic in interface ClearTool
Parameters:
viewTag - the view to rebase. It must be a dynamic view
baseline - The new foundation baseline to use
Throws:
java.io.IOException
java.lang.InterruptedException

recommendBaseline

public void recommendBaseline(java.lang.String streamSelector)
                       throws java.io.IOException,
                              java.lang.InterruptedException
Description copied from interface: ClearTool
Recommend the latest baselines on the stream that matches the minimum promotion level of the stream

Specified by:
recommendBaseline in interface ClearTool
Throws:
java.io.IOException
java.lang.InterruptedException

rmview

public void rmview(java.lang.String viewPath)
            throws java.io.IOException,
                   java.lang.InterruptedException
Description copied from interface: ClearTool
Removes the view from a VOB

Specified by:
rmview in interface ClearTool
Parameters:
viewPath - The path used for the view
Throws:
java.io.IOException
java.lang.InterruptedException

rmviewtag

public void rmviewtag(java.lang.String viewTag)
               throws java.io.IOException,
                      java.lang.InterruptedException
Description copied from interface: ClearTool
Removes the view tag from the ClearCase registry - used when the view storage in the workspace has already been deleted.

Specified by:
rmviewtag in interface ClearTool
Parameters:
viewTag - The view tag (server identifier of the view)
Throws:
java.io.IOException
java.lang.InterruptedException

rmtag

public void rmtag(java.lang.String viewTag)
           throws java.io.IOException,
                  java.lang.InterruptedException
Description copied from interface: ClearTool
Removes a view tag or a VOB tag from the networkwide storage registry

Specified by:
rmtag in interface ClearTool
Throws:
java.io.IOException
java.lang.InterruptedException

rmviewUuid

public void rmviewUuid(java.lang.String viewUuid)
                throws java.io.IOException,
                       java.lang.InterruptedException
Description copied from interface: ClearTool
Removes the view (as identified by UUID) from all VOBs

Specified by:
rmviewUuid in interface ClearTool
Parameters:
viewUuid - the unique identifier for the view
Throws:
java.io.IOException
java.lang.InterruptedException

runAndProcessOutput

protected java.lang.String runAndProcessOutput(hudson.util.ArgumentListBuilder cmd,
                                               java.io.InputStream in,
                                               hudson.FilePath workFolder,
                                               boolean catchExceptions,
                                               java.util.List<java.io.IOException> exceptions)
                                        throws java.io.IOException,
                                               java.lang.InterruptedException
Throws:
java.io.IOException
java.lang.InterruptedException

setcs

public void setcs(java.lang.String viewPath,
                  ClearTool.SetcsOption option,
                  java.lang.String configSpec)
           throws java.io.IOException,
                  java.lang.InterruptedException
To set the config spec of a snapshot view, you must be in or under the snapshot view root directory.

Specified by:
setcs in interface ClearTool
Parameters:
viewPath - The view path name (relative to the workspace)
option - The type of setcs that needs to be performed
configSpec - the name of the file containing a config spec
Throws:
java.io.IOException
java.lang.InterruptedException
See Also:
http://www.ipnom.com/ClearCase-Commands/setcs.html

setcsCurrent

public void setcsCurrent(java.lang.String viewPath)
                  throws java.io.IOException,
                         java.lang.InterruptedException
To set the config spec of a snapshot view, you must be in or under the snapshot view root directory.

Throws:
java.io.IOException
java.lang.InterruptedException
See Also:
http://www.ipnom.com/ClearCase-Commands/setcs.html

setcsTag

public void setcsTag(java.lang.String viewTag,
                     ClearTool.SetcsOption option,
                     java.lang.String configSpec)
              throws java.io.IOException,
                     java.lang.InterruptedException
Synchronize the dynamic view with the latest recommended baseline for the stream. 1. Set the config spec on the view (Removed call to chstream - based on http://www.nabble.com/-clearcase-plugin--Use-of-chstream--generate-is-not-necessary-td25118511.html

Specified by:
setcsTag in interface ClearTool
option - The option to use
configSpec - The config spec to apply. If omitted, the view tag
Throws:
java.io.IOException
java.lang.InterruptedException

startView

public void startView(java.lang.String viewTags)
               throws java.io.IOException,
                      java.lang.InterruptedException
Description copied from interface: ClearTool
Starts or connects to a dynamic view's view_server process

Specified by:
startView in interface ClearTool
Parameters:
viewTags - One or more currently registered view tags (that is, view tags visible to lsview).
Throws:
java.io.IOException
java.lang.InterruptedException

unlock

public void unlock(java.lang.String comment,
                   java.lang.String objectSelector)
            throws java.io.IOException,
                   java.lang.InterruptedException
Description copied from interface: ClearTool
Unlock an object

Specified by:
unlock in interface ClearTool
Throws:
java.io.IOException
java.lang.InterruptedException

unregisterView

public void unregisterView(java.lang.String uuid)
                    throws java.io.IOException,
                           java.lang.InterruptedException
Description copied from interface: ClearTool
Unregisters the view tag for a given UUID.

Specified by:
unregisterView in interface ClearTool
Parameters:
uuid - the unique identifier for the view.
Throws:
java.io.IOException
java.lang.InterruptedException

update

public void update(java.lang.String viewPath,
                   java.lang.String[] loadRules)
            throws java.io.IOException,
                   java.lang.InterruptedException
Description copied from interface: ClearTool
Updates the elements in the view

Specified by:
update in interface ClearTool
Parameters:
viewPath - the name of the view
loadRules - optional load rules, null if not used.
Throws:
java.io.IOException
java.lang.InterruptedException


Copyright © 2011. All Rights Reserved.