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 Object

This class executes a command line command.


Constructor Summary
Command()
           
 
Method Summary
 int executeCommand(Build build, String vmParams, String javaHome)
          Execute the command line in a specific directory.
abstract  Commandline getCommandLine()
          What the is the command line to execute?
 String[] getEnvironmentSetting(String vmParams, String javaHome)
          Returns the environment settings.
 List getErrorOutput()
          What was writen to the commands error stream?
 List getOutput()
          What was the commands output?
abstract  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?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Command

public Command()
Method Detail

executeCommand

public int executeCommand(Build build,
                          String vmParams,
                          String javaHome)
                   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

isExecutableExists

protected boolean isExecutableExists()

getEnvironmentSetting

public String[] getEnvironmentSetting(String vmParams,
                                      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 File getWorkingDirectory()
Where should the command be executed?

Returns:
The directory in which the command will be run

getCommandLine

public abstract Commandline getCommandLine()
What the is the command line to execute?

Returns:
The command line

getErrorOutput

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

Returns:
The errors

getOutput

public 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


Copyright © 2006 Atlassian Software Systems. All Rights Reserved.