hudson.plugins.cmvc
Class CmvcSCM

java.lang.Object
  extended by hudson.scm.SCM
      extended by hudson.plugins.cmvc.CmvcSCM
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.model.Describable<hudson.scm.SCM>, java.io.Serializable

public class CmvcSCM
extends hudson.scm.SCM
implements java.io.Serializable

This class implements the SCM methods for a CMVC repository. The call to CMVC is assumed to work without any setup. This implies that either the environment variable BECOME_USER is set or the become user is provided in the project configuration page. Besides that this user must have permissions to access the specified family from within the hudson host.

Checks for changes in a CMVC family (repository). Triggers a build if any integrated track within the monitored releases is detected.

Utilizes CMVCs Report -raw command to query the family for changes. First it looks for all integrated tracks - within the specified releases - between the last build time and the current time (-view TrackView). Then it performs another query to find all files included in these tracks(-view ChangeView).

Changes are detected by running commands similar to the following:

 Report -family family@localhost@6666 
  -raw 
  -view TrackView 
  -where "lastUpdate between <lastBuildTime> 
  and <now> 
  and state = 'integrate' 
  and releaseName in ('RC_123') 
  order by defectName"
 
 Report -family family@localhost@6666 
  -raw 
  -view ChangeView 
  -where "defectName in ('1', '2') and releaseName in ('RC_123') order by defectName"
 

Author:
F??bio Franco Uechi
See Also:
Did You Say CMVC?, Serialized Form

Nested Class Summary
static class CmvcSCM.DescriptorImpl
           
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
static CmvcSCM.DescriptorImpl DESCRIPTOR
          Descriptor should be singleton.
 
Fields inherited from class hudson.scm.SCM
PERMISSIONS, TAG
 
Constructor Summary
CmvcSCM(java.lang.String family, java.lang.String become, java.lang.String releases, java.lang.String checkoutScript, java.lang.String trackViewReportWhereClause)
           
 
Method Summary
 void buildEnvVars(hudson.model.AbstractBuild build, java.util.Map<java.lang.String,java.lang.String> env)
           
 boolean checkout(hudson.model.AbstractBuild build, hudson.Launcher launcher, hudson.FilePath workspace, hudson.model.BuildListener listener, java.io.File changelogFile)
           
 hudson.scm.ChangeLogParser createChangeLogParser()
           
protected  java.util.Map<java.lang.String,java.lang.String> createEnvVarMap(boolean overrideOnly, hudson.model.AbstractBuild build)
           
 java.lang.String getBecome()
           
 java.lang.String getCheckoutScript()
           
 hudson.scm.SCMDescriptor<CmvcSCM> getDescriptor()
           
 java.lang.String getFamily()
           
 java.lang.String getReleases()
           
 java.lang.String getTrackViewReportWhereClause()
           
 boolean pollChanges(hudson.model.AbstractProject project, hudson.Launcher launcher, hudson.FilePath workspace, hudson.model.TaskListener listener)
          Polls cmvc repository for integrated tracks within the current family and releases
protected  boolean run(hudson.Launcher launcher, hudson.util.ArgumentListBuilder cmd, hudson.model.TaskListener listener, hudson.FilePath dir, hudson.model.AbstractBuild build)
           
protected  boolean run(hudson.Launcher launcher, hudson.util.ArgumentListBuilder cmd, hudson.model.TaskListener listener, hudson.FilePath dir, java.io.OutputStream out, hudson.model.AbstractBuild build)
          Invokes the command with the specified command line option and wait for its completion.
 void setCheckoutScript(java.lang.String checkoutScript)
           
 void setTrackViewReportWhereClause(java.lang.String trackViewReportWhereClause)
           
 
Methods inherited from class hudson.scm.SCM
_for, all, createEmptyChangeLog, getBrowser, getEffectiveBrowser, getModuleRoot, getModuleRoots, nullify, processWorkspaceBeforeDeletion, requiresWorkspaceForPolling, supportsPolling
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DESCRIPTOR

@Extension
public static final CmvcSCM.DescriptorImpl DESCRIPTOR
Descriptor should be singleton.

Constructor Detail

CmvcSCM

@DataBoundConstructor
public CmvcSCM(java.lang.String family,
                                    java.lang.String become,
                                    java.lang.String releases,
                                    java.lang.String checkoutScript,
                                    java.lang.String trackViewReportWhereClause)
Parameters:
family -
releases -
project -
cleanCopy -
Method Detail

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

createChangeLogParser

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

getDescriptor

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

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
Polls cmvc repository for integrated tracks within the current family and releases

By default it checks for changes in a CMVC family (repository). Triggers a build if any integrated track within the monitored releases is detected.

Specified by:
pollChanges in class hudson.scm.SCM
Throws:
java.io.IOException
java.lang.InterruptedException
See Also:
SCM.pollChanges(hudson.model.AbstractProject, hudson.Launcher, hudson.FilePath, hudson.model.TaskListener)

run

protected final boolean run(hudson.Launcher launcher,
                            hudson.util.ArgumentListBuilder cmd,
                            hudson.model.TaskListener listener,
                            hudson.FilePath dir,
                            java.io.OutputStream out,
                            hudson.model.AbstractBuild build)
                     throws java.io.IOException,
                            java.lang.InterruptedException
Invokes the command with the specified command line option and wait for its completion.

Parameters:
dir - if launching locally this is a local path, otherwise a remote path.
out - Receives output from the executed program.
build - TODO
Throws:
java.io.IOException
java.lang.InterruptedException

run

protected final boolean run(hudson.Launcher launcher,
                            hudson.util.ArgumentListBuilder cmd,
                            hudson.model.TaskListener listener,
                            hudson.FilePath dir,
                            hudson.model.AbstractBuild build)
                     throws java.io.IOException,
                            java.lang.InterruptedException
Throws:
java.io.IOException
java.lang.InterruptedException

createEnvVarMap

protected final java.util.Map<java.lang.String,java.lang.String> createEnvVarMap(boolean overrideOnly,
                                                                                 hudson.model.AbstractBuild build)
Parameters:
overrideOnly - true to indicate that the returned map shall only contain properties that need to be overridden. This is for use with Launcher. false to indicate that the map should contain complete map. This is to invoke Proc directly.
build - TODO

buildEnvVars

public void buildEnvVars(hudson.model.AbstractBuild build,
                         java.util.Map<java.lang.String,java.lang.String> env)
Overrides:
buildEnvVars in class hudson.scm.SCM

getReleases

public java.lang.String getReleases()

getFamily

public java.lang.String getFamily()

getBecome

public java.lang.String getBecome()

getCheckoutScript

public java.lang.String getCheckoutScript()

setCheckoutScript

public void setCheckoutScript(java.lang.String checkoutScript)

getTrackViewReportWhereClause

public java.lang.String getTrackViewReportWhereClause()

setTrackViewReportWhereClause

public void setTrackViewReportWhereClause(java.lang.String trackViewReportWhereClause)


Copyright © 2009. All Rights Reserved.