com.atlassian.bamboo.command
Class Command

java.lang.Object
  extended by com.atlassian.bamboo.command.Command
Direct Known Subclasses:
AbstractBuilder, AbstractPerforceCommand, CVSCommand

public abstract class Command
extends java.lang.Object

This class executes a command line command.


Field Summary
protected  java.util.List myCommandErrors
           
protected  java.util.List myCommandOutput
           
 
Constructor Summary
Command()
           
 
Method Summary
 int executeCommand(Build build, java.lang.String vmParams, java.lang.String javaHome)
           
 int executeCommand(Build build, java.lang.String vmParams, java.lang.String javaHome, BuildResults buildInfo)
          Execute the command line in a specific directory.
abstract  org.apache.tools.ant.types.Commandline getCommandLine()
          What the is the command line to execute?
protected  java.lang.String[] getCustomEnvironmentVars()
           
 java.lang.String[] getEnvironmentSetting(java.lang.String vmParams, java.lang.String javaHome)
          Returns the environment settings.
 java.util.List getErrorOutput()
          What was writen to the commands error stream?
 java.util.List getOutput()
          What was the commands output?
 VariableSubstitutionBean getVariableSubstitutionBean()
           
abstract  java.io.File getWorkingDirectory()
          Where should the command be executed?
 boolean hasErrors()
          Did the command generate any errors?
protected  boolean isExecutableExists()
           
protected  boolean isWindowsPlatform()
          Is the server running on the Windows platform?
 void setVariableSubstitutionBean(VariableSubstitutionBean substitutionBean)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myCommandOutput

protected transient java.util.List myCommandOutput

myCommandErrors

protected transient java.util.List myCommandErrors
Constructor Detail

Command

public Command()
Method Detail

executeCommand

public int executeCommand(Build build,
                          java.lang.String vmParams,
                          java.lang.String javaHome,
                          BuildResults buildInfo)
                   throws CommandException
Execute the command line in a specific directory.

Parameters:
build - The Build
vmParams - The virtual machine parameters to use while executing the command
javaHome - The java home value for this command
Returns:
-1 if the command failed
Throws:
CommandException - Failure

getCustomEnvironmentVars

protected java.lang.String[] getCustomEnvironmentVars()

executeCommand

public int executeCommand(Build build,
                          java.lang.String vmParams,
                          java.lang.String javaHome)
                   throws CommandException
Throws:
CommandException

isExecutableExists

protected boolean isExecutableExists()

getEnvironmentSetting

public java.lang.String[] getEnvironmentSetting(java.lang.String vmParams,
                                                java.lang.String javaHome)
Returns the environment settings. It combines the standard java settings with those provides in the vmParams

Strips off any preceeding -D's from the start of the settings

Parameters:
vmParams - build specific settings
javaHome -
Returns:
the settings

getWorkingDirectory

public abstract java.io.File getWorkingDirectory()
Where should the command be executed?

Returns:
The directory in which the command will be run

getCommandLine

public abstract org.apache.tools.ant.types.Commandline getCommandLine()
What the is the command line to execute?

Returns:
The command line

getErrorOutput

public java.util.List getErrorOutput()
What was writen to the commands error stream?

Returns:
The errors

getOutput

public java.util.List getOutput()
What was the commands output?

Returns:
The output

hasErrors

public boolean hasErrors()
Did the command generate any errors?

Returns:
true iff errors have been detected

isWindowsPlatform

protected boolean isWindowsPlatform()
Is the server running on the Windows platform?

Returns:
true iff we're on windows

setVariableSubstitutionBean

public void setVariableSubstitutionBean(VariableSubstitutionBean substitutionBean)

getVariableSubstitutionBean

public VariableSubstitutionBean getVariableSubstitutionBean()


Copyright © 2008 Atlassian Software Systems.. All Rights Reserved.