com.atlassian.bamboo.process
Interface EnvironmentVariableAccessor

All Known Implementing Classes:
EnvironmentVariableAccessorImpl

public interface EnvironmentVariableAccessor

Accessor for all environment variables needed by the ProcessService.

Since:
3.1

Field Summary
static int MAX_SAFE_ENVIRONMENT_LENGTH
           
static int MAX_SAFE_INDIVIDUAL_VARIABLE_LENGTH
           
 
Method Summary
 java.util.Map<java.lang.String,java.lang.String> getEnvironment()
           
 java.util.Map<java.lang.String,java.lang.String> getEnvironment(CommonTaskContext taskContext)
          Use TaskContext as a source of environment settings.
 java.util.List<java.lang.String> getPaths(CommonTaskContext taskContext)
          Use TaskContext as a source of additional PATH settings.
 java.lang.String joinEnvironmentVariables(java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.String>> environmentVariables)
          Concatenate environment variables into string.
 java.lang.String joinEnvironmentVariables(java.util.Map<java.lang.String,java.lang.String> environmentVariables)
          Concatenate environment variables into string.
 java.util.Map<java.lang.String,java.lang.String> splitEnvironmentAssignments(java.lang.String environmentAssignments)
          Splits "Environment settings" string into array of separate strings.
 java.util.Map<java.lang.String,java.lang.String> splitEnvironmentAssignments(java.lang.String environmentAssignments, boolean processBackslashes)
          Splits "Environment settings" string into array of separate strings.
 void validateEnvironmentVariables(java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.String>> environmentVariables)
          Perform basic validation of environment settings before passing it to process-utils
 void validateEnvironmentVariables(java.util.Map<java.lang.String,java.lang.String> environmentVariables)
          Perform basic validation of environment settings before passing it to process-utils
 

Field Detail

MAX_SAFE_ENVIRONMENT_LENGTH

static final int MAX_SAFE_ENVIRONMENT_LENGTH
See Also:
Constant Field Values

MAX_SAFE_INDIVIDUAL_VARIABLE_LENGTH

static final int MAX_SAFE_INDIVIDUAL_VARIABLE_LENGTH
See Also:
Constant Field Values
Method Detail

getEnvironment

@NotNull
java.util.Map<java.lang.String,java.lang.String> getEnvironment()

getEnvironment

@NotNull
java.util.Map<java.lang.String,java.lang.String> getEnvironment(@NotNull
                                                                        CommonTaskContext taskContext)
Use TaskContext as a source of environment settings. The following variables will be returned - variables for variable definitions from taskContext - JAVA_HOME (if defined in task configuration and appropriate capability exists)

Parameters:
taskContext - TaskContext object
Returns:
Key-value map

getPaths

@NotNull
java.util.List<java.lang.String> getPaths(@NotNull
                                                  CommonTaskContext taskContext)
Use TaskContext as a source of additional PATH settings. The following values might be returned - $JAVA_HOME/bin (if defined in task configuration and appropriate capability exists)

Parameters:
taskContext - TaskContext object
Returns:
List of paths (which will be probably added to PATH by caller

joinEnvironmentVariables

@NotNull
java.lang.String joinEnvironmentVariables(@NotNull
                                                  java.util.Map<java.lang.String,java.lang.String> environmentVariables)
Concatenate environment variables into string.

Parameters:
environmentVariables - Map of key-value pairs to be concatenated
Returns:
concatenated environment variables in form "KEY1=VALUE1 KEY2=VALUE2 ..."

joinEnvironmentVariables

@NotNull
java.lang.String joinEnvironmentVariables(@NotNull
                                                  java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.String>> environmentVariables)
Concatenate environment variables into string.

Parameters:
environmentVariables - Map.Entry iterable of key-value pairs to be concatenated
Returns:
concatenated environment variables in form "KEY1=VALUE1 KEY2=VALUE2 ..."

splitEnvironmentAssignments

@NotNull
java.util.Map<java.lang.String,java.lang.String> splitEnvironmentAssignments(@NotNull
                                                                                     java.lang.String environmentAssignments,
                                                                                     boolean processBackslashes)
Splits "Environment settings" string into array of separate strings. Quoting is taken into consideration. An environment setting is defined as a sequence of characters [noquote]+([quote][noquote]+[quote])? or [quote][noquote][quote]

Parameters:
environmentAssignments - the string containing KEY=VALUE assignments separated with white characters
processBackslashes - whether to treat a backslash as an ordinary or quoting character
Returns:
Map of separated environment settings.

splitEnvironmentAssignments

@NotNull
java.util.Map<java.lang.String,java.lang.String> splitEnvironmentAssignments(@NotNull
                                                                                     java.lang.String environmentAssignments)
Splits "Environment settings" string into array of separate strings. Quoting using single and double quotes, but not backslashes is taken into consideration. An environment setting is defined as a sequence of characters. [noquote]+([quote][noquote]+[quote])? or [quote][noquote][quote]

Parameters:
environmentAssignments - string containing KEY=VALUE assignments separated with white characters
Returns:
Map of separated environment settings.

validateEnvironmentVariables

void validateEnvironmentVariables(@NotNull
                                  java.util.Map<java.lang.String,java.lang.String> environmentVariables)
Perform basic validation of environment settings before passing it to process-utils

Parameters:
environmentVariables - Map.Entry iterable of key-value pairs to be concatenated

validateEnvironmentVariables

void validateEnvironmentVariables(@NotNull
                                  java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.String>> environmentVariables)
Perform basic validation of environment settings before passing it to process-utils

Parameters:
environmentVariables - Map.Entry iterable of key-value pairs to be concatenated


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