com.atlassian.bamboo.process
Class EnvironmentVariableAccessorImpl

java.lang.Object
  extended by com.atlassian.bamboo.process.EnvironmentVariableAccessorImpl
All Implemented Interfaces:
EnvironmentVariableAccessor

public class EnvironmentVariableAccessorImpl
extends java.lang.Object
implements EnvironmentVariableAccessor


Field Summary
 
Fields inherited from interface com.atlassian.bamboo.process.EnvironmentVariableAccessor
MAX_SAFE_ENVIRONMENT_LENGTH, MAX_SAFE_INDIVIDUAL_VARIABLE_LENGTH
 
Constructor Summary
EnvironmentVariableAccessorImpl(CapabilityContext capabilityContext)
           
 
Method Summary
 java.util.Map<java.lang.String,java.lang.String> getEnvironment()
           
 java.util.Map<java.lang.String,java.lang.String> getEnvironment(TaskContext taskContext)
          Use TaskContext as a source of environment settings.
 java.util.List<java.lang.String> getPaths(TaskContext 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnvironmentVariableAccessorImpl

public EnvironmentVariableAccessorImpl(CapabilityContext capabilityContext)
Method Detail

getEnvironment

@NotNull
public java.util.Map<java.lang.String,java.lang.String> getEnvironment()
Specified by:
getEnvironment in interface EnvironmentVariableAccessor

getEnvironment

@NotNull
public java.util.Map<java.lang.String,java.lang.String> getEnvironment(@NotNull
                                                                               TaskContext taskContext)
Description copied from interface: EnvironmentVariableAccessor
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)

Specified by:
getEnvironment in interface EnvironmentVariableAccessor
Parameters:
taskContext - TaskContext object
Returns:
Key-value map

getPaths

@NotNull
public java.util.List<java.lang.String> getPaths(@NotNull
                                                         TaskContext taskContext)
Description copied from interface: EnvironmentVariableAccessor
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)

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

joinEnvironmentVariables

@NotNull
public java.lang.String joinEnvironmentVariables(@NotNull
                                                         java.util.Map<java.lang.String,java.lang.String> environmentVariables)
Description copied from interface: EnvironmentVariableAccessor
Concatenate environment variables into string.

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

joinEnvironmentVariables

@NotNull
public java.lang.String joinEnvironmentVariables(@NotNull
                                                         java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.String>> environmentVariables)
Description copied from interface: EnvironmentVariableAccessor
Concatenate environment variables into string.

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

splitEnvironmentAssignments

@NotNull
public java.util.Map<java.lang.String,java.lang.String> splitEnvironmentAssignments(@NotNull
                                                                                            java.lang.String environmentAssignments,
                                                                                            boolean processBackslashes)
Description copied from interface: EnvironmentVariableAccessor
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]

Specified by:
splitEnvironmentAssignments in interface EnvironmentVariableAccessor
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
public java.util.Map<java.lang.String,java.lang.String> splitEnvironmentAssignments(@NotNull
                                                                                            java.lang.String environmentAssignments)
Description copied from interface: EnvironmentVariableAccessor
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]

Specified by:
splitEnvironmentAssignments in interface EnvironmentVariableAccessor
Parameters:
environmentAssignments - string containing KEY=VALUE assignments separated with white characters
Returns:
Map of separated environment settings.

validateEnvironmentVariables

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

Specified by:
validateEnvironmentVariables in interface EnvironmentVariableAccessor
Parameters:
environmentVariables - Map.Entry iterable of key-value pairs to be concatenated

validateEnvironmentVariables

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

Specified by:
validateEnvironmentVariables in interface EnvironmentVariableAccessor
Parameters:
environmentVariables - Map.Entry iterable of key-value pairs to be concatenated


Copyright © 2011 Atlassian. All Rights Reserved.