com.atlassian.bamboo.task
Class CommonTaskContextImpl

java.lang.Object
  extended by com.atlassian.bamboo.task.CommonTaskContextImpl
All Implemented Interfaces:
CommonTaskContext, InternalTaskContext, TaskIdentifier
Direct Known Subclasses:
DeploymentTaskContextImpl, TaskContextImpl

public class CommonTaskContextImpl
extends java.lang.Object
implements CommonTaskContext


Field Summary
protected  TaskRootDirectorySelector rootDirectorySelector
           
protected  TaskExecutionContext taskExecutionContext
           
 
Constructor Summary
CommonTaskContextImpl(java.util.Map<java.lang.String,java.lang.String> substitutedConfiguration, TaskExecutionContext taskExecutionContext, TaskDefinition taskDefinition)
           
 
Method Summary
 CommonContext getBuildContext()
           
 BuildLogger getBuildLogger()
          Returns the appropriate logger for the task
 CommonContext getCommonContext()
          Contains all the build related information about the running of the tasks
 ConfigurationMap getConfigurationMap()
          A Map of String values from TaskDefinition.getConfiguration() where the values have gone through variable substitution through CustomVariableContext.substituteString(String).
 long getId()
           
 java.lang.String getPluginKey()
           
 java.io.File getRootDirectory()
          Get build root directory (where sources were checked out)
 java.util.Map<java.lang.String,java.lang.String> getRuntimeTaskContext()
           
 java.lang.String getUserDescription()
           
 java.io.File getWorkingDirectory()
          Get build working directory (where task should be executed).
 boolean isEnabled()
           
 boolean isFinalising()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rootDirectorySelector

protected final TaskRootDirectorySelector rootDirectorySelector

taskExecutionContext

protected final TaskExecutionContext taskExecutionContext
Constructor Detail

CommonTaskContextImpl

public CommonTaskContextImpl(java.util.Map<java.lang.String,java.lang.String> substitutedConfiguration,
                             TaskExecutionContext taskExecutionContext,
                             TaskDefinition taskDefinition)
Method Detail

getId

public long getId()
Specified by:
getId in interface TaskIdentifier
Returns:
the id of this configuration. Unique within the given context (e.g. Job

getPluginKey

@NotNull
public java.lang.String getPluginKey()
Specified by:
getPluginKey in interface TaskIdentifier
Returns:
Complete key of the task type plugin module

getUserDescription

public java.lang.String getUserDescription()
Specified by:
getUserDescription in interface TaskIdentifier
Returns:
the description of the task as defined by the user

isEnabled

public boolean isEnabled()
Specified by:
isEnabled in interface TaskIdentifier
Returns:
whether the task is enabled or disabled

isFinalising

public boolean isFinalising()
Specified by:
isFinalising in interface TaskIdentifier
Returns:
true if the task should be run in finalisation phase

getBuildContext

@NotNull
public CommonContext getBuildContext()

getCommonContext

@NotNull
public CommonContext getCommonContext()
Description copied from interface: CommonTaskContext
Contains all the build related information about the running of the tasks

Specified by:
getCommonContext in interface CommonTaskContext
Returns:

getBuildLogger

@NotNull
public BuildLogger getBuildLogger()
Description copied from interface: CommonTaskContext
Returns the appropriate logger for the task

Specified by:
getBuildLogger in interface CommonTaskContext
Returns:

getRootDirectory

@NotNull
public java.io.File getRootDirectory()
Description copied from interface: CommonTaskContext
Get build root directory (where sources were checked out)

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

getWorkingDirectory

@NotNull
public java.io.File getWorkingDirectory()
Description copied from interface: CommonTaskContext
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
public ConfigurationMap getConfigurationMap()
Description copied from interface: CommonTaskContext
A Map of String values from TaskDefinition.getConfiguration() where the values have gone through variable substitution through CustomVariableContext.substituteString(String). All ${bamboo.*} and ${system.*} params are substituted.

Specified by:
getConfigurationMap in interface CommonTaskContext
Returns:

getRuntimeTaskContext

@Nullable
public 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.