jetbrains.buildServer.serverSide
Interface SBuildServer

All Superinterfaces:
BuildServer, ExtensionHolder, RootUrlHolder, RunningBuildsManager, ServerExtensionHolder, ServiceLocator

public interface SBuildServer
extends BuildServer, RunningBuildsManager, RootUrlHolder, ServerExtensionHolder

This is one of the core components of the TeamCity server-side support. It manages many aspects of TeamCity, for instance:

Author:
Kir
See Also:
ProjectManager, RunningBuildsManager, BuildHistory, UserModel, VcsManager, ServerExtensionHolder

Nested Class Summary
 
Nested classes/interfaces inherited from interface jetbrains.buildServer.ExtensionHolder
ExtensionHolder.ExtensionAction<T extends TeamCityExtension>
 
Method Summary
 void addListener(BuildServerListener listener)
          Add global TeamCity listener.
 SBuild findBuildInstanceByBuildNumber(java.lang.String buildTypeId, java.lang.String buildNumber)
          Returns most recent build with the specified build number
 SBuild findBuildInstanceById(long buildId)
          Return the build which corresponds to given buildId.
 java.util.Collection<SBuild> findBuildInstances(java.util.Collection<java.lang.Long> buildIds)
          Returns collection of builds corresponding to the specified builds ids.
 SBuild findPreviousBuild(SBuild build)
          Finds a non personal build (running or finished) which was started before the specified build and contains same or previous changes than the specified build.
 SBuild findPreviousBuild(SBuild build, BuildDataFilter filter)
          Same as findPreviousBuild(SBuild) but searches for a previous build among builds accepted by the specified filter.
 boolean flushQueue()
          Check for free build agents and try to send builds from queue to build agents.
 java.io.File getArtifactsDirectory()
          Returns directory containing artifacts of all projects (global artifacts directory).
 BuildAgentManager getBuildAgentManager()
           
 java.lang.String getBuildNumber()
          Returns server build number, i.e. build number of server-side code running on the build server
 java.lang.String getConfigDir()
          Returns path to the TeamCity configuration directory.
 java.util.List<SBuild> getEntriesSince(SBuild build, SBuildType buildType)
          Returns collection of finished and running builds which are later than the given one in term of changes.
 java.util.concurrent.ScheduledExecutorService getExecutor()
          Executor service for short-time processes
 java.lang.String getFullServerVersion()
          Returns full server version string, including build number: TeamCity 3.0 EAP (build 4545)
 BuildHistory getHistory()
           
 LicensingPolicy getLicensingPolicy()
           
 LoginConfiguration getLoginConfiguration()
          Return login configurations manager
 PersonalBuildManager getPersonalBuildManager()
          Returns specific manager for personal builds.
 ProjectManager getProjectManager()
           
 BuildQueue getQueue()
           
 RunTypeRegistry getRunTypeRegistry()
          Returns registry for vairous build runners, like Ant, Maven, or Duplicates.
 byte getServerMajorVersion()
          Get server major version, 3 for TeamCity 3.0
 byte getServerMinorVersion()
          Get server minor version, 2 for TeamCity 1.2
 java.lang.String getServerRootPath()
          Path to server web application, i.e. servletContext.getRealPath("/")
 SourceVersionProvider getSourceVersionProvider()
          Returns manager of build sources versions on different build agents (information for patch building)
 SQLRunner getSQLRunner()
          Return the interface for interaction with the SQL database of TeamCity
 StatusProvider getStatusProvider()
           
 java.lang.String getSystemDir()
          Returns path to the TeamCity system directory.
 UserModel getUserModel()
           
 VcsModificationHistory getVcsHistory()
           
 VcsManager getVcsManager()
           
 boolean isShuttingDown()
          Returns true if server shutdown is in progress.
 void removeListener(BuildServerListener listener)
          Remove global TeamCity listener.
 
Methods inherited from interface jetbrains.buildServer.BuildServer
fetchData, getDataUrl, getResponsibilityIds
 
Methods inherited from interface jetbrains.buildServer.serverSide.RunningBuildsManager
findRunningBuildById, getNumberOfRunningBuilds, getRunningBuildOnAgent, getRunningBuilds, getRunningBuilds, getRunningStatus
 
Methods inherited from interface jetbrains.buildServer.RootUrlHolder
getRootUrl, setRootUrl
 
Methods inherited from interface jetbrains.buildServer.ExtensionHolder
foreachExtension, getExtension, getExtensions, getExtensionSources, registerExtension, unregisterExtension
 
Methods inherited from interface jetbrains.buildServer.ServiceLocator
findSingletonService, getServices, getSingletonService
 

Method Detail

addListener

void addListener(BuildServerListener listener)
Add global TeamCity listener. Listeners should work fast, if long operation is required, use executor getExecutor()

Parameters:
listener - listener to add
See Also:
BuildServerAdapter

removeListener

void removeListener(BuildServerListener listener)
Remove global TeamCity listener.

Parameters:
listener - listener to remove
See Also:
BuildServerAdapter

getSystemDir

java.lang.String getSystemDir()
Returns path to the TeamCity system directory. This directory contains build logs, artifacts, HSQLDB database files, and other non-configuration stuff. Usually, this is TEAMCITY_DATA_PATH/system, where TEAMCITY_DATA_PATH is specified as system property teamcity.data.path or environment variable TEAMCITY_DATA_PATH or $HOME/.BuildServer

Returns:
TeamCity system directory

getConfigDir

java.lang.String getConfigDir()
Returns path to the TeamCity configuration directory. This directory contains various settings of TeamCity, including description of projects, build configurations, and other settings. Usually, this is TEAMCITY_DATA_PATH/config, where TEAMCITY_DATA_PATH is specified as system property teamcity.data.path or environment variable TEAMCITY_DATA_PATH or $HOME/.BuildServer

