net.sourceforge.cruisecontrol.sourcecontrols
Class CMSynergy

java.lang.Object
  extended bynet.sourceforge.cruisecontrol.sourcecontrols.CMSynergy
All Implemented Interfaces:
java.io.Serializable, SourceControl

public class CMSynergy
extends java.lang.Object
implements SourceControl

Checks for modifications made to a Telelogic CM Synergy repository. It does this by examining a provided reference project, getting the tasks from all folders in that project, and checking the completion time of those tasks against the last build.

Author:
Robert J. Smith
See Also:
Serialized Form

Field Summary
static java.lang.String CCM_ATTR_DELIMITER
          A delimiter used for data values returned from a CM Synergy query
static java.lang.String CCM_END_OBJECT
          A delimiter used to mark the end of a multi-lined result from a query
static java.lang.String CCM_EXE
          The default CM Synergy command line client executable
static java.lang.String CCM_SESSION_FILE
          The default CM Synergy session map file
static java.lang.String CCM_SESSION_VAR
          The environment variable used by CM Synergy to determine which backend ccmSession to use when issuing commands.
 
Constructor Summary
CMSynergy()
           
 
Method Summary
static ManagedCommandline createCcmCommand(java.lang.String ccmExe, java.lang.String sessionName, java.io.File sessionFile)
          Creates a ManagedCommandline configured to run CM Synergy commands.
 java.util.List getModifications(java.util.Date lastBuild, java.util.Date now)
          Get a List of Modifications detailing all the changes between now and the last build
 java.util.Map getProperties()
          Any properties that have been set in this sourcecontrol.
static java.lang.String getSessionID(java.lang.String sessionName, java.io.File sessionFile)
          Given a CM Synergy session name, looks up the corresponding session ID.
 void setCcmDateFormat(java.lang.String format)
          Sets the date format used by your installation of CM Synergy.
 void setCcmDb(java.lang.String db)
          Sets the remote Synergy database with which to connect.
 void setCcmExe(java.lang.String ccmExe)
          Sets the name of the CM Synergy executable to use when issuing commands.
 void setChangeSynergyURL(java.lang.String url)
          Sets the URL for your installation of Change Synergy.
 void setCountry(java.lang.String country)
          Sets the country used to create the locale for parsing CM Synergy dates.
 void setIgnoreWorkarea(boolean ignoreWorkarea)
          Sets the value of the ignoreWorkarea attribute.
 void setInstance(java.lang.String projectInstance)
          Sets the project's instance value.
 void setLanguage(java.lang.String language)
          Sets the language used to create the locale for parsing CM Synergy dates.
 void setProject(java.lang.String projectSpec)
          Sets the CM Synergy project spec to be used as a template for calculating changes.
 void setProperty(java.lang.String property)
           
 void setReconfigure(boolean reconfigure)
          Sets the value of the reconfigure attribute.
 void setRecurse(boolean recurse)
          Sets the value of the recurse attribute.
 void setSessionFile(java.lang.String sessionFile)
          Sets the file which contains the mapping between CM Synergy session names and IDs.
 void setSessionName(java.lang.String sessionName)
          Sets the name of the CM Synergy session to use with this plugin.
 void setUpdateFolders(boolean updateFolders)
          Sets the value of the updateFolders attribute.
 void validate()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CCM_ATTR_DELIMITER

public static final java.lang.String CCM_ATTR_DELIMITER
A delimiter used for data values returned from a CM Synergy query

See Also:
Constant Field Values

CCM_END_OBJECT

public static final java.lang.String CCM_END_OBJECT
A delimiter used to mark the end of a multi-lined result from a query

See Also:
Constant Field Values

CCM_EXE

public static final java.lang.String CCM_EXE
The default CM Synergy command line client executable

See Also:
Constant Field Values

CCM_SESSION_VAR

public static final java.lang.String CCM_SESSION_VAR
The environment variable used by CM Synergy to determine which backend ccmSession to use when issuing commands.

See Also:
Constant Field Values

CCM_SESSION_FILE

public static final java.lang.String CCM_SESSION_FILE
The default CM Synergy session map file

Constructor Detail

CMSynergy

public CMSynergy()
Method Detail

setCcmExe

public void setCcmExe(java.lang.String ccmExe)
Sets the name of the CM Synergy executable to use when issuing commands.

Parameters:
ccmExe - the name of the CM Synergy executable

setProject

public void setProject(java.lang.String projectSpec)
Sets the CM Synergy project spec to be used as a template for calculating changes. The value set here can be accessed from within the build as the property "cc.ccm.project".

Parameters:
projectSpec - The project spec (in 2 part name format).

setInstance

public void setInstance(java.lang.String projectInstance)
Sets the project's instance value. This value will be used in any query which involves the project. Defaults to "1". This default should work for most people. You might, however, need to override this value when using DCM?

Parameters:
projectInstance - The instance number of the project.

