Class CachedEnvironmentServiceImpl
java.lang.Object
com.atlassian.bamboo.deployments.cache.CachedEnvironmentServiceImpl
- All Implemented Interfaces:
CachedEnvironmentService
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCachedEnvironmentServiceImpl(InternalEnvironmentService internalEnvironmentService, EnvironmentService environmentService, EnvironmentDao environmentDao, EnvironmentRepositoryLinkDao environmentRepositoryLinkDao, DeploymentProjectDao deploymentProjectDao, TriggerTypeManager triggerTypeManager, BambooPermissionManager bambooPermissionManager, BambooClusterSettings bambooClusterSettings, VersionDao versionDao, PaginatedDataCollector paginatedDataCollector) -
Method Summary
Modifier and TypeMethodDescription@NotNull EnvironmentcreateImmutableEnvironment(@NotNull InternalEnvironment environment) ConvertInternalEnvironmentto fullEnvironment@NotNull Iterable<Environment>Retrieves all environments.@NotNull Iterable<InternalEnvironment>Retrieves all environments defined in the system without filling in operations permitted for the user.@NotNull BambooCacheStatsRetrieve cache statisticsgetDashboardPageUnrestricted(int offset, int limit, @Nullable String filter) Retrieves a list of environment IDs and their corresponding deployment project IDs for the dashboard page.@Nullable LonggetDeploymentProjectIdForEnvironment(long environmentId) Retrieves the deployment project ID for a specific environment.@Nullable EnvironmentgetEnvironment(long environmentId) Retrieves an environment by its ID.@Nullable ImmutableRequirementSetgetEnvironmentRequirementSet(long environmentId) Retrieves the requirement set for a specific environment.@NotNull List<Environment>getEnvironmentsForDeploymentProject(long deploymentProjectId) Retrieves a list of environments for a specific deployment project.@NotNull List<Environment>getEnvironmentsForDeploymentProjectWithConsistencyGuarantee(long deploymentProjectId) Retrieves a list of environments for a specific deployment project with consistency guarantee.@NotNull List<EnvironmentStub>getEnvironmentStubsForDeploymentProject(long deploymentProjectId) Retrieves a list of environment stubs for a specific deployment project.getEnvironmentsUsingRepository(long repositoryId) @Nullable EnvironmentgetEnvironmentUnrestricted(long environmentId) Get specific environment by ID.@Nullable EnvironmentgetEnvironmentWithConsistencyGuarantee(long environmentId) Retrieves an environment by its ID with consistency guarantee.@NotNull PaginatedEnvironmentsForDashboardgetPaginatedEnvironmentsForDeploymentProject(long deploymentProjectId, int start, int limit, String filter) Get paginated environments for a particular deployment project ordered by position.voidinitialiseCache(@NotNull Iterable<? extends InternalDeploymentProject> deploymentProjects) Initializes the cache with the given deployment projects.voidinitialiseTriggers(org.apache.logging.log4j.Logger logger, Date lastShutdownTime) Initialise triggers on all active environments.booleanvoidrefreshByRequirementSetId(long requirementSetId) Refreshes the cache for environments by a specific requirement set ID.voidrefreshEnvironment(long environmentId) Refreshes the cache for a specific environment.voidreindexDeploymentProject(@NotNull InternalDeploymentProject deploymentProject) Reindexes a deployment project in the cache.voidremoveDeploymentProject(long deploymentProjectId) Removes a deployment project from the cache by its ID.voidremoveEnvironment(long environmentId) Removes an environment from the cache by its ID.@NotNull Stream<InternalEnvironment>streamInternalEnvironmentsByIdsUnrestricted(@NotNull Set<Long> environmentIds) Streams internal environments by their IDs without restrictions.
-
Field Details
-
CACHE_UPDATE_CONCURRENCY_LEVEL
protected static final long CACHE_UPDATE_CONCURRENCY_LEVEL- See Also:
-
CONCURRENCY_SYS_PROP
- See Also:
-
-
Constructor Details
-
CachedEnvironmentServiceImpl
@Inject public CachedEnvironmentServiceImpl(InternalEnvironmentService internalEnvironmentService, EnvironmentService environmentService, EnvironmentDao environmentDao, EnvironmentRepositoryLinkDao environmentRepositoryLinkDao, DeploymentProjectDao deploymentProjectDao, TriggerTypeManager triggerTypeManager, BambooPermissionManager bambooPermissionManager, BambooClusterSettings bambooClusterSettings, VersionDao versionDao, PaginatedDataCollector paginatedDataCollector)
-
-
Method Details
-
initialiseCache
public void initialiseCache(@NotNull @NotNull Iterable<? extends InternalDeploymentProject> deploymentProjects) Description copied from interface:CachedEnvironmentServiceInitializes the cache with the given deployment projects. Do NOT call this method multiple times; cache can be initialized only once.- Specified by:
initialiseCachein interfaceCachedEnvironmentService- Parameters:
deploymentProjects- the deployment projects to initialize the cache with
-
initialiseTriggers
Description copied from interface:CachedEnvironmentServiceInitialise triggers on all active environments.- Specified by:
initialiseTriggersin interfaceCachedEnvironmentService- Parameters:
logger- the logger to uselastShutdownTime- the last shutdown time
-
getEnvironmentsForDeploymentProject
@NotNull public @NotNull List<Environment> getEnvironmentsForDeploymentProject(long deploymentProjectId) Description copied from interface:CachedEnvironmentServiceRetrieves a list of environments for a specific deployment project.- Specified by:
getEnvironmentsForDeploymentProjectin interfaceCachedEnvironmentService- Parameters:
deploymentProjectId- the ID of the deployment project- Returns:
- a list of environments for the specified deployment project
-
getEnvironmentsForDeploymentProjectWithConsistencyGuarantee
@NotNull public @NotNull List<Environment> getEnvironmentsForDeploymentProjectWithConsistencyGuarantee(long deploymentProjectId) Description copied from interface:CachedEnvironmentServiceRetrieves a list of environments for a specific deployment project with consistency guarantee.- Specified by:
getEnvironmentsForDeploymentProjectWithConsistencyGuaranteein interfaceCachedEnvironmentService- Parameters:
deploymentProjectId- the ID of the deployment project- Returns:
- a list of environments for the specified deployment project
-
getEnvironment
Description copied from interface:CachedEnvironmentServiceRetrieves an environment by its ID.- Specified by:
getEnvironmentin interfaceCachedEnvironmentService- Parameters:
environmentId- the ID of the environment- Returns:
- the environment, or null if not found
-
getEnvironmentUnrestricted
Description copied from interface:CachedEnvironmentServiceGet specific environment by ID. Does not check permissions.- Specified by:
getEnvironmentUnrestrictedin interfaceCachedEnvironmentService- Parameters:
environmentId- ID to search for- Returns:
- environment with given ID or null if one could not be found.
-
getEnvironmentWithConsistencyGuarantee
Description copied from interface:CachedEnvironmentServiceRetrieves an environment by its ID with consistency guarantee.- Specified by:
getEnvironmentWithConsistencyGuaranteein interfaceCachedEnvironmentService- Parameters:
environmentId- the ID of the environment- Returns:
- the environment with consistency guarantee, or null if not found
-
getAllEnvironments
Description copied from interface:CachedEnvironmentServiceRetrieves all environments.- Specified by:
getAllEnvironmentsin interfaceCachedEnvironmentService- Returns:
- an iterable of all environments
-
getAllInternalEnvironmentsNoUserContext
Description copied from interface:CachedEnvironmentServiceRetrieves all environments defined in the system without filling in operations permitted for the user.- Specified by:
getAllInternalEnvironmentsNoUserContextin interfaceCachedEnvironmentService- Returns:
- an iterable of all environments
-
getEnvironmentRequirementSet
Description copied from interface:CachedEnvironmentServiceRetrieves the requirement set for a specific environment.- Specified by:
getEnvironmentRequirementSetin interfaceCachedEnvironmentService- Parameters:
environmentId- the ID of the environment- Returns:
- the requirement set, or null if not found
-
getEnvironmentStubsForDeploymentProject
@NotNull public @NotNull List<EnvironmentStub> getEnvironmentStubsForDeploymentProject(long deploymentProjectId) Description copied from interface:CachedEnvironmentServiceRetrieves a list of environment stubs for a specific deployment project.- Specified by:
getEnvironmentStubsForDeploymentProjectin interfaceCachedEnvironmentService- Parameters:
deploymentProjectId- the ID of the deployment project- Returns:
- a list of environment stubs for the specified deployment project
-
getPaginatedEnvironmentsForDeploymentProject
@NotNull public @NotNull PaginatedEnvironmentsForDashboard getPaginatedEnvironmentsForDeploymentProject(long deploymentProjectId, int start, int limit, String filter) Description copied from interface:CachedEnvironmentServiceGet paginated environments for a particular deployment project ordered by position. Does not validate deployment project actually exists. Filtering requires at least one character. If filter is null or empty then no filtering.- Specified by:
getPaginatedEnvironmentsForDeploymentProjectin interfaceCachedEnvironmentService- Parameters:
deploymentProjectId- of the deployment project to get environments forstart- start by indexlimit- return no more entries than limitfilter- filter- Returns:
- List of environments for a single deployment project. Sorted by position.
- See Also:
-
getDeploymentProjectIdForEnvironment
Description copied from interface:CachedEnvironmentServiceRetrieves the deployment project ID for a specific environment.- Specified by:
getDeploymentProjectIdForEnvironmentin interfaceCachedEnvironmentService- Parameters:
environmentId- the ID of the environment- Returns:
- the deployment project ID, or null if not found
-
getDashboardPageUnrestricted
@NotNull public @NotNull List<Pair<Long,Long>> getDashboardPageUnrestricted(int offset, int limit, @Nullable @Nullable String filter) Description copied from interface:CachedEnvironmentServiceRetrieves a list of environment IDs and their corresponding deployment project IDs for the dashboard page.- Specified by:
getDashboardPageUnrestrictedin interfaceCachedEnvironmentService- Parameters:
offset- the starting point of the listlimit- the maximum number of items to returnfilter- an optional filter to apply- Returns:
- a list of pairs containing deployment project ID and environment ID.
-
getEnvironmentsUsingRepository
- Specified by:
getEnvironmentsUsingRepositoryin interfaceCachedEnvironmentService- Parameters:
repositoryId- repository id- Returns:
- list of immutable
Environments that use given repository
-
createImmutableEnvironment
@NotNull public @NotNull Environment createImmutableEnvironment(@NotNull @NotNull InternalEnvironment environment) Description copied from interface:CachedEnvironmentServiceConvertInternalEnvironmentto fullEnvironment- Specified by:
createImmutableEnvironmentin interfaceCachedEnvironmentService
-
streamInternalEnvironmentsByIdsUnrestricted
@NotNull public @NotNull Stream<InternalEnvironment> streamInternalEnvironmentsByIdsUnrestricted(@NotNull @NotNull Set<Long> environmentIds) Description copied from interface:CachedEnvironmentServiceStreams internal environments by their IDs without restrictions.- Specified by:
streamInternalEnvironmentsByIdsUnrestrictedin interfaceCachedEnvironmentService- Parameters:
environmentIds- the set of environment IDs- Returns:
- a stream of internal environments
-
removeDeploymentProject
public void removeDeploymentProject(long deploymentProjectId) Description copied from interface:CachedEnvironmentServiceRemoves a deployment project from the cache by its ID.- Specified by:
removeDeploymentProjectin interfaceCachedEnvironmentService- Parameters:
deploymentProjectId- the ID of the deployment project to remove
-
removeEnvironment
public void removeEnvironment(long environmentId) Description copied from interface:CachedEnvironmentServiceRemoves an environment from the cache by its ID.- Specified by:
removeEnvironmentin interfaceCachedEnvironmentService- Parameters:
environmentId- the ID of the environment to remove
-
refreshByRequirementSetId
public void refreshByRequirementSetId(long requirementSetId) Description copied from interface:CachedEnvironmentServiceRefreshes the cache for environments by a specific requirement set ID.- Specified by:
refreshByRequirementSetIdin interfaceCachedEnvironmentService- Parameters:
requirementSetId- the ID of the requirement set
-
reindexDeploymentProject
Description copied from interface:CachedEnvironmentServiceReindexes a deployment project in the cache.- Specified by:
reindexDeploymentProjectin interfaceCachedEnvironmentService- Parameters:
deploymentProject- the deployment project to reindex
-
refreshEnvironment
public void refreshEnvironment(long environmentId) Description copied from interface:CachedEnvironmentServiceRefreshes the cache for a specific environment.- Specified by:
refreshEnvironmentin interfaceCachedEnvironmentService- Parameters:
environmentId- the ID of the environment to refresh
-
getCacheStats
Description copied from interface:CachedEnvironmentServiceRetrieve cache statistics- Specified by:
getCacheStatsin interfaceCachedEnvironmentService- Returns:
- Cache statistics
-
isCacheActive
public boolean isCacheActive()- Specified by:
isCacheActivein interfaceCachedEnvironmentService
-