Class BuildCleanupContextImpl
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.cleanup.BuildCleanupContextImpl
-
- All Implemented Interfaces:
BuildCleanupContext,BuildCleanupContextEx,CleanupContext,ErrorReporter
public final class BuildCleanupContextImpl extends Object implements BuildCleanupContextEx, ErrorReporter
-
-
Constructor Summary
Constructors Constructor Description BuildCleanupContextImpl(CleanupLevel cleanupLevel, List<SFinishedBuild> builds, CleanupProcessStateEx cleanupState, KeepBuildDataProvider keepBuildDataProvider, DBBuildHistory buildHistory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuildCleanupError(long buildId, String errorMessage)Notify the core cleanup process about an error happened in a cleanup extension.List<SFinishedBuild>getBuilds()Returns list of builds to be cleaned on given cleanup level if such builds still exist.CleanupLevelgetCleanupLevel()CleanupPolicygetCleanupPolicyForBuild(long buildId)This method is intended for TeamCity internal usage only and can be changed, removed or throw an exception at any time!
Always returns the cleanup policy with "do not clean anything" artifacts pattern.CleanupProcessStateExgetCleanupState()ErrorReportergetErrorReporter()ObjectgetExtensionData(String key)Retrieves the data stored by an extension for a provided key.KeepBuildDatagetKeepBuildData(SFinishedBuild build)Provides the build data to preserve.Set<Long>getProblematicBuildsIds()voidonBuildCleanupError(BuildsCleanupExtension cleanupExtension, SBuild build, String errorMessage)Informs the core clean-up process about an error happened in a clean-up extension.
Note: if there are a lot of such calls, try to keep the sameerrorMessagewhen possible: it will allow to provide the resulting health report in a more compact format.voidsetExtensionData(String key, Object data)A method that can be used by aBuildsCleanupExtensionto store data in the current cleanup context.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.serverSide.cleanup.BuildCleanupContext
getBuildIds
-
-
-
-
Constructor Detail
-
BuildCleanupContextImpl
public BuildCleanupContextImpl(@NotNull CleanupLevel cleanupLevel, @NotNull List<SFinishedBuild> builds, @NotNull CleanupProcessStateEx cleanupState, @NotNull KeepBuildDataProvider keepBuildDataProvider, @NotNull DBBuildHistory buildHistory)
-
-
Method Detail
-
getCleanupLevel
@NotNull public CleanupLevel getCleanupLevel()
- Specified by:
getCleanupLevelin interfaceBuildCleanupContext- Returns:
- current cleanup level
-
getBuilds
@NotNull public List<SFinishedBuild> getBuilds()
Description copied from interface:BuildCleanupContextReturns list of builds to be cleaned on given cleanup level if such builds still exist.- Specified by:
getBuildsin interfaceBuildCleanupContext
-
getErrorReporter
@NotNull public ErrorReporter getErrorReporter()
- Specified by:
getErrorReporterin interfaceBuildCleanupContext- Returns:
- error reporter which can be used if errors occur during the cleanup.
-
buildCleanupError
public void buildCleanupError(long buildId, @NotNull String errorMessage)Description copied from interface:ErrorReporterNotify the core cleanup process about an error happened in a cleanup extension.- Specified by:
buildCleanupErrorin interfaceErrorReporter
-
onBuildCleanupError
public void onBuildCleanupError(@NotNull BuildsCleanupExtension cleanupExtension, @NotNull SBuild build, @NotNull String errorMessage)Description copied from interface:BuildCleanupContextInforms the core clean-up process about an error happened in a clean-up extension.
Note: if there are a lot of such calls, try to keep the sameerrorMessagewhen possible: it will allow to provide the resulting health report in a more compact format.- Specified by:
onBuildCleanupErrorin interfaceBuildCleanupContext- Parameters:
cleanupExtension- the affected clean-up extensionbuild- the affected builderrorMessage- the error description
-
getExtensionData
@Nullable public Object getExtensionData(@NotNull String key)
Description copied from interface:BuildCleanupContextRetrieves the data stored by an extension for a provided key.- Specified by:
getExtensionDatain interfaceBuildCleanupContext- Parameters:
key- a unique key that identifies saved object. Suggested naming convention: 'extension_class_name.extension_specific_data_key' (Example: `jetbrains.buildServer.serverSide.impl.CustomDataStorageManagerImpl.SUFFIXES_CACHE`).- Returns:
- data stored by an extension in this context by means of
BuildCleanupContext.setExtensionData(String, Object)invocation.
-
setExtensionData
public void setExtensionData(@NotNull String key, @NotNull Object data)Description copied from interface:BuildCleanupContextA method that can be used by aBuildsCleanupExtensionto store data in the current cleanup context.- Specified by:
setExtensionDatain interfaceBuildCleanupContext- Parameters:
key- a unique key that identifies saved object. Suggested naming convention: 'extension_class_name.extension_specific_data_key' (Example: * `jetbrains.buildServer.serverSide.impl.CustomDataStorageManagerImpl.SUFFIXES_CACHE`).data- data to be stored for the provided key.
-
getProblematicBuildsIds
@NotNull public Set<Long> getProblematicBuildsIds()
- Specified by:
getProblematicBuildsIdsin interfaceBuildCleanupContextEx- Returns:
- the set of builds ids for errors reported via
BuildCleanupContext.onBuildCleanupError(BuildsCleanupExtension, SBuild, String)orErrorReporter
-
getCleanupState
@NotNull public CleanupProcessStateEx getCleanupState()
- Specified by:
getCleanupStatein interfaceBuildCleanupContextEx- Specified by:
getCleanupStatein interfaceCleanupContext- Returns:
- current cleanup state
-
getCleanupPolicyForBuild
@NotNull public CleanupPolicy getCleanupPolicyForBuild(long buildId)
Description copied from interface:BuildCleanupContextThis method is intended for TeamCity internal usage only and can be changed, removed or throw an exception at any time!
Always returns the cleanup policy with "do not clean anything" artifacts pattern.- Specified by:
getCleanupPolicyForBuildin interfaceBuildCleanupContext- Parameters:
buildId- id of the build
-
getKeepBuildData
@NotNull public KeepBuildData getKeepBuildData(@NotNull SFinishedBuild build)
Description copied from interface:BuildCleanupContextExProvides the build data to preserve.- Specified by:
getKeepBuildDatain interfaceBuildCleanupContextEx- Parameters:
build- a build fromBuildCleanupContext.getBuilds()- Returns:
- build data to preserve
-
-