Returns:
TeamCity configuration directory

getArtifactsDirectory

@NotNull
java.io.File getArtifactsDirectory()
Returns directory containing artifacts of all projects (global artifacts directory). If directory does not exist - attempts to create it. If creation is not successful a runtime exception is thrown.

Returns:
global artifacts directory

getProjectManager

@NotNull
ProjectManager getProjectManager()
Returns:
project and build configuration manager.

getQueue

@NotNull
BuildQueue getQueue()
Returns:
build queue manager

getHistory

@NotNull
BuildHistory getHistory()
Returns:
build history manager

getUserModel

@NotNull
UserModel getUserModel()
Returns:
user model in TeamCity

getVcsManager

@NotNull
VcsManager getVcsManager()
Returns:
Manager of various registered version controls and API to register VCS support

getVcsHistory

@NotNull
VcsModificationHistory getVcsHistory()
Returns:
Manager of version control history

flushQueue

boolean flushQueue()
Check for free build agents and try to send builds from queue to build agents.

Returns:
true if at least one build was started

findBuildInstanceById

@Nullable
SBuild findBuildInstanceById(long buildId)
Return the build which corresponds to given buildId. Build can be running, or it can be finished.

Specified by:
findBuildInstanceById in interface BuildServer
Parameters:
buildId - build identifier
Returns:
the build which corresponds to given buildId
See Also:
Build.isFinished(), findBuildInstanceByBuildNumber(String, String)

findPreviousBuild

@Nullable
SBuild findPreviousBuild(@NotNull
                                  SBuild build)
Finds a non personal build (running or finished) which was started before the specified build and contains same or previous changes than the specified build. The resulting build belongs to the same build configuration.

Parameters:
build - build to find previous build for
Returns:
previous build in same build configuration or null if there is no previous build

findPreviousBuild

@Nullable
SBuild findPreviousBuild(@NotNull
                                  SBuild build,
                                  @NotNull
                                  BuildDataFilter filter)
Same as findPreviousBuild(SBuild) but searches for a previous build among builds accepted by the specified filter. Previous mean containing previous changes or with same changes but started before this one.

Parameters:
build - build to find previous build for
filter - build filter
Returns:
previous build in same build configuration matching the specified filter or null if there is no previous build

findBuildInstances

java.util.Collection<SBuild> findBuildInstances(java.util.Collection<java.lang.Long> buildIds)
Returns collection of builds corresponding to the specified builds ids. Both running and finished builds can appear in the resulting collection. The collection will contain existing builds only. NOTE: RETURNED COLLECTION WILL NOT MAINTAIN REQUESTED ORDER!

Parameters:
buildIds - build identifiers to be searched for.
Returns:
see above

findBuildInstanceByBuildNumber

@Nullable
SBuild findBuildInstanceByBuildNumber(@NotNull
                                               java.lang.String buildTypeId,
                                               @NotNull
                                               java.lang.String buildNumber)
Returns most recent build with the specified build number

Parameters:
buildTypeId - build configuration identifier
buildNumber - build number string
Returns:
see above

getRunTypeRegistry

@NotNull
RunTypeRegistry getRunTypeRegistry()
Returns registry for vairous build runners, like Ant, Maven, or Duplicates.

Returns:
see above
See Also:
RunType

getSQLRunner

SQLRunner getSQLRunner()
Return the interface for interaction with the SQL database of TeamCity

Returns:
see above

getPersonalBuildManager

PersonalBuildManager getPersonalBuildManager()
Returns specific manager for personal builds.

Returns:
see above

getSourceVersionProvider

SourceVersionProvider getSourceVersionProvider()
Returns manager of build sources versions on different build agents (information for patch building)

Returns:
see above

getLoginConfiguration

LoginConfiguration getLoginConfiguration()
Return login configurations manager

Returns:
see above

getServerMajorVersion

byte getServerMajorVersion()
Get server major version, 3 for TeamCity 3.0

Returns:
see above

getServerMinorVersion

byte getServerMinorVersion()
Get server minor version, 2 for TeamCity 1.2

Returns:
see above

getFullServerVersion

java.lang.String getFullServerVersion()
Returns full server version string, including build number: TeamCity 3.0 EAP (build 4545)

Returns:
see above

getBuildNumber

java.lang.String getBuildNumber()
Returns server build number, i.e. build number of server-side code running on the build server

Returns:
see above

getServerRootPath

java.lang.String getServerRootPath()
Path to server web application, i.e. servletContext.getRealPath("/")

Returns:
see above

getExecutor

java.util.concurrent.ScheduledExecutorService getExecutor()
Executor service for short-time processes

Returns:
Executor service for short-time processes

getBuildAgentManager

@NotNull
BuildAgentManager getBuildAgentManager()
Returns:
manager of build agents.

getStatusProvider

StatusProvider getStatusProvider()
Returns:
Notification status helper. Most likely this method will be deprecated.

getLicensingPolicy

LicensingPolicy getLicensingPolicy()
Returns:
current licensing policy.

getEntriesSince

java.util.List<SBuild> getEntriesSince(@Nullable
                                       SBuild build,
                                       SBuildType buildType)
Returns collection of finished and running builds which are later than the given one in term of changes. I.e. history builds which were started after the given one but relate to changes made before it, won't be returned. Collection is sorted by change order descending (recent first).

Parameters:
build - the boundary build, the result collection won't include it. if null, all builds will be returned
buildType - build configuration where to search in.
Returns:
collection of finished and running builds belonging to the specified configuration which start after the specified one (ordered by changes, recent first).

isShuttingDown

boolean isShuttingDown()
Returns true if server shutdown is in progress.

Returns:
see above