net.sourceforge.cruisecontrol.sourcecontrols
Class AlienBrain

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

public class AlienBrain
extends AlienBrainCore
implements SourceControl

This class implements the SourceControl methods for an AlienBrain repository. It does this by taking advantage of the AlienBrain command- line utility. Obviously, the command line utility must be installed and working in order for this class to work. This class is based very heavily on P4.java.

Author:
Scott Jacobs
See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sourceforge.cruisecontrol.sourcecontrols.AlienBrainCore
AB_NO_SESSION
 
Constructor Summary
AlienBrain()
           
 
Method Summary
protected  ManagedCommandline buildGetModificationsCommand(java.util.Date lastBuild, java.util.Date now)
          Construct a ManagedCommandline which will run the AlienBrain command-line client in such a way that it will return a list of modifications.
static long dateToFiletime(java.util.Date date)
          Convert a Java Date into an AlienBrain SCIT timestamp.
static java.util.Date filetimeToDate(long filetime)
          Convert an AlienBrain SCIT timestamp into a Java Date.
 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
protected  java.util.List getModificationsFromAlienBrain(java.util.Date lastBuild, java.util.Date now)
          Run the AlienBrain command-line client and return a list of Modifications since lastBuild, if any.
 java.util.Map getProperties()
          Any properties that have been set in this sourcecontrol.
protected static Modification parseModificationDescription(java.lang.String description)
          Turns a string, most likely provided from the AlienBrain command-line client, into a Modification.
protected  java.util.List parseModifications(java.util.List modifications)
          Turn a stream containing the results of running the AlienBrain command-line client into a list of Modifications.
 void setProperty(java.lang.String propertyName)
           
 void validate()
           
 
Methods inherited from class net.sourceforge.cruisecontrol.sourcecontrols.AlienBrainCore
addArgumentIfSet, addFlagIfSet, buildCommonCommand, getBranch, getDatabase, getPassword, getPath, getServer, getUser, setActiveBranch, setBranch, setDatabase, setPassword, setPath, setServer, setUser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AlienBrain

public AlienBrain()
Method Detail

getProperties

public java.util.Map getProperties()
Any properties that have been set in this sourcecontrol.

Specified by:
getProperties in interface SourceControl

setProperty

public void setProperty(java.lang.String propertyName)

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)
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

dateToFiletime

public static long dateToFiletime(java.util.Date date)
Convert a Java Date into an AlienBrain SCIT timestamp. AlienBrain provides a 64-bit modification timestamp that is in windows FILETIME format, which is a 65-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).


filetimeToDate

public static java.util.Date filetimeToDate(long filetime)
Convert an AlienBrain SCIT timestamp into a Java Date. AlienBrain provides a 64-bit modification timestamp that is in windows FILETIME format, which is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (UTC).


buildGetModificationsCommand

protected ManagedCommandline buildGetModificationsCommand(java.util.Date lastBuild,
                                                          java.util.Date now)
Construct a ManagedCommandline which will run the AlienBrain command-line client in such a way that it will return a list of modifications.

Parameters:
lastBuild -
now -

getModificationsFromAlienBrain

protected java.util.List getModificationsFromAlienBrain(java.util.Date lastBuild,
                                                        java.util.Date now)
                                                 throws java.io.IOException,
                                                        CruiseControlException
Run the AlienBrain command-line client and return a list of Modifications since lastBuild, if any.

Parameters:
lastBuild -
now -
Throws:
java.io.IOException
CruiseControlException

parseModifications

protected java.util.List parseModifications(java.util.List modifications)
Turn a stream containing the results of running the AlienBrain command-line client into a list of Modifications.


parseModificationDescription

protected static Modification parseModificationDescription(java.lang.String description)
Turns a string, most likely provided from the AlienBrain command-line client, into a Modification.