Package com.atlassian.bamboo.task
Class CommonTaskContextImpl
- java.lang.Object
-
- com.atlassian.bamboo.task.CommonTaskContextImpl
-
- All Implemented Interfaces:
PluginKeyProvider
,CommonTaskContext
,InternalTaskContext
,TaskIdentifier
- Direct Known Subclasses:
DeploymentTaskContextImpl
,TaskContextImpl
public class CommonTaskContextImpl extends Object implements CommonTaskContext
-
-
Field Summary
Fields Modifier and Type Field Description protected TaskRootDirectorySelector
rootDirectorySelector
protected TaskExecutionContext
taskExecutionContext
-
Constructor Summary
Constructors Constructor Description CommonTaskContextImpl(Map<String,String> substitutedConfiguration, TaskExecutionContext taskExecutionContext, RuntimeTaskDefinition taskDefinition)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
doesTaskProduceTestResults()
@NotNull CommonContext
getBuildContext()
@NotNull BuildLogger
getBuildLogger()
Returns the appropriate logger for the task@NotNull CommonContext
getCommonContext()
Contains all the build related information about the running of the tasks@NotNull ConfigurationMap
getConfigurationMap()
AMap
ofString
values fromTaskDefinition.getConfiguration()
where the values have gone through variable substitution throughCustomVariableContext.substituteString(String)
.long
getId()
@NotNull String
getPluginKey()
@NotNull File
getRootDirectory()
Get build root directory (where sources were checked out)@Nullable Map<String,String>
getRuntimeTaskContext()
@Nullable Map<String,WhitelistedSerializable>
getRuntimeTaskData()
String
getUserDescription()
@NotNull File
getWorkingDirectory()
Get build working directory (where task should be executed).boolean
isEnabled()
boolean
isFinalising()
-
-
-
Field Detail
-
rootDirectorySelector
protected final TaskRootDirectorySelector rootDirectorySelector
-
taskExecutionContext
protected final TaskExecutionContext taskExecutionContext
-
-
Constructor Detail
-
CommonTaskContextImpl
public CommonTaskContextImpl(Map<String,String> substitutedConfiguration, TaskExecutionContext taskExecutionContext, RuntimeTaskDefinition taskDefinition)
-
-
Method Detail
-
getId
public long getId()
- Specified by:
getId
in interfaceTaskIdentifier
- Returns:
- the id of this configuration. Unique within the given context (e.g.
Job
-
getPluginKey
@NotNull public @NotNull String getPluginKey()
- Specified by:
getPluginKey
in interfacePluginKeyProvider
- Specified by:
getPluginKey
in interfaceTaskIdentifier
- Returns:
- Complete key of the task type plugin module
-
getUserDescription
public String getUserDescription()
- Specified by:
getUserDescription
in interfaceTaskIdentifier
- Returns:
- the description of the task as defined by the user
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabled
in interfaceTaskIdentifier
- Returns:
- whether the task is enabled or disabled
-
isFinalising
public boolean isFinalising()
- Specified by:
isFinalising
in interfaceTaskIdentifier
- Returns:
- true if the task should be run in finalisation phase
-
getBuildContext
@NotNull public @NotNull CommonContext getBuildContext()
-
getCommonContext
@NotNull public @NotNull CommonContext getCommonContext()
Description copied from interface:CommonTaskContext
Contains all the build related information about the running of the tasks- Specified by:
getCommonContext
in interfaceCommonTaskContext
- Returns:
-
getBuildLogger
@NotNull public @NotNull BuildLogger getBuildLogger()
Description copied from interface:CommonTaskContext
Returns the appropriate logger for the task- Specified by:
getBuildLogger
in interfaceCommonTaskContext
- Returns:
-
getRootDirectory
@NotNull public @NotNull File getRootDirectory()
Description copied from interface:CommonTaskContext
Get build root directory (where sources were checked out)- Specified by:
getRootDirectory
in interfaceCommonTaskContext
- Returns:
- Build root directory
-
getWorkingDirectory
@NotNull public @NotNull File getWorkingDirectory()
Description copied from interface:CommonTaskContext
Get build working directory (where task should be executed).Default implementation checks for the
TaskConfigConstants.CFG_WORKING_SUBDIRECTORY
key in the TaskConfiguration if such key exists and has not empty value then working directory would be getRootDirectory() + value ofTaskConfigConstants.CFG_WORKING_SUBDIRECTORY
key.- Specified by:
getWorkingDirectory
in interfaceCommonTaskContext
- Returns:
- Build working directory
-
getConfigurationMap
@NotNull public @NotNull ConfigurationMap getConfigurationMap()
Description copied from interface:CommonTaskContext
AMap
ofString
values fromTaskDefinition.getConfiguration()
where the values have gone through variable substitution throughCustomVariableContext.substituteString(String)
. All ${bamboo.*} and ${system.*} params are substituted.- Specified by:
getConfigurationMap
in interfaceCommonTaskContext
- Returns:
-
getRuntimeTaskContext
@Nullable public @Nullable Map<String,String> getRuntimeTaskContext()
- Specified by:
getRuntimeTaskContext
in interfaceCommonTaskContext
- Returns:
- custom runtime data that complement static task configuration
-
getRuntimeTaskData
@Nullable public @Nullable Map<String,WhitelistedSerializable> getRuntimeTaskData()
- Specified by:
getRuntimeTaskData
in interfaceCommonTaskContext
- Returns:
- custom runtime data that complement static task configuration
-
doesTaskProduceTestResults
public boolean doesTaskProduceTestResults()
- Specified by:
doesTaskProduceTestResults
in interfaceCommonTaskContext
-
-