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  BuildLoggerManager buildLoggerManager
           
protected  VariableSubstitutionBean substitutionBean
           
 
Constructor Summary
Command()
           
 
Method Summary
 int executeCommand(CommandExecuteStreamHandler commandExecuteStreamHandler, java.lang.String planKey, java.lang.String vmParams, java.lang.String javaHome, java.util.Map<java.lang.String,java.lang.String> customBuildData, ReadOnlyCapabilitySet capabilitySet)
          Execute the command line in a specific directory.
 BuildLoggerManager getBuildLoggerManager()
           
abstract  org.apache.tools.ant.types.Commandline getCommandLine(ReadOnlyCapabilitySet capabilitySet)
          What the is the command line to execute?
protected  java.lang.String[] getCustomEnvironmentVars(ReadOnlyCapabilitySet capabilitySet)
           
 java.lang.String[] getEnvironmentSetting(java.lang.String vmParams, java.lang.String javaHome)
          Returns the environment settings.
 VariableSubstitutionBean getVariableSubstitutionBean()
           
abstract  java.io.File getWorkingDirectory()
          Where should the command be executed?
protected  boolean isExecutableExists(ReadOnlyCapabilitySet capabilitySet)
           
protected  boolean isWindowsPlatform()
          Is the server running on the Windows platform?
 void setBuildLoggerManager(BuildLoggerManager buildLoggerManager)
           
 void setVariableSubstitutionBean(VariableSubstitutionBean substitutionBean)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

substitutionBean

protected VariableSubstitutionBean substitutionBean

buildLoggerManager

protected BuildLoggerManager buildLoggerManager
Constructor Detail

Command

public Command()
Method Detail

executeCommand

public int executeCommand(@NotNull
                          CommandExecuteStreamHandler commandExecuteStreamHandler,
                          java.lang.String planKey,
                          java.lang.String vmParams,
                          java.lang.String javaHome,
                          java.util.Map<java.lang.String,java.lang.String> customBuildData,
                          ReadOnlyCapabilitySet capabilitySet)
                   throws CommandException
Execute the command line in a specific directory.

Parameters:
commandExecuteStreamHandler - Stream Handler for the output of the execute command
planKey - the plan key for the build
vmParams - The virtual machine parameters to use while executing the command
javaHome - The java home value for this command
customBuildData -
capabilitySet -
Returns:
-1 if the command failed
Throws:
CommandException - Failure

getCustomEnvironmentVars

protected java.lang.String[] getCustomEnvironmentVars(ReadOnlyCapabilitySet capabilitySet)

isExecutableExists

protected boolean isExecutableExists(ReadOnlyCapabilitySet capabilitySet)

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(ReadOnlyCapabilitySet capabilitySet)
What the is the command line to execute?

Parameters:
capabilitySet -
Returns:
The command line

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

setBuildLoggerManager

public void setBuildLoggerManager(BuildLoggerManager buildLoggerManager)

getBuildLoggerManager

public BuildLoggerManager getBuildLoggerManager()


Copyright © 2008 Atlassian Pty Ltd. All Rights Reserved.