com.atlassian.bamboo.variable
Class CustomVariableContextImpl

java.lang.Object
  extended by com.atlassian.bamboo.variable.CustomVariableContextImpl
All Implemented Interfaces:
CustomVariableContext

public class CustomVariableContextImpl
extends java.lang.Object
implements CustomVariableContext


Constructor Summary
CustomVariableContextImpl()
           
 
Method Summary
 void addCustomData(java.lang.String key, java.lang.String value)
          Adds a VariableType.MANUAL variable to ThreadLocal state.
 void clearContext()
          Clear ThreadLocal state.
 java.util.Set<java.lang.String> findAllVariables(java.lang.String variable)
          Given a string, and a Map of variables (variable -> value), all patterns in the string array matching ${bamboo.} will be substituted with the value.
 java.util.Map<java.lang.String,VariableSubstitutionContext> getSubstitutedVariables()
          Get all the variables that have previously been substituted in this thread.
 java.util.Map<java.lang.String,java.lang.String> getVariables(BuildContext buildContext)
          Get all variables from context.
 java.util.Map<java.lang.String,java.lang.String> getVariables(CommonContext buildContext)
          Get all variables from context.
 java.lang.String removeAllVariables(java.lang.String value)
          Given a string array, remove all variable patterns.
 void setAdministrationConfigurationAccessor(AdministrationConfigurationAccessor administrationConfigurationAccessor)
           
 void setAgentContext(AgentContext agentContext)
           
 void setBuildContext(BuildContext buildContext)
          Set buildContext reference in ThreadLocal state.
 void setBuildDirectoryManager(BuildDirectoryManager buildDirectoryManager)
           
 void setBuildLoggerManager(BuildLoggerManager buildLoggerManager)
           
 void setCapabilityContext(CapabilityContext capabilityContext)
           
 void setCommonContext(CommonContext commonContext)
          Set context reference in ThreadLocal state.
 void setPlan(PlanIdentifier planIdentifier, java.util.Map<java.lang.String,VariableDefinitionContext> variablesContextMap)
          Sets Plan reference and variable definitions in ThreadLocal state.
 void setVariables(java.util.Map<java.lang.String,VariableDefinitionContext> variablesContextMap)
          Set variable definitions in ThreadLocal state.
 java.lang.String substituteString(java.lang.String value)
          Substitutes variables in the input string with their values using data from existing ThreadLocal state.
 java.lang.String substituteString(java.lang.String value, BuildContext buildContext, BuildLogger buildLogger)
          Substitutes variables in the input string with their values using provided data, i.e.
 java.lang.String substituteString(java.lang.String value, CommonContext commonContext, BuildLogger buildLogger)
          Substitutes variables in the input string with their values using provided data, i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CustomVariableContextImpl

public CustomVariableContextImpl()
Method Detail

setPlan

public void setPlan(@NotNull
                    PlanIdentifier planIdentifier,
                    @Nullable
                    java.util.Map<java.lang.String,VariableDefinitionContext> variablesContextMap)
