com.atlassian.bamboo.utils
Class SystemProperty

java.lang.Object
  extended by com.atlassian.bamboo.utils.SystemProperty

public class SystemProperty
extends java.lang.Object

This class represents system properties as constants. The system / environmental constants resolution order goes:

  1. System.getProperty (so any -Dproperty=hello will take precedent)
  2. System.getenv() (works only on JDK 1.5)
  3. Ant's Execute.getProcEnvironment() (should work for all JDKs)


Field Summary
static SystemProperty ANT_HOME
          Location of ANT
static SystemProperty BAMBOO_HOME_FROM_ENV
          Location of Bamboo Home
static SystemProperty BUILD_RESULTS_CACHE_SIZE
          Make the buildresults cache configurable
static SystemProperty BUILDING_DISABLED
           
static SystemProperty CVS_CHECKOUT_FORMAT
          CVS checkout format, the default behavior is to checkout in BINARY format, although this can be overidden with either TEXT or NONE
static SystemProperty CVS_FORCE_CHECKOUT_TO_LATEST
          A flag that forces Bamboo's CVS repository to checkout to the latest of that particular branch / HEAD, rather than using the -d flag, which seems to have compatibility issues in some cases.
static SystemProperty CVS_TIME_DIFF
          The CVS Server's time offset in minutes if different to Bamboo Server
static SystemProperty DEFAULT_CVS_ROOT
          Default CVS Root (CVS server!)
static SystemProperty DEFAULT_P4_EXE
          Default Perforce p4 executable
static SystemProperty DEFAULT_PERFORCE_CLIENT
          Default Perforce Client
static SystemProperty DEFAULT_PERFORCE_PORT
          Default Perforce Port (Perforce server!)
static SystemProperty DEFAULT_PERFORCE_USER
          Default Perforce User
static SystemProperty DISABLE_AGENT_AUTO_CAPABILITY_DETECTION
          Prevents agents from automatically overriding remote agent capabilities on new startup
static SystemProperty DISABLE_SUCCESSFUL_TEST_INDEX
          A workaround for BAM-1323, allows us to ignore successful tests from the index, greatly improving performance of the reindex and reducing the size of it.
static SystemProperty EC2_IGNORE_CERT_CHECK
          Allow EC2 agents to ignore invalid certificates, if not using the tunnel
static SystemProperty EC2_TUNNEL_ENABLED
          Whether to enable Tunnel for http traffic two and from the agents.
static SystemProperty ELASTIC_IMAGE_AMI_ID
          Lets you over ride the default elastic images used
static SystemProperty FILTER_MAVEN_LOG_FOR_DOWNLOAD_STATUS
           
static SystemProperty FIND_SUCCESS_MESSAGE_IN_LAST
          Number of lines for builders to look back to guarantee
static SystemProperty LOG_LINES_FOR_NOTIFICATIONS
          Lets you control how much information is showed in notifications - for build completed emails the last x number of error lines will be included - for build errored emails the first x number of lines of the stack trace will be included
static SystemProperty MAVEN_HOME
          Location of MAVEN
static SystemProperty MAVEN2_HOME
          Location of MAVEN 2
static SystemProperty PATH
          The system PATH variable.
static SystemProperty SEARCH_BUILD_SUCCESS_FAIL_MESSAGE_EVERYWHERE
          A workaround for BAM-4069, allows us to search for build successful/failed messages.
static SystemProperty SVN_14_COMPATIBLE
          Bamboo will check out subversion code in 1.4 format rather than 1.5
static SystemProperty SVN_SPOOL_TO_FILE
           
 
Constructor Summary
  SystemProperty(boolean mandatory, java.lang.String... properties)
           
  SystemProperty(java.lang.String property, boolean mandatory)
          Deprecated. Use SystemProperty(boolean, String...) instead
protected SystemProperty(java.lang.String property, boolean mandatory, org.apache.commons.logging.Log logger)
          Used in testing
  SystemProperty(java.lang.String property1, java.lang.String property2, boolean mandatory)
          Deprecated. Use SystemProperty(boolean, String...) instead
  SystemProperty(java.lang.String property1, java.lang.String property2, java.lang.String property3, boolean mandatory)
          Deprecated. Use SystemProperty(boolean, String...) instead
 
