|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
@PublicApi public interface CustomVariableContext
Bean maintaining ThreadLocal state of available variables.
The state contains (if applicable):
- current Plan
- variable definitions (including Plan variables when applicable)
- BuildContext
- BuildLogger
| Method Summary | ||
|---|---|---|
void |
addCustomData(String key,
String value)
Adds a VariableType.MANUAL variable to ThreadLocal state. |
|
void |
clearContext()
Deprecated. since 5.9 use CustomVariableContextRunner or withVariableSubstitutor(VariableSubstitutor, Runnable) |
|
Set<String> |
findAllVariables(String stringWithVariables)
Given a string, all patterns in the string 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)
Deprecated. since 5.9 use getVariableContexts() if you want to use current thread local context. Use VariableSubstitutor otherwise. |
|
Map<String,String> |
getVariables(CommonContext commonContext)
Deprecated. since 5.9 use getVariableContexts() if you want to use current thread local context. Use VariableSubstitutor otherwise. |
|
VariableSubstitutorFactory |
getVariableSubstitutorFactory()
|
|
String |
removeAllVariables(String unparsedString)
Given a string, remove all variable patterns. |
|
void |
setCommonContext(CommonContext commonContext)
Deprecated. since 5.9 use CustomVariableContextRunner or withVariableSubstitutor(VariableSubstitutor, Runnable) |
|
void |
setPlan(ImmutablePlan plan)
Deprecated. since 5.9 use CustomVariableContextRunner or withVariableSubstitutor(VariableSubstitutor, Runnable) |
|
void |
setPlan(ImmutablePlan plan,
Map<String,VariableDefinitionContext> variablesContextMap)
Deprecated. since 5.9 use CustomVariableContextRunner or withVariableSubstitutor(VariableSubstitutor, Runnable) |
|
void |
setPlan(PlanIdentifier plan,
Map<String,VariableDefinitionContext> variablesContextMap)
Deprecated. since 5.9 use CustomVariableContextRunner or withVariableSubstitutor(VariableSubstitutor, Runnable) |
|
void |
setVariables(Map<String,VariableDefinitionContext> variablesContextMap)
Deprecated. since 5.9 use CustomVariableContextRunner or withVariableSubstitutor(VariableSubstitutor, Runnable) |
|
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)
Deprecated. since 5.9 use substituteString(String) if you want to use current thread local context. Use VariableSubstitutor otherwise. |
|
|
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. |
|
| Method Detail |
|---|
void addCustomData(String key,
String value)
VariableType.MANUAL variable to ThreadLocal state.
key - name of the variablevalue - value of the variable
@Nullable
String substituteString(@Nullable
String value)
ThreadLocal state.
value - input string
@Deprecated
@Nullable
String substituteString(@Nullable
String value,
@Nullable
CommonContext commonContext,
@Nullable
BuildLogger buildLogger)
substituteString(String) if you want to use current thread local context. Use VariableSubstitutor otherwise.
ThreadLocal state.
value - input stringcommonContext - build contextbuildLogger - build logger
@Deprecated
@NotNull
Map<String,VariableDefinitionContext> getVariableContexts(@Nullable
CommonContext commonContext)
getVariableContexts() if you want to use current thread local context. Use VariableSubstitutor otherwise.
commonContext - build or deployment context
@NotNull Map<String,VariableDefinitionContext> getVariableContexts()
@NotNull
@Deprecated
Map<String,String> getVariables(@Nullable
CommonContext commonContext)
getVariableContexts() if you want to use current thread local context. Use VariableSubstitutor otherwise.
commonContext - Build or Deployment context
@NotNull
String removeAllVariables(@NotNull
String unparsedString)
unparsedString - string values to be analyzed
@NotNull Map<String,VariableSubstitutionContext> getSubstitutedVariables()
@Deprecated
void setCommonContext(@NotNull
CommonContext commonContext)
CustomVariableContextRunner or withVariableSubstitutor(VariableSubstitutor, Runnable)
ThreadLocal state.
Sets the variable definitions to those contained in the context.
context has priority over Plans and Deployment Jobs when resolving the variables.
commonContext - @Deprecated void clearContext()
CustomVariableContextRunner or withVariableSubstitutor(VariableSubstitutor, Runnable)
ThreadLocal state.
@Deprecated
void setPlan(@NotNull
PlanIdentifier plan,
@Nullable
Map<String,VariableDefinitionContext> variablesContextMap)
CustomVariableContextRunner or withVariableSubstitutor(VariableSubstitutor, Runnable)
ThreadLocal state.
Clears history of substituted variables (getSubstitutedVariables()
plan - variablesContextMap - variable definitions (including plan variables)
@Deprecated
void setPlan(@NotNull
ImmutablePlan plan,
@Nullable
Map<String,VariableDefinitionContext> variablesContextMap)
CustomVariableContextRunner or withVariableSubstitutor(VariableSubstitutor, Runnable)
ThreadLocal state.
Clears history of substituted variables (getSubstitutedVariables()
plan - variablesContextMap - variable definitions (including plan variables)
@Deprecated
void setPlan(@NotNull
ImmutablePlan plan)
CustomVariableContextRunner or withVariableSubstitutor(VariableSubstitutor, Runnable)
ThreadLocal state.
Clears history of substituted variables (getSubstitutedVariables()
plan - @Deprecated void setVariables(Map<String,VariableDefinitionContext> variablesContextMap)
CustomVariableContextRunner or withVariableSubstitutor(VariableSubstitutor, Runnable)
ThreadLocal state.
Clears history of substituted variables (getSubstitutedVariables()
variablesContextMap - variable definitions
@NotNull
Set<String> findAllVariables(@Nullable
String stringWithVariables)
stringWithVariables - String value to be analyzed
@NotNull Map<String,VariableDefinitionContext> getBuildInRepositoryVariablesIfBuildContext()
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
@NotNull VariableSubstitutorFactory getVariableSubstitutorFactory()
VariableSubstitutor
void withVariableSubstitutor(@NotNull
VariableSubstitutor variableSubstitutor,
@NotNull
Runnable runnable)
VariableSubstitutor in thread local context. Restore current thread local state when finished.
<V> V withVariableSubstitutor(@NotNull
VariableSubstitutor variableSubstitutor,
@NotNull
Callable<V> callable)
throws Exception
VariableSubstitutor in thread local context. Restore current thread local state when finished.
Exception
<V> V withVariableSubstitutor(@NotNull
VariableSubstitutor variableSubstitutor,
@NotNull
com.google.common.base.Supplier<V> supplier)
VariableSubstitutor in thread local context. Restore current thread local state when finished.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||