com.atlassian.bamboo.task
Interface TaskContext

All Superinterfaces:
CommonTaskContext, InternalTaskContext, TaskIdentifier
All Known Implementing Classes:
TaskContextImpl

public interface TaskContext
extends CommonTaskContext

Encapsulates the environment and configuration of a task running in a building environment.

Since:
3.1

N.B All methods remain on this interface (even though they are on the super class) so we don't accidentally break backwards compatibility.

See Also:
TaskType, TaskIdentifier

Method Summary
 BuildContext getBuildContext()
          Contains all the build related information about the running of the tasks
 BuildLogger getBuildLogger()
          Returns the appropriate logger for the task
 ConfigurationMap getConfigurationMap()
          A Map of String values from TaskDefinition.getConfiguration() where the values have gone through variable substitution through CustomVariableContext#substituteString().
 java.io.File getRootDirectory()
          Get build root directory (where sources were checked out)
 java.util.Map<java.lang.String,java.lang.String> getRuntimeTaskContext()
           
 java.io.File getWorkingDirectory()
          Get build working directory (where task should be executed).
 
Methods inherited from interface com.atlassian.bamboo.task.CommonTaskContext
getCommonContext
 
Methods inherited from interface com.atlassian.bamboo.task.TaskIdentifier
getId, getPluginKey, getUserDescription, isEnabled, isFinalising
 

Method Detail

getBuildContext

@NotNull
BuildContext getBuildContext()
Contains all the build related information about the running of the tasks

Returns:

getBuildLogger

@NotNull
BuildLogger getBuildLogger()
Returns the appropriate logger for the task

Specified by:
getBuildLogger in interface CommonTaskContext
Returns:

getRootDirectory

@NotNull
java.io.File getRootDirectory()
Get build root directory (where sources were checked out)

Specified by:
getRootDirectory in interface CommonTaskContext
Returns:
Build root directory

getWorkingDirectory

@NotNull
java.io.File getWorkingDirectory()
Get build working directory (where task should be executed).

Default implementation checks for the TaskConfigConstants.CFG_WORKING_SUB_DIRECTORY key in the TaskConfiguration if such key exists and has not empty value then working directory would be getRootDirectory() + value of TaskConfigConstants.CFG_WORKING_SUB_DIRECTORY key.

Specified by:
getWorkingDirectory in interface CommonTaskContext
Returns:
Build working directory

getConfigurationMap

@NotNull
ConfigurationMap getConfigurationMap()
A Map of String values from TaskDefinition.getConfiguration() where the values have gone through variable substitution through CustomVariableContext#substituteString(). All ${bamboo.*} and ${system.*} params are substituted.

Specified by:
getConfigurationMap in interface CommonTaskContext
Returns:

getRuntimeTaskContext

@Nullable
java.util.Map<java.lang.String,java.lang.String> getRuntimeTaskContext()
Specified by:
getRuntimeTaskContext in interface CommonTaskContext


Copyright © 2013 Atlassian Software Systems Pty Ltd. All Rights Reserved.