Interface CachedEnvironmentService
- All Known Implementing Classes:
CachedEnvironmentServiceImpl
@ExperimentalApi
public interface CachedEnvironmentService
Cache for deployment environments and dashboard.
Provides methods to retrieve and manage deployment environments with caching mechanisms.
- Since:
- 11.0
-
Method Summary
Modifier and TypeMethodDescription@NotNull Environment
createImmutableEnvironment
(@NotNull InternalEnvironment environment) ConvertInternalEnvironment
to 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 BambooCacheStats
Retrieve 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 Long
getDeploymentProjectIdForEnvironment
(long environmentId) Retrieves the deployment project ID for a specific environment.@Nullable Environment
getEnvironment
(long environmentId) Retrieves an environment by its ID.@Nullable ImmutableRequirementSet
getEnvironmentRequirementSet
(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 Environment
getEnvironmentUnrestricted
(long environmentId) Get specific environment by ID.@Nullable Environment
getEnvironmentWithConsistencyGuarantee
(long environmentId) Retrieves an environment by its ID with consistency guarantee.@NotNull PaginatedEnvironmentsForDashboard
getPaginatedEnvironmentsForDeploymentProject
(long deploymentProjectId, int start, int limit, String filter) Get paginated environments for a particular deployment project ordered by position.void
initialiseCache
(@NotNull Iterable<? extends InternalDeploymentProject> deploymentProjects) Initializes the cache with the given deployment projects.void
initialiseTriggers
(org.apache.logging.log4j.Logger log, Date lastShutdownTime) Initialise triggers on all active environments.boolean
void
refreshByRequirementSetId
(long requirementSetId) Refreshes the cache for environments by a specific requirement set ID.void
refreshEnvironment
(long environmentId) Refreshes the cache for a specific environment.void
reindexDeploymentProject
(@NotNull InternalDeploymentProject deploymentProject) Reindexes a deployment project in the cache.void
removeDeploymentProject
(long deploymentProjectId) Removes a deployment project from the cache by its ID.void
removeEnvironment
(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.
-
Method Details
-
getDashboardPageUnrestricted
@NotNull @NotNull List<Pair<Long,Long>> getDashboardPageUnrestricted(int offset, int limit, @Nullable @Nullable String filter) Retrieves a list of environment IDs and their corresponding deployment project IDs for the dashboard page.- 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.
-
getEnvironmentsForDeploymentProject
Retrieves a list of environments for a specific deployment project.- Parameters:
deploymentProjectId
- the ID of the deployment project- Returns:
- a list of environments for the specified deployment project
-
streamInternalEnvironmentsByIdsUnrestricted
@NotNull @NotNull Stream<InternalEnvironment> streamInternalEnvironmentsByIdsUnrestricted(@NotNull @NotNull Set<Long> environmentIds) Streams internal environments by their IDs without restrictions.- Parameters:
environmentIds
- the set of environment IDs- Returns:
- a stream of internal environments
-
createImmutableEnvironment
@NotNull @NotNull Environment createImmutableEnvironment(@NotNull @NotNull InternalEnvironment environment) ConvertInternalEnvironment
to fullEnvironment
- Parameters:
environment
-
-
getEnvironmentStubsForDeploymentProject
@NotNull @NotNull List<EnvironmentStub> getEnvironmentStubsForDeploymentProject(long deploymentProjectId) Retrieves a list of environment stubs for a specific deployment project.- Parameters:
deploymentProjectId
- the ID of the deployment project- Returns:
- a list of environment stubs for the specified deployment project
-
getDeploymentProjectIdForEnvironment
Retrieves the deployment project ID for a specific environment.- Parameters:
environmentId
- the ID of the environment- Returns:
- the deployment project ID, or null if not found
-
initialiseTriggers
Initialise triggers on all active environments.- Parameters:
log
- the logger to uselastShutdownTime
- the last shutdown time
-
initialiseCache
void initialiseCache(@NotNull @NotNull Iterable<? extends InternalDeploymentProject> deploymentProjects) Initializes the cache with the given deployment projects. Do NOT call this method multiple times; cache can be initialized only once.- Parameters:
deploymentProjects
- the deployment projects to initialize the cache with
-
removeEnvironment
void removeEnvironment(long environmentId) Removes an environment from the cache by its ID.- Parameters:
environmentId
- the ID of the environment to remove
-
removeDeploymentProject
void removeDeploymentProject(long deploymentProjectId) Removes a deployment project from the cache by its ID.- Parameters:
deploymentProjectId
- the ID of the deployment project to remove
-
refreshByRequirementSetId
void refreshByRequirementSetId(long requirementSetId) Refreshes the cache for environments by a specific requirement set ID.- Parameters:
requirementSetId
- the ID of the requirement set
-
reindexDeploymentProject
@Internal void reindexDeploymentProject(@NotNull @NotNull InternalDeploymentProject deploymentProject) Reindexes a deployment project in the cache.- Parameters:
deploymentProject
- the deployment project to reindex
-
refreshEnvironment
void refreshEnvironment(long environmentId) Refreshes the cache for a specific environment.- Parameters:
environmentId
- the ID of the environment to refresh
-
getEnvironment
Retrieves an environment by its ID.- Parameters:
environmentId
- the ID of the environment- Returns:
- the environment, or null if not found
-
getEnvironmentUnrestricted
Get specific environment by ID. Does not check permissions.- Parameters:
environmentId
- ID to search for- Returns:
- environment with given ID or null if one could not be found.
-
getEnvironmentWithConsistencyGuarantee
Retrieves an environment by its ID with consistency guarantee.- Parameters:
environmentId
- the ID of the environment- Returns:
- the environment with consistency guarantee, or null if not found
-
getEnvironmentsForDeploymentProjectWithConsistencyGuarantee
@NotNull @NotNull List<Environment> getEnvironmentsForDeploymentProjectWithConsistencyGuarantee(long deploymentProjectId) Retrieves a list of environments for a specific deployment project with consistency guarantee.- Parameters:
deploymentProjectId
- the ID of the deployment project- Returns:
- a list of environments for the specified deployment project
-
getEnvironmentRequirementSet
Retrieves the requirement set for a specific environment.- Parameters:
environmentId
- the ID of the environment- Returns:
- the requirement set, or null if not found
-
getAllEnvironments
Retrieves all environments.- Returns:
- an iterable of all environments
-
getAllInternalEnvironmentsNoUserContext
Retrieves all environments defined in the system without filling in operations permitted for the user.- Returns:
- an iterable of all environments
-
getEnvironmentsUsingRepository
- Parameters:
repositoryId
- repository id- Returns:
- list of immutable
Environment
s that use given repository
-
getCacheStats
Retrieve cache statistics- Returns:
- Cache statistics
-
isCacheActive
boolean isCacheActive() -
getPaginatedEnvironmentsForDeploymentProject
@Internal @NotNull @NotNull PaginatedEnvironmentsForDashboard getPaginatedEnvironmentsForDeploymentProject(long deploymentProjectId, int start, int limit, String filter) Get 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.- 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:
-