jetbrains.buildServer.serverSide
Class TeamCityServerProperties

java.lang.Object
  extended by jetbrains.buildServer.serverSide.TeamCityServerProperties

public class TeamCityServerProperties
extends java.lang.Object

Created 27.02.13 19:18 /** Encapsulates the access to (internal) system properties.

The access is provided via get* methods, all of which first look up the key in a file (by default in ~/.BuildServer/config/internal.properties), then loop it up in System.getProperties(). The properties file is optional, but if it exists, it is reread on each modification (sleep interval is 10 seconds by default, and can be set manually using "teamcity.internal.properties.reread.interval.ms" property) .

All access methods are thread-safe and never throw exceptions. Performance note: all access methods are never blocked to read the value from the file. In case the file is removed, last used properties map is in effect.

Also note that the errors are not reported to the log, because the log environment might be not initialized yet (it can require a system property for that =).

Since:
8.0
Author:
Eugene Petrenko (eugene.petrenko@jetbrains.com), Maxim Podkolzine (maxim.podkolzine@jetbrains.com)

Field Summary
static java.lang.String TEAMCITY_DATA_PATH_ENV
           
static java.lang.String TEAMCITY_DATA_PATH_PROPERTY
           
static java.lang.String TEAMCITY_DEBUG_MODE
           
 
Constructor Summary
TeamCityServerProperties()
           
 
Method Summary
static java.io.File determineDataDir(com.intellij.openapi.diagnostic.Logger logger)
          Determines the TeamCity Data path.
static java.lang.String getDataPath()
          Determines the TeamCity Data path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEAMCITY_DATA_PATH_PROPERTY

public static final java.lang.String TEAMCITY_DATA_PATH_PROPERTY
See Also:
Constant Field Values

TEAMCITY_DATA_PATH_ENV

public static final java.lang.String TEAMCITY_DATA_PATH_ENV
See Also:
Constant Field Values

TEAMCITY_DEBUG_MODE

public static final java.lang.String TEAMCITY_DEBUG_MODE
See Also:
Constant Field Values
Constructor Detail

TeamCityServerProperties

public TeamCityServerProperties()
Method Detail

determineDataDir

@NotNull
public static java.io.File determineDataDir(@Nullable
                                                    com.intellij.openapi.diagnostic.Logger logger)
Determines the TeamCity Data path.

The path can be read from JVM property or environment variable (if both are specified JVM property has precedence):

  1. JVM property -Dteamcity.data.path (see TEAMCITY_DATA_PATH_PROPERTY)
  2. environment variable TEAMCITY_DATA_PATH (see TEAMCITY_DATA_PATH_ENV)
If neither system property nor environment variable is specified the path is: [User Home path]/.BuildServer

Returns:
the TeamCity Data path, not canonical.
Since:
7.1.2
See Also:
ServerPaths

getDataPath

@NotNull
public static java.lang.String getDataPath()
Determines the TeamCity Data path.

The path can be read from JVM property or environment variable (if both are specified JVM property has precedence):

  1. JVM property -Dteamcity.data.path (see TEAMCITY_DATA_PATH_PROPERTY)
  2. environment variable TEAMCITY_DATA_PATH (see TEAMCITY_DATA_PATH_ENV)
If neither system property nor environment variable is specified the path is: [User Home path]/.BuildServer

Returns:
the TeamCity Data path with unix-like ('/') path separator.
Since:
7.1
See Also:
determineDataDir(com.intellij.openapi.diagnostic.Logger), ServerPaths