Description copied from interface: CustomVariableContext
Sets Plan reference and variable definitions in ThreadLocal state. Clears history of substituted variables (CustomVariableContext.getSubstitutedVariables()

Specified by:
setPlan in interface CustomVariableContext
Parameters:
planIdentifier - plan identifier
variablesContextMap - variable definitions (including plan variables)

setVariables

public void setVariables(java.util.Map<java.lang.String,VariableDefinitionContext> variablesContextMap)
Description copied from interface: CustomVariableContext
Set variable definitions in ThreadLocal state. Clears history of substituted variables (CustomVariableContext.getSubstitutedVariables()

Specified by:
setVariables in interface CustomVariableContext
Parameters:
variablesContextMap - variable definitions

setBuildContext

public void setBuildContext(BuildContext buildContext)
Description copied from interface: CustomVariableContext
Set buildContext reference in ThreadLocal state. Sets the variable definitions to those contained in the context. BuildContext has priority over Plan when resolving the variables.

Specified by:
setBuildContext in interface CustomVariableContext

setCommonContext

public void setCommonContext(CommonContext commonContext)
Description copied from interface: CustomVariableContext
Set context reference in ThreadLocal state. Sets the variable definitions to those contained in the context. context has priority over Plans and Deployment Jobs when resolving the variables.

Specified by:
setCommonContext in interface CustomVariableContext

clearContext

public void clearContext()
Description copied from interface: CustomVariableContext
Clear ThreadLocal state.

Specified by:
clearContext in interface CustomVariableContext

getSubstitutedVariables

@NotNull
public java.util.Map<java.lang.String,VariableSubstitutionContext> getSubstitutedVariables()
Description copied from interface: CustomVariableContext
Get all the variables that have previously been substituted in this thread.

Specified by:
getSubstitutedVariables in interface CustomVariableContext
Returns:

addCustomData

public void addCustomData(java.lang.String key,
                          java.lang.String value)
Description copied from interface: CustomVariableContext
Adds a VariableType.MANUAL variable to ThreadLocal state.

Specified by:
addCustomData in interface CustomVariableContext
Parameters:
key - name of the variable
value - value of the variable

substituteString

public java.lang.String substituteString(java.lang.String value)
Description copied from interface: CustomVariableContext
Substitutes variables in the input string with their values using data from existing ThreadLocal state.

Specified by:
substituteString in interface CustomVariableContext
Parameters:
value - input string
Returns:
substituted string

substituteString

public java.lang.String substituteString(java.lang.String value,
                                         @Nullable
                                         CommonContext commonContext,
                                         BuildLogger buildLogger)
Description copied from interface: CustomVariableContext
Substitutes variables in the input string with their values using provided data, i.e. overriding (for this call only) any existing ThreadLocal state.

Specified by:
substituteString in interface CustomVariableContext
Parameters:
value - input string
commonContext - build context
buildLogger - build logger
Returns:
substituted string

substituteString

@Nullable
public java.lang.String substituteString(@Nullable
                                                  java.lang.String value,
                                                  @Nullable
                                                  BuildContext buildContext,
                                                  @Nullable
                                                  BuildLogger buildLogger)
Description copied from interface: CustomVariableContext
Substitutes variables in the input string with their values using provided data, i.e. overriding (for this call only) any existing ThreadLocal state.

Specified by:
substituteString in interface CustomVariableContext
Parameters:
value - input string
buildContext - build context
buildLogger - build logger
Returns:
substituted string

removeAllVariables

@NotNull
public java.lang.String removeAllVariables(@NotNull
                                                   java.lang.String value)
Given a string array, remove all variable patterns.

Specified by:
removeAllVariables in interface CustomVariableContext
Parameters:
value - string values to be analyzed
Returns:
value with variables removed

findAllVariables

@NotNull
public java.util.Set<java.lang.String> findAllVariables(@Nullable
                                                                java.lang.String variable)
Given a string, and a Map of variables (variable -> value), all patterns in the string array matching ${bamboo.} will be substituted with the value.

Specified by:
findAllVariables in interface CustomVariableContext
Parameters:
variable - String value to be analyzed
Returns:
Array of string values with variables extrapolated

getVariables

@NotNull
public java.util.Map<java.lang.String,java.lang.String> getVariables(@Nullable
                                                                             CommonContext buildContext)
Description copied from interface: CustomVariableContext
Get all variables from context.

Specified by:
getVariables in interface CustomVariableContext
Parameters:
buildContext - Build or Deployment context
Returns:
mapping between variable keys and values

getVariables

@NotNull
public java.util.Map<java.lang.String,java.lang.String> getVariables(@Nullable
                                                                             BuildContext buildContext)
Description copied from interface: CustomVariableContext
Get all variables from context.

Specified by:
getVariables in interface CustomVariableContext
Parameters:
buildContext - Build or Deployment context
Returns:
mapping between variable keys and values

setBuildLoggerManager

public void setBuildLoggerManager(BuildLoggerManager buildLoggerManager)

setCapabilityContext

public void setCapabilityContext(CapabilityContext capabilityContext)

setAdministrationConfigurationAccessor

public void setAdministrationConfigurationAccessor(AdministrationConfigurationAccessor administrationConfigurationAccessor)

setAgentContext

public void setAgentContext(AgentContext agentContext)

setBuildDirectoryManager

public void setBuildDirectoryManager(BuildDirectoryManager buildDirectoryManager)


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