net.sourceforge.cruisecontrol.sourcecontrols
Class Compound

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

public class Compound
extends java.lang.Object
implements SourceControl

This class implements a Compound source control with one triggers section and one targets section. The triggers section contains one or more source controls that act as triggers for the modifications, i.e. the modificationset returned will be empty unless one or more of the source controls in the triggers section returns a non-empty modification list. The targets section contains source controls for targets that will be built (if modified) if and only if any of the source controls in the triggers section is modified. It is possible to add the trigger modifications to the list of returned modifications if the "includeTriggerChanges" attribute is set to true in the tag corresponding to this class. The following is an example of how to use this source control in the config.xml file: <modificationset quietperiod="1" > <compound includeTriggerChanges="false"> <triggers> <filesystem folder="./mod_file.txt" /> </triggers> <targets> <cvs cvsroot=":pserver:user@cvs_repo.com:/cvs" /> </targets> </compound> </modificationset>

Author:
Will Gwaltney
See Also:
Serialized Form

Nested Class Summary
protected static class Compound.Entry
          Static inner class, used to define a basis for the Targets and Triggers classes that are used inside the <compound>-tag.
 
Constructor Summary
Compound()
           
 
Method Summary
 java.lang.Object createTargets()
          Creates an empty Targets object and returns it to the calling routine to be filled.
 java.lang.Object createTriggers()
          Creates an empty Triggers object and returns it to the calling routine to be filled.
 java.util.List getModifications(java.util.Date lastBuild, java.util.Date now)
          Returns a list of modifications since the last build.
 java.util.Map getProperties()
          Any properties that have been set in this sourcecontrol.
 void setIncludeTriggerChanges(java.lang.String changes)
          Sets whether to include modifications from the triggers when getModifications() returns the mods list.
 void setProperty(java.lang.String propertyName)
           
 void validate()
          Confirms that there is exactly one triggers block and one targets block even if the triggers mods are included and the target block is empty (otherwise you wouldn't need a compound block to begin with).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Compound

public Compound()
Method Detail

setProperty

public void setProperty(java.lang.String propertyName)

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

getModifications

public java.util.List getModifications(java.util.Date lastBuild,
                                       java.util.Date now)
Returns a list of modifications since the last build. First check for any modifications from the triggers. If there are none, then return an empty list. Otherwise return the modifications from the targets, and from the triggers also if the includeTriggerChanges member variable is true.

Specified by:
getModifications in interface SourceControl
Parameters:
lastBuild - the date and time of the last build
now - the current date and time
Returns:
a list of the modifications

validate

public void validate()
              throws CruiseControlException
Confirms that there is exactly one triggers block and one targets block even if the triggers mods are included and the target block is empty (otherwise you wouldn't need a compound block to begin with).

Specified by:
validate in interface SourceControl
Throws:
CruiseControlException - if the validation fails

createTriggers

public java.lang.Object createTriggers()
Creates an empty Triggers object and returns it to the calling routine to be filled.

Returns:
an empty Triggers object

createTargets

public java.lang.Object createTargets()
Creates an empty Targets object and returns it to the calling routine to be filled.

Returns:
an empty Targets object

setIncludeTriggerChanges

public void setIncludeTriggerChanges(java.lang.String changes)
Sets whether to include modifications from the triggers when getModifications() returns the mods list.

Parameters:
changes - true to include trigger changes, false otherwise