Class StartupContext
- java.lang.Object
-
- jetbrains.buildServer.maintenance.StartupContext
-
@ThreadSafe public final class StartupContext extends Object
Holds TeamCity StartUp variables. Doesn't do any complex logic, just holds the variables.- Since:
- 7.1
- Author:
- Leonid Bushuev from JetBrains
-
-
Field Summary
Fields Modifier and Type Field Description Property<String>
myMaintenanceAuthenticationToken
static String
TEAMCITY_CACHES_PATH_PROP
static String
TEAMCITY_READ_ONLY_NODE_IGNORE_UPGRADE_CHECK
-
Constructor Summary
Constructors Constructor Description StartupContext(Logger logger, TimeService timeService)
StartupContext(Logger logger, TimeService timeService, Map<String,String> env)
-
Method Summary
-
-
-
Field Detail
-
TEAMCITY_READ_ONLY_NODE_IGNORE_UPGRADE_CHECK
public static final String TEAMCITY_READ_ONLY_NODE_IGNORE_UPGRADE_CHECK
- See Also:
- Constant Field Values
-
TEAMCITY_CACHES_PATH_PROP
public static final String TEAMCITY_CACHES_PATH_PROP
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
StartupContext
public StartupContext(@NotNull Logger logger, @NotNull TimeService timeService)
-
StartupContext
public StartupContext(@NotNull Logger logger, @NotNull TimeService timeService, @NotNull Map<String,String> env)
-
-
Method Detail
-
generateMaintenanceAuthenticationToken
public static long generateMaintenanceAuthenticationToken()
-
proposeNextStage
public void proposeNextStage(@NotNull StartupStage nextStage, @NotNull StartupStage... subsequentStages)
Sets the next stage. When the current stage has done, the next stage will be this one.- Parameters:
nextStage
- the next stage.subsequentStages
- optional subsequent stages (certain stages require this information).
-
setStarting
public void setStarting(boolean starting)
-
setAllowOverrideDataDirectory
public void setAllowOverrideDataDirectory(boolean allow)
-
setSelectedDataDirPath
public void setSelectedDataDirPath(@NotNull String dataDirPath)
-
setSuggestedFirstStartDataDirLocation
public void setSuggestedFirstStartDataDirLocation(@NotNull String path)
-
isStartingAsMain
public boolean isStartingAsMain()
-
isAskedForNodeType
public boolean isAskedForNodeType()
-
setAskedForNodeType
public void setAskedForNodeType(boolean askedForNodeType)
-
setInternalDatabaseFileVersion
public void setInternalDatabaseFileVersion(@Nullable String internalDatabaseFileVersion)
-
setConnectionString
public void setConnectionString(@NotNull JdbcConnectionString connectionString)
-
setJdbcDrivers
public void setJdbcDrivers(@Nullable JdbcDrivers jdbcDrivers)
-
setDatabaseManager
public void setDatabaseManager(@Nullable TeamCityDatabaseManager databaseManager)
-
isIncompatibleDatabaseVersion
public boolean isIncompatibleDatabaseVersion()
-
setIncompatibleDatabaseVersion
public void setIncompatibleDatabaseVersion(boolean incompatibleDatabaseVersion)
-
setDatabaseSettingsFromUISpecified
public void setDatabaseSettingsFromUISpecified(boolean databaseSettingsFromUISpecified)
-
setBackupConfig
public void setBackupConfig(@Nullable BackupConfig backupConfig)
-
setBackupProcess
public void setBackupProcess(@Nullable BackupProcess backupProcess)
-
setBackupProcessInfo
public void setBackupProcessInfo(@Nullable BackupProcessInfo info)
-
setBackupFilePath
public void setBackupFilePath(@Nullable Path backupFilePath)
-
setConnectionStringFromBackup
public void setConnectionStringFromBackup(@Nullable JdbcConnectionString connectionStringFromBackup)
-
setCancelRestoreRequested
public void setCancelRestoreRequested(boolean isCancelRestoreRequested)
-
addException
public void addException(@NotNull Throwable exception)
-
setMaintenanceAsked
public void setMaintenanceAsked(boolean maintenanceAsked)
-
setPreviousInstallationFiles
public void setPreviousInstallationFiles(Collection<String> previousInstallationFiles)
-
setUnsupportedJava
public void setUnsupportedJava(@NotNull String javaVersion, @NotNull String javaHome)
-
setUnsupportedServerRole
public void setUnsupportedServerRole(@NotNull String serverRole)
-
getStateRevision
public int getStateRevision()
-
getPreviousStage
@NotNull public StartupStage getPreviousStage()
Returns the previous startup stage.
- Returns:
- the previous startup stage.
- Throws:
IllegalStateException
- if this method is invoked when the current stage isStartupStage.INITIAL_STAGE
.- Since:
- 2018.1
- See Also:
getCurrStage()
,getNextStage()
-
getCurrStage
@NotNull public StartupStage getCurrStage()
- See Also:
getPreviousStage()
,getNextStage()
-
getNextStage
@Nullable public StartupStage getNextStage()
- See Also:
getPreviousStage()
,getCurrStage()
-
isStarting
public boolean isStarting()
-
isShutdownRequested
public boolean isShutdownRequested()
-
getDataDirPathSelectedFromUI
@Nullable public String getDataDirPathSelectedFromUI()
-
getSuggestedFirstStartDataDirectoryPath
@NotNull public String getSuggestedFirstStartDataDirectoryPath()
-
isAllowOverrideDataDirectory
public boolean isAllowOverrideDataDirectory()
-
isDataDirSpecified
public boolean isDataDirSpecified()
Determines whether the Data Dir is specified.- Returns:
- specified or not.
- See Also:
getDataDirManager()
-
getServerPaths
@NotNull public ServerPaths getServerPaths()
Returns an instance ofServerPaths
if the Data Dir is specified, or throws an exception if not yet.- Returns:
- an instance of
ServerPaths
. - See Also:
isDataDirSpecified()
,getDataDirManager()
-
getDataDirManager
@NotNull public TeamCityDataDirectoryManager getDataDirManager()
Returns the data directory manager if the Data Dir is specified, or throws an exception if not yet.- Returns:
- See Also:
isDataDirSpecified()
-
getIPAddress
public String getIPAddress()
-
getServletContainerInfo
public String getServletContainerInfo()
-
getServletRealPath
@Nullable public String getServletRealPath()
-
isDevelopmentMode
public boolean isDevelopmentMode()
-
isFirstStart
public boolean isFirstStart()
-
isBypassingMaintenanceQuestions
public boolean isBypassingMaintenanceQuestions()
-
getCountOfAdminsLoggedIn
public int getCountOfAdminsLoggedIn()
-
getDatabasePropertiesFile
@Nullable public DatabasePropertiesFile getDatabasePropertiesFile()
-
isDatabaseExplicitlyConfigured
public boolean isDatabaseExplicitlyConfigured()
-
isDatabasePropertiesFileExists
@Deprecated public boolean isDatabasePropertiesFileExists()
Deprecated.
-
isInternalDatabaseFileExists
public boolean isInternalDatabaseFileExists()
-
getInternalDatabaseFileVersion
@Nullable public String getInternalDatabaseFileVersion()
-
isDatabaseExternal
public boolean isDatabaseExternal()
-
getConnectionString
@NotNull public JdbcConnectionString getConnectionString()
-
getJdbcDrivers
@Nullable public JdbcDrivers getJdbcDrivers()
-
getDatabaseManager
@Nullable public TeamCityDatabaseManager getDatabaseManager()
-
getProductVersion
@NotNull public ServerVersionInfo getProductVersion()
-
getSoftwareVersion
public int getSoftwareVersion()
-
getDataDirVersion
public int getDataDirVersion()
-
getDatabaseVersion
public int getDatabaseVersion()
-
getDatabaseVersionString
public String getDatabaseVersionString()
-
isDatabaseVersionIsGuessed
public boolean isDatabaseVersionIsGuessed()
-
isDatabaseAccessible
public boolean isDatabaseAccessible()
-
getCountOfTables
public int getCountOfTables()
-
isSchemaBelongsToTeamcity
public boolean isSchemaBelongsToTeamcity()
-
isDatabaseSettingsFromUISpecified
public boolean isDatabaseSettingsFromUISpecified()
-
isBackupPossible
public boolean isBackupPossible()
-
getBackupConfig
@Nullable public BackupConfig getBackupConfig()
-
getBackupProcess
@Nullable public BackupProcess getBackupProcess()
-
getBackupProcessInfo
@Nullable public BackupProcessInfo getBackupProcessInfo()
-
getBackupFilePath
@Nullable public Path getBackupFilePath()
-
getConnectionStringFromBackup
@Nullable public JdbcConnectionString getConnectionStringFromBackup()
-
isCancelRestoreRequested
public boolean isCancelRestoreRequested()
-
getMaintenanceAuthenticationToken
public String getMaintenanceAuthenticationToken()
UseisValidMaintenanceAuthenticationToken(String)
orlogAuthenticationToken()
to check or log the token respectively
-
isValidMaintenanceAuthenticationToken
public boolean isValidMaintenanceAuthenticationToken(@Nullable String token)
-
logAuthenticationToken
public void logAuthenticationToken()
-
isMaintenanceAsked
public boolean isMaintenanceAsked()
-
hasExceptions
public boolean hasExceptions()
-
getExceptions
@NotNull public LinkedList<Throwable> getExceptions()
Reported exceptions.- Returns:
- a copy of the list of exceptions.
-
getServerStartupTimestamp
@NotNull public Date getServerStartupTimestamp()
The timestamp when the server began starting up.- Returns:
- timestamp when the server began starting up.
- Since:
- 9.0
-
getServerStartupDuration
public long getServerStartupDuration()
The duration of the server start, i.e. time since server start till complete initialization (i.e. afterServerListener.serverStartup()
event is processed).- Returns:
- startup duration in milliseconds
-
setServerStartupFinishedTimestamp
public void setServerStartupFinishedTimestamp(@NotNull Date time)
-
getPreviousInstallationFiles
@NotNull public Collection<String> getPreviousInstallationFiles()
-
getCurrentJavaVersion
public String getCurrentJavaVersion()
-
getCurrentJavaLocation
public String getCurrentJavaLocation()
-
isUnsupportedJava
public boolean isUnsupportedJava()
-
isUnsupportedServerRole
public boolean isUnsupportedServerRole()
-
getServerRole
public String getServerRole()
-
getUUID
public String getUUID()
-
setUUID
public void setUUID(String UUID)
-
setSelectedDirError
public void setSelectedDirError(String error)
-
getSelectedDirError
public String getSelectedDirError()
-
getNodeId
public String getNodeId()
-
getNodeIdProp
public String getNodeIdProp()
-
getOtherNodes
public List<SessionInfo> getOtherNodes()
-
setCompetitorSession
public void setCompetitorSession(SessionInfo competitorSession)
-
getCompetitorSession
public SessionInfo getCompetitorSession()
-
setPort
public void setPort(Integer port)
-
getPort
@Nullable public Integer getPort()
-
setScheme
public void setScheme(@NotNull String scheme)
- Since:
- 2017.1
-
getScheme
@Nullable public String getScheme()
Protocol, like "http" or "https"- Since:
- 2017.1
-
setServletContextPath
public void setServletContextPath(String servletContextPath)
- Since:
- 2017.1
-
getServletContextPath
@NotNull public String getServletContextPath()
Actual context path- Since:
- 2017.1
-
getDistributionType
public String getDistributionType()
-
setDistributionType
public void setDistributionType(String distributionType)
-
setNodeSpecificConfigs
public void setNodeSpecificConfigs(@NotNull File nodeSpecificDataDir) throws IOException
- Throws:
IOException
-
getInstallationsManager
@NotNull public InstallationsManager getInstallationsManager()
-
getRecommendedMemorySettings
public String getRecommendedMemorySettings()
-
setRecommendedMemorySettings
public void setRecommendedMemorySettings(String recommendedMemorySettings)
-
getCurrentXmx
public String getCurrentXmx()
-
getRecommendedMemOptsValue
public String getRecommendedMemOptsValue()
-
isXmxFromMemOptsUsed
public boolean isXmxFromMemOptsUsed()
-
isRestoreProcess
public boolean isRestoreProcess()
-
setRestoreProcess
public void setRestoreProcess(boolean restoreProcess)
-
getLogsDir
public String getLogsDir()
-
setHttpsConfigurator
public void setHttpsConfigurator(@NotNull HttpsConfigurator configurator)
-
getHttpsConfigurator
@Nullable public HttpsConfigurator getHttpsConfigurator()
-
-