Method Summary
 boolean exists()
           
protected static java.lang.String getEnvironmentVariable(java.lang.String variable, boolean mandatory)
          Obtain the specified environment variable.
 java.lang.String getKey()
          Obtain the key used to find this property
 java.lang.String getValue()
          Obtain the value of this proprty
 boolean getValue(boolean defaultValue)
          Obtain the boolean property value
 int getValue(int defaultValue)
           
 long getValue(long defaultValue)
           
 java.lang.String getValue(java.lang.String defaultValue)
          Obtain the value of the property (returns the default value if the enviroment variable has not been defined.
 void setValue(java.lang.String propertyValue)
          So the setting can be set by a test
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BAMBOO_HOME_FROM_ENV

public static final SystemProperty BAMBOO_HOME_FROM_ENV
Location of Bamboo Home


MAVEN_HOME

public static final SystemProperty MAVEN_HOME
Location of MAVEN


MAVEN2_HOME

public static final SystemProperty MAVEN2_HOME
Location of MAVEN 2


ANT_HOME

public static final SystemProperty ANT_HOME
Location of ANT


DEFAULT_CVS_ROOT

public static final SystemProperty DEFAULT_CVS_ROOT
Default CVS Root (CVS server!)


DEFAULT_PERFORCE_PORT

public static final SystemProperty DEFAULT_PERFORCE_PORT
Default Perforce Port (Perforce server!)


DEFAULT_PERFORCE_CLIENT

public static final SystemProperty DEFAULT_PERFORCE_CLIENT
Default Perforce Client


DEFAULT_PERFORCE_USER

public static final SystemProperty DEFAULT_PERFORCE_USER
Default Perforce User


DEFAULT_P4_EXE

public static final SystemProperty DEFAULT_P4_EXE
Default Perforce p4 executable


FIND_SUCCESS_MESSAGE_IN_LAST

public static final SystemProperty FIND_SUCCESS_MESSAGE_IN_LAST
Number of lines for builders to look back to guarantee


DISABLE_SUCCESSFUL_TEST_INDEX

public static final SystemProperty DISABLE_SUCCESSFUL_TEST_INDEX
A workaround for BAM-1323, allows us to ignore successful tests from the index, greatly improving performance of the reindex and reducing the size of it. Will mean that the test stats may be a little wrong.


SEARCH_BUILD_SUCCESS_FAIL_MESSAGE_EVERYWHERE

public static final SystemProperty SEARCH_BUILD_SUCCESS_FAIL_MESSAGE_EVERYWHERE
A workaround for BAM-4069, allows us to search for build successful/failed messages.


DISABLE_AGENT_AUTO_CAPABILITY_DETECTION

public static final SystemProperty DISABLE_AGENT_AUTO_CAPABILITY_DETECTION
Prevents agents from automatically overriding remote agent capabilities on new startup


SVN_SPOOL_TO_FILE

public static final SystemProperty SVN_SPOOL_TO_FILE

BUILDING_DISABLED

public static final SystemProperty BUILDING_DISABLED

PATH

public static final SystemProperty PATH
The system PATH variable. Needed so we can append to ir


CVS_TIME_DIFF

public static final SystemProperty CVS_TIME_DIFF
The CVS Server's time offset in minutes if different to Bamboo Server


CVS_CHECKOUT_FORMAT

public static final SystemProperty CVS_CHECKOUT_FORMAT
CVS checkout format, the default behavior is to checkout in BINARY format, although this can be overidden with either TEXT or NONE


CVS_FORCE_CHECKOUT_TO_LATEST

public static final SystemProperty CVS_FORCE_CHECKOUT_TO_LATEST
A flag that forces Bamboo's CVS repository to checkout to the latest of that particular branch / HEAD, rather than using the -d flag, which seems to have compatibility issues in some cases. See BAM-2542


BUILD_RESULTS_CACHE_SIZE

public static final SystemProperty BUILD_RESULTS_CACHE_SIZE
Make the buildresults cache configurable


FILTER_MAVEN_LOG_FOR_DOWNLOAD_STATUS

public static final SystemProperty FILTER_MAVEN_LOG_FOR_DOWNLOAD_STATUS

SVN_14_COMPATIBLE

public static final SystemProperty SVN_14_COMPATIBLE
Bamboo will check out subversion code in 1.4 format rather than 1.5


LOG_LINES_FOR_NOTIFICATIONS

public static final SystemProperty LOG_LINES_FOR_NOTIFICATIONS
Lets you control how much information is showed in notifications - for build completed emails the last x number of error lines will be included - for build errored emails the first x number of lines of the stack trace will be included


ELASTIC_IMAGE_AMI_ID

public static final SystemProperty ELASTIC_IMAGE_AMI_ID
Lets you over ride the default elastic images used


EC2_TUNNEL_ENABLED

public static final SystemProperty EC2_TUNNEL_ENABLED
Whether to enable Tunnel for http traffic two and from the agents. Defaults to true


EC2_IGNORE_CERT_CHECK

public static final SystemProperty EC2_IGNORE_CERT_CHECK
Allow EC2 agents to ignore invalid certificates, if not using the tunnel

Constructor Detail

SystemProperty

@Deprecated
public SystemProperty(java.lang.String property,
                                 boolean mandatory)
Deprecated. Use SystemProperty(boolean, String...) instead

Creates an instance containing the value of the given property - logs an error if it cannot be found

Parameters:
property - The property we're loading from the environment
mandatory - Is the property mandatory or optional?

SystemProperty

@Deprecated
public SystemProperty(java.lang.String property1,
                                 java.lang.String property2,
                                 boolean mandatory)
Deprecated. Use SystemProperty(boolean, String...) instead

Parameters:
property1 - The property we're loading from the environment (name variant #1)
property2 - The property we're loading from the environment (name variant #2)
mandatory - Is the property mandatory or optional?

SystemProperty

@Deprecated
public SystemProperty(java.lang.String property1,
                                 java.lang.String property2,
                                 java.lang.String property3,
                                 boolean mandatory)
Deprecated. Use SystemProperty(boolean, String...) instead

Parameters:
property1 - The property we're loading from the environment (name variant #1)
property2 - The property we're loading from the environment (name variant #2)
property3 - The property we're loading from the environment (name variant #3)
mandatory - Is the property mandatory or optional?

SystemProperty

public SystemProperty(boolean mandatory,
                      java.lang.String... properties)
Parameters:
mandatory - Is the property mandatory or optional?
properties - The property we're loading from the environment (first name found will be loaded)

SystemProperty

protected SystemProperty(java.lang.String property,
                         boolean mandatory,
                         org.apache.commons.logging.Log logger)
Used in testing

Parameters:
property - The property we're loading from the environment
mandatory - Is the property mandatory or optional?
logger - The logger we're logging errors to
Method Detail

getValue

public java.lang.String getValue()
Obtain the value of this proprty

Returns:
The value (null if the environment variable has not been defined)

getKey

public java.lang.String getKey()
Obtain the key used to find this property

Returns:
The key (null if environment variable has not been defined)

getValue

public java.lang.String getValue(java.lang.String defaultValue)
Obtain the value of the property (returns the default value if the enviroment variable has not been defined.

Parameters:
defaultValue - The default value, if the environment variable has not been defined
Returns:
The value of the property

getValue

public boolean getValue(boolean defaultValue)
Obtain the boolean property value

Parameters:
defaultValue - The default value, if the environment variable has not been defined
Returns:
The value of the property

getEnvironmentVariable

@Nullable
protected static java.lang.String getEnvironmentVariable(@NotNull
                                                                  java.lang.String variable,
                                                                  boolean mandatory)
Obtain the specified environment variable. An error is logged if a mandatory value does not exist.

Parameters:
variable - The variable we require
mandatory - Is this a mandatory property?
Returns:
The value of the variable, null if not found

setValue

public void setValue(java.lang.String propertyValue)
So the setting can be set by a test

Parameters:
propertyValue - The value required by the test

exists

public boolean exists()

getValue

public int getValue(int defaultValue)

getValue

public long getValue(long defaultValue)


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.