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 TaskRootDirectorySelectorrootDirectorySelectorprotected TaskExecutionContexttaskExecutionContext
-
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 booleandoesTaskProduceTestResults()@NotNull CommonContextgetBuildContext()@NotNull BuildLoggergetBuildLogger()Returns the appropriate logger for the task@NotNull CommonContextgetCommonContext()Contains all the build related information about the running of the tasks@NotNull ConfigurationMapgetConfigurationMap()AMapofStringvalues fromTaskDefinition.getConfiguration()where the values have gone through variable substitution throughCustomVariableContext.substituteString(String).longgetId()@NotNull StringgetPluginKey()@NotNull FilegetRootDirectory()Get build root directory (where sources were checked out)@Nullable Map<String,String>getRuntimeTaskContext()@Nullable Map<String,WhitelistedSerializable>getRuntimeTaskData()StringgetUserDescription()@NotNull FilegetWorkingDirectory()Get build working directory (where task should be executed).booleanisEnabled()booleanisFinalising()
-
-
-
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:
getIdin interfaceTaskIdentifier- Returns:
- the id of this configuration. Unique within the given context (e.g.
Job
-
getPluginKey
@NotNull public @NotNull String getPluginKey()
- Specified by:
getPluginKeyin interfacePluginKeyProvider- Specified by:
getPluginKeyin interfaceTaskIdentifier- Returns:
- Complete key of the task type plugin module
-
getUserDescription
public String getUserDescription()
- Specified by:
getUserDescriptionin interfaceTaskIdentifier- Returns:
- the description of the task as defined by the user
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabledin interfaceTaskIdentifier- Returns:
- whether the task is enabled or disabled
-
isFinalising
public boolean isFinalising()
- Specified by:
isFinalisingin 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:CommonTaskContextContains all the build related information about the running of the tasks- Specified by:
getCommonContextin interfaceCommonTaskContext- Returns:
-
getBuildLogger
@NotNull public @NotNull BuildLogger getBuildLogger()
Description copied from interface:CommonTaskContextReturns the appropriate logger for the task- Specified by:
getBuildLoggerin interfaceCommonTaskContext- Returns:
-
getRootDirectory
@NotNull public @NotNull File getRootDirectory()
Description copied from interface:CommonTaskContextGet build root directory (where sources were checked out)- Specified by:
getRootDirectoryin interfaceCommonTaskContext- Returns:
- Build root directory
-
getWorkingDirectory
@NotNull public @NotNull File getWorkingDirectory()
Description copied from interface:CommonTaskContextGet build working directory (where task should be executed).Default implementation checks for the
TaskConfigConstants.CFG_WORKING_SUBDIRECTORYkey in the TaskConfiguration if such key exists and has not empty value then working directory would be getRootDirectory() + value ofTaskConfigConstants.CFG_WORKING_SUBDIRECTORYkey.- Specified by:
getWorkingDirectoryin interfaceCommonTaskContext- Returns:
- Build working directory
-
getConfigurationMap
@NotNull public @NotNull ConfigurationMap getConfigurationMap()
Description copied from interface:CommonTaskContextAMapofStringvalues fromTaskDefinition.getConfiguration()where the values have gone through variable substitution throughCustomVariableContext.substituteString(String). All ${bamboo.*} and ${system.*} params are substituted.- Specified by:
getConfigurationMapin interfaceCommonTaskContext- Returns:
-
getRuntimeTaskContext
@Nullable public @Nullable Map<String,String> getRuntimeTaskContext()
- Specified by:
getRuntimeTaskContextin interfaceCommonTaskContext- Returns:
- custom runtime data that complement static task configuration
-
getRuntimeTaskData
@Nullable public @Nullable Map<String,WhitelistedSerializable> getRuntimeTaskData()
- Specified by:
getRuntimeTaskDatain interfaceCommonTaskContext- Returns:
- custom runtime data that complement static task configuration
-
doesTaskProduceTestResults
public boolean doesTaskProduceTestResults()
- Specified by:
doesTaskProduceTestResultsin interfaceCommonTaskContext
-
-