setChangeSynergyURL

public void setChangeSynergyURL(java.lang.String url)
Sets the URL for your installation of Change Synergy. This is used to create active links from the modification report to the Change Requests associated with the modified tasks. If not set, the links will not be created. If you wish to use this feature, you must also set the ccmdb attribute to the remote location of the Synergy database.

Parameters:
url - The URL of your ChangeSynergy installation

setCcmDb

public void setCcmDb(java.lang.String db)
Sets the remote Synergy database with which to connect. This is only needed if you wish to create active links from the build results page to your installation of Change Synergy. If you set this attribute, you must also set the changesynergyurl attribute.

Parameters:
db - The remote Synergy database with which to connect (e.g. /ccmdb/mydb).

setUpdateFolders

public void setUpdateFolders(boolean updateFolders)
Sets the value of the updateFolders attribute. If set to true, the contents of the folders contained within the project's reconfigure properties will be updated before we query to find new tasks.

Parameters:
updateFolders -

setSessionFile

public void setSessionFile(java.lang.String sessionFile)
Sets the file which contains the mapping between CM Synergy session names and IDs. This file should be in the standard properties file format. Each line should map one name to a CM Synergy session ID (as returned by the "ccm status" command).

example:

session1=localhost:65024:192.168.1.17

Parameters:
sessionFile - The session file

setSessionName

public void setSessionName(java.lang.String sessionName)
Sets the name of the CM Synergy session to use with this plugin. This name should appear in the specified session file.

Parameters:
sessionName - The session name
See Also:
setSessionFile(String)

setCcmDateFormat

public void setCcmDateFormat(java.lang.String format)
Sets the date format used by your installation of CM Synergy. The format string should use the syntax described in SimpleDateFormat. The default is "EEE MMM dd HH:mm:ss yyyy" The value set here can be accessed from within the build as the property "cc.ccm.dateformat".

Parameters:
format - the date format

setReconfigure

public void setReconfigure(boolean reconfigure)
Sets the value of the reconfigure attribute. If set to true, the project will be reconfigured when changes are detected. Default value is false.

Parameters:
reconfigure -

setRecurse

public void setRecurse(boolean recurse)
Sets the value of the recurse attribute. Used in conjuction with the reconfigure attribute. If set to true, all subprojects will also be reconfigured when changes are detected. Default is true.

Parameters:
recurse -

setIgnoreWorkarea

public void setIgnoreWorkarea(boolean ignoreWorkarea)
Sets the value of the ignoreWorkarea attribute. If set to true, we will not attempt to determine the location of the project's workarea, nor will we pass the cc.ccm.workarea attribute to the builders. Default is false.

Parameters:
ignoreWorkarea -

setLanguage

public void setLanguage(java.lang.String language)
Sets the language used to create the locale for parsing CM Synergy dates. The format should follow the ISO standard as specified by java.util.Locale. The default is "en" (English).

Parameters:
language - The language to use when creating the Locale

setCountry

public void setCountry(java.lang.String country)
Sets the country used to create the locale for parsing CM Synergy dates. The format should follow the ISO standard as specified by java.util.Locale. The default is "US" (United States).

Parameters:
country - The ISO country code to use

getProperties

public java.util.Map getProperties()
Description copied from interface: SourceControl
Any properties that have been set in this sourcecontrol. Will be passed onto the Builder, which may then pass the properties to the underlying build implementation. For example, the Ant builder will define these properties so that the underlying Ant script can use them.

Specified by:
getProperties in interface SourceControl

setProperty

public void setProperty(java.lang.String property)

validate

public void validate()
              throws CruiseControlException
Specified by:
validate in interface SourceControl
Throws:
CruiseControlException

getModifications

public java.util.List getModifications(java.util.Date lastBuild,
                                       java.util.Date now)
Description copied from interface: SourceControl
Get a List of Modifications detailing all the changes between now and the last build

Specified by:
getModifications in interface SourceControl
Parameters:
lastBuild -
now -
Returns:
List of Modification objects

getSessionID

public static java.lang.String getSessionID(java.lang.String sessionName,
                                            java.io.File sessionFile)
                                     throws CruiseControlException
Given a CM Synergy session name, looks up the corresponding session ID.

Parameters:
sessionName - The CM Synergy session name
sessionFile - The session map file
Returns:
The session ID.
Throws:
CruiseControlException

createCcmCommand

public static ManagedCommandline createCcmCommand(java.lang.String ccmExe,
                                                  java.lang.String sessionName,
                                                  java.io.File sessionFile)
Creates a ManagedCommandline configured to run CM Synergy commands.

Parameters:
ccmExe - Full path of the CM Synergy command line client (or null to use the default).
sessionName - The name of the session as stored in the map file (or null to use the default session).
sessionFile - The CM Synergy session map file (or null to use the default).
Returns:
A configured ManagedCommandline