hudson.plugins.clearcase
Class AbstractClearCaseScm

java.lang.Object
  extended by hudson.scm.SCM
      extended by hudson.plugins.clearcase.AbstractClearCaseScm
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.model.Describable<hudson.scm.SCM>
Direct Known Subclasses:
ClearCaseSCM, ClearCaseUcmSCM

public abstract class AbstractClearCaseScm
extends hudson.scm.SCM

Abstract class for ClearCase SCM. The class contains the logic around checkout and polling, the deriving classes only have to implement the specific checkout and polling logic.


Field Summary
static java.lang.String CLEARCASE_VIEWNAME_ENVSTR
           
static java.lang.String CLEARCASE_VIEWPATH_ENVSTR
           
 
Fields inherited from class hudson.scm.SCM
PERMISSIONS, TAG
 
Constructor Summary
AbstractClearCaseScm(java.lang.String viewName, java.lang.String mkviewOptionalParam, boolean filterOutDestroySubBranchEvent)
           
 
Method Summary
 void buildEnvVars(hudson.model.AbstractBuild build, java.util.Map<java.lang.String,java.lang.String> env)
          Adds the env variable for the ClearCase SCMs.
 boolean checkout(hudson.model.AbstractBuild build, hudson.Launcher launcher, hudson.FilePath workspace, hudson.model.BuildListener listener, java.io.File changelogFile)
           
protected abstract  ChangeLogAction createChangeLogAction(ClearToolLauncher launcher, hudson.model.AbstractBuild<?,?> build)
          Create a ChangeLogAction that will be used to get the change logs for a CC repository
 hudson.scm.ChangeLogParser createChangeLogParser()
           
protected abstract  CheckOutAction createCheckOutAction(ClearToolLauncher launcher)
          Create a CheckOutAction that will be used by the checkout method.
protected  ClearTool createClearTool(ClearToolLauncher launcher)
           
protected  ClearToolLauncher createClearToolLauncher(hudson.model.TaskListener listener, hudson.FilePath workspace, hudson.Launcher launcher)
          Creates a Hudson clear tool launcher.
protected abstract  PollAction createPollAction(ClearToolLauncher launcher)
          Create a PollAction that will be used by the pollChanges() method.
protected abstract  SaveChangeLogAction createSaveChangeLogAction(ClearToolLauncher launcher)
          Create a SaveChangeLog action that is used to save a change log
protected abstract  TaggingAction createTaggingAction(ClearToolLauncher clearToolLauncher)
          Create a TaggingAction that will be used at the end of the build to tag the CC repository
abstract  java.lang.String[] getBranchNames()
          Return string array containing the branch names that should be used when polling for changes.
 hudson.scm.SCMDescriptor<?> getDescriptor()
           
 java.lang.String getMkviewOptionalParam()
          Returns the user configured optional params that will be used in when creating a new view.
 hudson.FilePath getModuleRoot(hudson.FilePath workspace)
           
 java.lang.String getNormalizedViewName(hudson.model.AbstractProject<?,?> project)
          Returns a normalized view name that will be used in cleartool commands.
 java.lang.String getViewName()
           
abstract  java.lang.String[] getViewPaths(hudson.FilePath viewPath)
          Return string array containing the paths in the view that should be used when polling for changes.
 boolean isFilteringOutDestroySubBranchEvent()
          Returns if the "Destroyed branch" event should be filtered out or not.
 boolean pollChanges(hudson.model.AbstractProject project, hudson.Launcher launcher, hudson.FilePath workspace, hudson.model.TaskListener listener)
           
 boolean requiresWorkspaceForPolling()
           
 boolean supportsPolling()
           
 
Methods inherited from class hudson.scm.SCM
createEmptyChangeLog, getBrowser, getEffectiveBrowser, getModuleRoots, nullify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLEARCASE_VIEWNAME_ENVSTR

public static final java.lang.String CLEARCASE_VIEWNAME_ENVSTR
See Also:
Constant Field Values

CLEARCASE_VIEWPATH_ENVSTR

public static final java.lang.String CLEARCASE_VIEWPATH_ENVSTR
See Also:
Constant Field Values
Constructor Detail

AbstractClearCaseScm

public AbstractClearCaseScm(java.lang.String viewName,
                            java.lang.String mkviewOptionalParam,
                            boolean filterOutDestroySubBranchEvent)
Method Detail

createChangeLogParser

public hudson.scm.ChangeLogParser createChangeLogParser()
Specified by:
createChangeLogParser in class hudson.scm.SCM

getDescriptor

public hudson.scm.SCMDescriptor<?> getDescriptor()
Specified by:
getDescriptor in interface hudson.model.Describable<hudson.scm.SCM>
Overrides:
getDescriptor in class hudson.scm.SCM

createCheckOutAction

protected abstract CheckOutAction createCheckOutAction(ClearToolLauncher launcher)
Create a CheckOutAction that will be used by the checkout method.

Parameters:
launcher - the command line launcher
Returns:
an action that can check out code from a ClearCase repository.

createPollAction

