|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.bamboo.variable.CustomVariableContextImpl
public class CustomVariableContextImpl
Constructor Summary | |
---|---|
CustomVariableContextImpl(VariableSubstitutorFactory variableSubstitutorFactory)
|
Method Summary | ||
---|---|---|
void |
addCustomData(String key,
String value)
Adds a VariableType.MANUAL variable to ThreadLocal state. |
|
void |
clearContext()
Clear ThreadLocal state. |
|
Set<String> |
findAllVariables(String variable)
Given a string, and a Map of variables (variable -> value), all patterns in the string array
matching ${bamboo. |
|
Map<String,VariableDefinitionContext> |
getBuildInRepositoryVariablesIfBuildContext()
Return variables all built-in variables produced by repository plugin for the current build context. |
|
Map<String,VariableSubstitutionContext> |
getSubstitutedVariables()
Get all the variables that have previously been substituted in this thread. |
|
Map<String,VariableDefinitionContext> |
getVariableContexts()
Get all variables from current thread local context. |
|
Map<String,VariableDefinitionContext> |
getVariableContexts(CommonContext commonContext)
Get all variables from context. |
|
Map<String,String> |
getVariables(CommonContext buildContext)
Get all variables from context. |
|
VariableSubstitutorFactory |
getVariableSubstitutorFactory()
|
|
String |
removeAllVariables(String value)
Given a string array, remove all variable patterns. |
|
void |
setCommonContext(CommonContext commonContext)
Set context reference in ThreadLocal state. |
|
void |
setPlan(ImmutablePlan plan)
Sets Plan reference and default variable definitions (globals and from plan) in ThreadLocal state. |
|
void |
setPlan(ImmutablePlan plan,
Map<String,VariableDefinitionContext> variablesContextMap)
Sets Plan reference and variable definitions in ThreadLocal state. |
|
void |
setPlan(PlanIdentifier planIdentifier,
Map<String,VariableDefinitionContext> variablesContextMap)
Sets Plan reference and variable definitions in ThreadLocal state. |
|
void |
setVariables(Map<String,VariableDefinitionContext> variablesContextMap)
Set variable definitions in ThreadLocal state. |
|
String |
substituteString(String value)
Substitutes variables in the input string with their values using data from existing ThreadLocal state. |
|
String |
substituteString(String value,
CommonContext commonContext,
BuildLogger buildLogger)
Substitutes variables in the input string with their values using provided data, i.e. |
|
|
withVariableSubstitutor(VariableSubstitutor variableSubstitutor,
Callable<V> callable)
Run operation with provided VariableSubstitutor in thread local context. |
|
void |
withVariableSubstitutor(VariableSubstitutor variableSubstitutor,
Runnable runnable)
Run operation with provided VariableSubstitutor in thread local context. |
|
|
withVariableSubstitutor(VariableSubstitutor variableSubstitutor,
com.google.common.base.Supplier<V> supplier)
Run operation with provided VariableSubstitutor in thread local context. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CustomVariableContextImpl(VariableSubstitutorFactory variableSubstitutorFactory)
Method Detail |
---|
public void setPlan(@NotNull PlanIdentifier planIdentifier, @Nullable Map<String,VariableDefinitionContext> variablesContextMap)
CustomVariableContext
ThreadLocal
state.
Clears history of substituted variables (CustomVariableContext.getSubstitutedVariables()
setPlan
in interface CustomVariableContext
variablesContextMap
- variable definitions (including plan variables)public void setPlan(@NotNull ImmutablePlan plan)
CustomVariableContext
ThreadLocal
state.
Clears history of substituted variables (CustomVariableContext.getSubstitutedVariables()
setPlan
in interface CustomVariableContext
public void setPlan(@NotNull ImmutablePlan plan, @Nullable Map<String,VariableDefinitionContext> variablesContextMap)
CustomVariableContext
ThreadLocal
state.
Clears history of substituted variables (CustomVariableContext.getSubstitutedVariables()
setPlan
in interface CustomVariableContext
variablesContextMap
- variable definitions (including plan variables)public void setVariables(Map<String,VariableDefinitionContext> variablesContextMap)
CustomVariableContext
ThreadLocal
state.
Clears history of substituted variables (CustomVariableContext.getSubstitutedVariables()
setVariables
in interface CustomVariableContext
variablesContextMap
- variable definitionspublic void setCommonContext(@NotNull CommonContext commonContext)
CustomVariableContext
ThreadLocal
state.
Sets the variable definitions to those contained in the context.
context has priority over Plans and Deployment Jobs when resolving the variables.
setCommonContext
in interface CustomVariableContext
public void clearContext()
CustomVariableContext
ThreadLocal
state.
clearContext
in interface CustomVariableContext
@NotNull public Map<String,VariableSubstitutionContext> getSubstitutedVariables()
CustomVariableContext
getSubstitutedVariables
in interface CustomVariableContext
public void addCustomData(String key, String value)
CustomVariableContext
VariableType.MANUAL
variable to ThreadLocal
state.
addCustomData
in interface CustomVariableContext
key
- name of the variablevalue
- value of the variablepublic String substituteString(String value)
CustomVariableContext
ThreadLocal
state.
substituteString
in interface CustomVariableContext
value
- input string
public String substituteString(String value, @Nullable CommonContext commonContext, BuildLogger buildLogger)
CustomVariableContext
ThreadLocal
state.
substituteString
in interface CustomVariableContext
value
- input stringcommonContext
- build contextbuildLogger
- build logger
@NotNull public String removeAllVariables(@NotNull String value)
removeAllVariables
in interface CustomVariableContext
value
- string values to be analyzed
@NotNull public Set<String> findAllVariables(@Nullable String variable)
Map
of variables (variable -> value), all patterns in the string array
matching ${bamboo.
findAllVariables
in interface CustomVariableContext
variable
- String value to be analyzed
@NotNull public Map<String,VariableDefinitionContext> getVariableContexts(@Nullable CommonContext commonContext)
CustomVariableContext
getVariableContexts
in interface CustomVariableContext
commonContext
- build or deployment context
@NotNull public Map<String,VariableDefinitionContext> getVariableContexts()
CustomVariableContext
getVariableContexts
in interface CustomVariableContext
@NotNull public Map<String,String> getVariables(@Nullable CommonContext buildContext)
CustomVariableContext
getVariables
in interface CustomVariableContext
buildContext
- Build or Deployment context
public Map<String,VariableDefinitionContext> getBuildInRepositoryVariablesIfBuildContext()
CustomVariableContext
BuildContext
, otherwise returned map will be empty.
Note: variables are used in repository definition, they will be resolved according to current state of the CustomVariableContext
getBuildInRepositoryVariablesIfBuildContext
in interface CustomVariableContext
@NotNull public VariableSubstitutorFactory getVariableSubstitutorFactory()
getVariableSubstitutorFactory
in interface CustomVariableContext
VariableSubstitutor
public void withVariableSubstitutor(@NotNull VariableSubstitutor variableSubstitutor, @NotNull Runnable runnable)
CustomVariableContext
VariableSubstitutor
in thread local context. Restore current thread local state when finished.
withVariableSubstitutor
in interface CustomVariableContext
public <V> V withVariableSubstitutor(@NotNull VariableSubstitutor variableSubstitutor, @NotNull Callable<V> callable) throws Exception
CustomVariableContext
VariableSubstitutor
in thread local context. Restore current thread local state when finished.
withVariableSubstitutor
in interface CustomVariableContext
Exception
public <V> V withVariableSubstitutor(@NotNull VariableSubstitutor variableSubstitutor, @NotNull com.google.common.base.Supplier<V> supplier)
CustomVariableContext
VariableSubstitutor
in thread local context. Restore current thread local state when finished.
withVariableSubstitutor
in interface CustomVariableContext
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |