Class CustomDataStorageManagerImpl
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.CustomDataStorageManagerImpl
-
- All Implemented Interfaces:
AfterBuildsCleanupExtension
,CustomDataStorageAsyncFlushService
,CustomDataStorageManager
,ServerExtension
,TeamCityExtension
public class CustomDataStorageManagerImpl extends Object implements AfterBuildsCleanupExtension, CustomDataStorageManager, CustomDataStorageAsyncFlushService
- Author:
- Pavel.Sher
-
-
Field Summary
Fields Modifier and Type Field Description static String
BUILD_TYPE_PREFIX
static String
PROJECT_PREFIX
static String
VCS_ROOT_PREFIX
-
Constructor Summary
Constructors Constructor Description CustomDataStorageManagerImpl(SQLRunnerEx sqlRunner, EventDispatcher<BuildServerListener> dispatcher, ExtensionHolder extensionHolder, ExecutorServices executorServices, TimeService timeService, NumericIdSequences idSequences, ServerResponsibility serverResponsibility)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterCleanup(CleanupProcessState cleanupState)
Invoked upon finishing of the main cleanup process.void
destroyProjectStorage(String projectId)
CustomDataStorage
getBuildStorage(String buildTypeId, long buildId, String storageId)
Set<String>
getBuildStorageIds(String buildTypeId, long buildId, String storageIdPrefix)
Returns ids of all the custom data storages associated with the specified build type and build and having the specified prefix.CustomDataStorage
getBuildTypeStorage(String buildTypeId, String storageId)
CustomDataStorage
getCustomDataStorage(long parentVcsRootId, String storageId)
CustomDataStorage
getCustomDataStorage(Class<?> clazz)
Returns storage which uses class name as internal storage id.CustomDataStorage
getCustomDataStorage(SBuildType buildType, String storageId)
CustomDataStorage
getCustomDataStorage(SProject project, String storageId)
void
refreshBuildTypeStorages(Collection<String> buildTypeIds, String storageId)
void
refreshProjectStorages(Collection<String> projectIds, String storageId)
void
scheduleFlush(String dataDomain, String storageId)
void
syncData()
int
unloadUnusedStorages()
void
waitForAllScheduledFlushes()
-
-
-
Field Detail
-
PROJECT_PREFIX
public static final String PROJECT_PREFIX
- See Also:
- Constant Field Values
-
BUILD_TYPE_PREFIX
public static final String BUILD_TYPE_PREFIX
- See Also:
- Constant Field Values
-
VCS_ROOT_PREFIX
public static final String VCS_ROOT_PREFIX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CustomDataStorageManagerImpl
public CustomDataStorageManagerImpl(@NotNull SQLRunnerEx sqlRunner, @NotNull EventDispatcher<BuildServerListener> dispatcher, @NotNull ExtensionHolder extensionHolder, @NotNull ExecutorServices executorServices, @NotNull TimeService timeService, @NotNull NumericIdSequences idSequences, @NotNull ServerResponsibility serverResponsibility)
-
-
Method Detail
-
unloadUnusedStorages
public int unloadUnusedStorages()
- Specified by:
unloadUnusedStorages
in interfaceCustomDataStorageManager
-
syncData
public void syncData()
-
getCustomDataStorage
@NotNull public CustomDataStorage getCustomDataStorage(@NotNull SBuildType buildType, @NotNull String storageId)
- Specified by:
getCustomDataStorage
in interfaceCustomDataStorageManager
-
getBuildTypeStorage
@NotNull public CustomDataStorage getBuildTypeStorage(@NotNull String buildTypeId, @NotNull String storageId)
- Specified by:
getBuildTypeStorage
in interfaceCustomDataStorageManager
-
getBuildStorage
@NotNull public CustomDataStorage getBuildStorage(@NotNull String buildTypeId, long buildId, @NotNull String storageId)
- Specified by:
getBuildStorage
in interfaceCustomDataStorageManager
-
getBuildStorageIds
@NotNull public Set<String> getBuildStorageIds(@NotNull String buildTypeId, long buildId, @NotNull String storageIdPrefix)
Description copied from interface:CustomDataStorageManager
Returns ids of all the custom data storages associated with the specified build type and build and having the specified prefix.- Specified by:
getBuildStorageIds
in interfaceCustomDataStorageManager
- Parameters:
buildTypeId
- internal build type idbuildId
- id of a buildstorageIdPrefix
- storage id prefix- Returns:
- set of full ids
-
getCustomDataStorage
@NotNull public CustomDataStorage getCustomDataStorage(@NotNull SProject project, @NotNull String storageId)
- Specified by:
getCustomDataStorage
in interfaceCustomDataStorageManager
-
getCustomDataStorage
@NotNull public CustomDataStorage getCustomDataStorage(long parentVcsRootId, @NotNull String storageId)
- Specified by:
getCustomDataStorage
in interfaceCustomDataStorageManager
-
getCustomDataStorage
@NotNull public CustomDataStorage getCustomDataStorage(@NotNull Class<?> clazz)
Description copied from interface:CustomDataStorageManager
Returns storage which uses class name as internal storage id. Such a storage can be used by different services which need to store some data in the database without association of this data with any particular entity. The only purpose of the class argument is to make it more visible what service created this storage.- Specified by:
getCustomDataStorage
in interfaceCustomDataStorageManager
- Parameters:
clazz
- class of the service/Sptring bean which created and uses this storage- Returns:
- see above
-
destroyProjectStorage
public void destroyProjectStorage(@NotNull String projectId)
- Specified by:
destroyProjectStorage
in interfaceCustomDataStorageManager
-
refreshBuildTypeStorages
public void refreshBuildTypeStorages(@NotNull Collection<String> buildTypeIds, @NotNull String storageId)
- Specified by:
refreshBuildTypeStorages
in interfaceCustomDataStorageManager
-
refreshProjectStorages
public void refreshProjectStorages(@NotNull Collection<String> projectIds, @NotNull String storageId)
- Specified by:
refreshProjectStorages
in interfaceCustomDataStorageManager
-
afterCleanup
public void afterCleanup(@NotNull CleanupProcessState cleanupState)
Description copied from interface:AfterBuildsCleanupExtension
Invoked upon finishing of the main cleanup process. At this point all data for specific builds is deleted.
Note: This extension might not be called for every cleanup run as cleanup process can be interrupted earlier. Extension must check cleanup process state and if it is interrupted, complete its operations and return as quick as possible.- Specified by:
afterCleanup
in interfaceAfterBuildsCleanupExtension
- Parameters:
cleanupState
- cleanup process state
-
scheduleFlush
public void scheduleFlush(@NotNull String dataDomain, @NotNull String storageId)
- Specified by:
scheduleFlush
in interfaceCustomDataStorageAsyncFlushService
-
waitForAllScheduledFlushes
@TestOnly public void waitForAllScheduledFlushes()
-
-