net.sourceforge.cruisecontrol.builders
Class AntScript

java.lang.Object
  extended bynet.sourceforge.cruisecontrol.builders.AntScript
All Implemented Interfaces:
Script, StreamConsumer

public class AntScript
extends java.lang.Object
implements Script, StreamConsumer

Ant script class. Contains all the details related to running a Ant based build via either a batch script or inprocess.

Author:
Eric Pugh

Nested Class Summary
static class AntScript.ProgressLibLocatorException
           
 
Field Summary
static java.lang.String LIBNAME_PROGRESS_LOGGER
           
 
Constructor Summary
AntScript()
           
 
Method Summary
 Commandline buildCommandline()
          construct the command that we're going to execute.
 void consumeLine(java.lang.String line)
          Analyze the output of ant command, used to detect progress messages.
static java.lang.String findDefaultProgressLoggerLib()
          Finds the default location of the cruisecontrol-antprogresslogger.jar by first finding the location of the jar containing the AntScript class.
 int getExitCode()
           
 java.lang.String getLoggerClassName()
           
 void setAntScript(java.lang.String antScript)
           
 void setArgs(java.util.List args)
           
 void setBuildFile(java.lang.String buildFile)
           
 void setBuildProperties(java.util.Map buildProperties)
           
 void setExitCode(int exitCode)
          exitCode is what is returned from running the script
 void setIsLoggerClassNameSet(boolean isLoggerClassNameSet)
           
 void setKeepGoing(boolean keepGoing)
           
 void setLibs(java.util.List libs)
           
 void setListeners(java.util.List listeners)
           
 void setLoggerClassName(java.lang.String loggerClassName)
           
 void setProgress(Progress progress)
           
 void setProgressLoggerLib(java.lang.String progressLoggerLib)
           
 void setProperties(java.util.List properties)
           
 void setPropertyFile(java.lang.String propertyFile)
           
 void setShowAntOutput(boolean showAntOutput)
           
 void setSystemClassPath(java.lang.String systemClassPath)
           
 void setTarget(java.lang.String target)
           
 void setTempFileName(java.lang.String tempFileName)
           
 void setUseDebug(boolean useDebug)
           
 void setUseLogger(boolean useLogger)
           
 void setUseQuiet(boolean useQuiet)
           
 void setUseScript(boolean useScript)
           
 void setWindows(boolean isWindows)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LIBNAME_PROGRESS_LOGGER

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

AntScript

public AntScript()
Method Detail

buildCommandline

public Commandline buildCommandline()
                             throws CruiseControlException
construct the command that we're going to execute.

Specified by:
buildCommandline in interface Script
Returns:
Commandline holding command to be executed
Throws:
CruiseControlException - on unquotable attributes

findDefaultProgressLoggerLib

public static java.lang.String findDefaultProgressLoggerLib()
                                                     throws AntScript.ProgressLibLocatorException
Finds the default location of the cruisecontrol-antprogresslogger.jar by first finding the location of the jar containing the AntScript class.

Returns:
the full path (including jar name) to the jar file (cruisecontrol-antprogresslogger.jar) containing the AntProgressLogger/Listener classes.
Throws:
AntScript.ProgressLibLocatorException - if the search class (AntScript) file can't be found, likely related to running under Java Webstart >= 6, or simply if the jar can't be found

consumeLine

public void consumeLine(java.lang.String line)
Analyze the output of ant command, used to detect progress messages.

Specified by:
consumeLine in interface StreamConsumer

setBuildProperties

public void setBuildProperties(java.util.Map buildProperties)
Parameters:
buildProperties - The buildProperties to set.

getLoggerClassName

public java.lang.String getLoggerClassName()
Returns:
Returns the loggerClassName.

setLoggerClassName

public void setLoggerClassName(java.lang.String loggerClassName)
Parameters:
loggerClassName - The loggerClassName to set.

setIsLoggerClassNameSet

public void setIsLoggerClassNameSet(boolean isLoggerClassNameSet)
Parameters:
isLoggerClassNameSet - The loggerClassName to set.

setShowAntOutput

public void setShowAntOutput(boolean showAntOutput)
Parameters:
showAntOutput - if true use Dashboard AntOutputLogger (CLASSNAME_DASHBOARD_LISTENER) as listener IIF useLogger is also true

setAntScript

public void setAntScript(java.lang.String antScript)
Parameters:
antScript - The antScript to set.

setArgs

public void setArgs(java.util.List args)
Parameters:
args - The args to set.

setWindows

public void setWindows(boolean isWindows)
Parameters:
isWindows - The isWindows to set.

setBuildFile

public void setBuildFile(java.lang.String buildFile)
Parameters:
buildFile - The buildFile to set.

setTempFileName

public void setTempFileName(java.lang.String tempFileName)
Parameters:
tempFileName - The tempFileName to set.

setUseDebug

public void setUseDebug(boolean useDebug)
Parameters:
useDebug - The useDebug to set.

setUseLogger

public void setUseLogger(boolean useLogger)
Parameters:
useLogger - The useLogger to set.

setUseQuiet

public void setUseQuiet(boolean useQuiet)
Parameters:
useQuiet - The useQuiet to set.

setKeepGoing

public void setKeepGoing(boolean keepGoing)

setUseScript

public void setUseScript(boolean useScript)
Parameters:
useScript - The useScript to set.

setSystemClassPath

public void setSystemClassPath(java.lang.String systemClassPath)
Parameters:
systemClassPath - The systemClassPath to set.

setProperties

public void setProperties(java.util.List properties)
Parameters:
properties - The properties to set.

setLibs

public void setLibs(java.util.List libs)
Parameters:
libs - The set of library paths to use.

setListeners

public void setListeners(java.util.List listeners)
Parameters:
listeners - The set of listener classes to use.

setTarget

public void setTarget(java.lang.String target)
Parameters:
target - The target to set.

getExitCode

public int getExitCode()
Specified by:
getExitCode in interface Script
Returns:
Returns the exitCode.

setExitCode

public void setExitCode(int exitCode)
Description copied from interface: Script
exitCode is what is returned from running the script

Specified by:
setExitCode in interface Script
Parameters:
exitCode - The exitCode to set.

setPropertyFile

public void setPropertyFile(java.lang.String propertyFile)
Parameters:
propertyFile - The properties file to set.

setProgressLoggerLib

public void setProgressLoggerLib(java.lang.String progressLoggerLib)
Parameters:
progressLoggerLib - The directory containing the AntProgressLogger/Listener classes.

setProgress

public void setProgress(Progress progress)
Parameters:
progress - The progress callback object to set.