protected abstract PollAction createPollAction(ClearToolLauncher launcher)
Create a PollAction that will be used by the pollChanges() method.

Parameters:
launcher - the command line launcher
Returns:
an action that can poll if there are any changes a ClearCase repository.

createSaveChangeLogAction

protected abstract SaveChangeLogAction createSaveChangeLogAction(ClearToolLauncher launcher)
Create a SaveChangeLog action that is used to save a change log

Parameters:
launcher - the command line launcher
Returns:
an action that can save a change log to the Hudson changlog file

createChangeLogAction

protected abstract ChangeLogAction createChangeLogAction(ClearToolLauncher launcher,
                                                         hudson.model.AbstractBuild<?,?> build)
Create a ChangeLogAction that will be used to get the change logs for a CC repository

Parameters:
launcher - the command line launcher
build - the current build
Returns:
an action that returns the change logs for a CC repository

createTaggingAction

protected abstract TaggingAction createTaggingAction(ClearToolLauncher clearToolLauncher)
Create a TaggingAction that will be used at the end of the build to tag the CC repository

Parameters:
launcher - the command line launcher
Returns:
an action that can tag the CC repository; can be null.

getBranchNames

public abstract java.lang.String[] getBranchNames()
Return string array containing the branch names that should be used when polling for changes.

Returns:
a string array, can not be empty

getViewPaths

public abstract java.lang.String[] getViewPaths(hudson.FilePath viewPath)
                                         throws java.io.IOException,
                                                java.lang.InterruptedException
Return string array containing the paths in the view that should be used when polling for changes.

Parameters:
viewPath - the file path for the view
Returns:
string array that will be used by the lshistory command
Throws:
java.io.IOException
java.lang.InterruptedException

supportsPolling

public boolean supportsPolling()
Overrides:
supportsPolling in class hudson.scm.SCM

requiresWorkspaceForPolling

public boolean requiresWorkspaceForPolling()
Overrides:
requiresWorkspaceForPolling in class hudson.scm.SCM

getModuleRoot

public hudson.FilePath getModuleRoot(hudson.FilePath workspace)
Overrides:
getModuleRoot in class hudson.scm.SCM

getViewName

public java.lang.String getViewName()

getNormalizedViewName

public java.lang.String getNormalizedViewName(hudson.model.AbstractProject<?,?> project)
Returns a normalized view name that will be used in cleartool commands. It will replace ${JOB_NAME} with the name of the job, * ${USER_NAME} with the name of the user. This way it will be easier to add new jobs without trying to find an unique view name. It will also replace invalid chars from a view name.

Parameters:
project - the project to get the name from
Returns:
a string containing no invalid chars.

getMkviewOptionalParam

public java.lang.String getMkviewOptionalParam()
Returns the user configured optional params that will be used in when creating a new view.

Returns:
string containing optional mkview parameters.

isFilteringOutDestroySubBranchEvent

public boolean isFilteringOutDestroySubBranchEvent()
Returns if the "Destroyed branch" event should be filtered out or not. For more information about the boolean, see the full discussion at http://www.nabble.com/ClearCase-build-triggering-td17507838i20.html "Usually, CC admins have a CC trigger, fires on an uncheckout event, that destroys empty branches."

Returns:
true if the "Destroyed branch" event should be filtered out or not; false otherwise

buildEnvVars

public void buildEnvVars(hudson.model.AbstractBuild build,
                         java.util.Map<java.lang.String,java.lang.String> env)
Adds the env variable for the ClearCase SCMs. CLEARCASE_VIEWNAME - The name of the clearcase view. CLEARCASE_VIEWPATH - The absolute path to the clearcase view.

Overrides:
buildEnvVars in class hudson.scm.SCM

checkout

public boolean checkout(hudson.model.AbstractBuild build,
                        hudson.Launcher launcher,
                        hudson.FilePath workspace,
                        hudson.model.BuildListener listener,
                        java.io.File changelogFile)
                 throws java.io.IOException,
                        java.lang.InterruptedException
Specified by:
checkout in class hudson.scm.SCM
Throws:
java.io.IOException
java.lang.InterruptedException

pollChanges

public boolean pollChanges(hudson.model.AbstractProject project,
                           hudson.Launcher launcher,
                           hudson.FilePath workspace,
                           hudson.model.TaskListener listener)
                    throws java.io.IOException,
                           java.lang.InterruptedException
Specified by:
pollChanges in class hudson.scm.SCM
Throws:
java.io.IOException
java.lang.InterruptedException

createClearToolLauncher

protected ClearToolLauncher createClearToolLauncher(hudson.model.TaskListener listener,
                                                    hudson.FilePath workspace,
                                                    hudson.Launcher launcher)
Creates a Hudson clear tool launcher.

Parameters:
listener - listener to write command output to
workspace - the workspace for the job
launcher - actual launcher to launch commands with
Returns:
a clear tool launcher that uses Hudson for launching commands

createClearTool

protected ClearTool createClearTool(ClearToolLauncher launcher)


Copyright © 2008. All Rights Reserved.