net.sourceforge.cruisecontrol.builders
Class ExecScript

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

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

Exec script class. Script support to execute a command and logs the results.

Author:
Kevin Lee

Constructor Summary
ExecScript()
           
 
Method Summary
 Commandline buildCommandline()
          construct the command that we're going to execute.
 void consumeLine(java.lang.String line)
          Ugly parsing of Exec output into some Elements.
protected  void flushCurrentElement()
          flush the current log element
 int getExitCode()
           
 void setBuildLogElement(org.jdom.Element buildLogElement)
           
 org.jdom.Element setBuildLogHeader(org.jdom.Element buildLogElement)
          set the "header" for this part of the build log. turns it into an Ant target/task style element for reporting purposes
 void setErrorStr(java.lang.String errStr)
           
 void setExecArgs(java.lang.String execArgs)
           
 void setExecCommand(java.lang.String execCommand)
           
 void setExitCode(int exitCode)
          exitCode is what is returned from running the script
 boolean wasError()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExecScript

public ExecScript()
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

consumeLine

public void consumeLine(java.lang.String line)
Ugly parsing of Exec output into some Elements. Gets called from StreamPumper.

Specified by:
consumeLine in interface StreamConsumer
Parameters:
line - the line of output to parse

flushCurrentElement

protected void flushCurrentElement()
flush the current log element


setBuildLogHeader

public org.jdom.Element setBuildLogHeader(org.jdom.Element buildLogElement)
set the "header" for this part of the build log. turns it into an Ant target/task style element for reporting purposes

Parameters:
buildLogElement - the element of the build log
Returns:
updated element

setExecArgs

public void setExecArgs(java.lang.String execArgs)
Parameters:
execArgs - The execArgs to set.

setExecCommand

public void setExecCommand(java.lang.String execCommand)
Parameters:
execCommand - The execCommand to set.

getExitCode

public int getExitCode()
Specified by:
getExitCode in interface Script
Returns:
returns the exitcode of the command

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 exit code value to set.

setErrorStr

public void setErrorStr(java.lang.String errStr)
Parameters:
errStr - the error string to search for

setBuildLogElement

public void setBuildLogElement(org.jdom.Element buildLogElement)
Parameters:
buildLogElement - The buildLogElement to set.

wasError

public boolean wasError()
Returns:
true if error occurred, else false