Class DenormalisedPermissionStateManagerImpl
java.lang.Object
com.atlassian.confluence.security.denormalisedpermissions.impl.DenormalisedPermissionStateManagerImpl
- All Implemented Interfaces:
DenormalisedPermissionStateManager,org.springframework.beans.factory.DisposableBean
public class DenormalisedPermissionStateManagerImpl
extends Object
implements DenormalisedPermissionStateManager, org.springframework.beans.factory.DisposableBean
- Since:
- 7.11.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longstatic final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionDenormalisedPermissionStateManagerImpl(com.atlassian.event.api.EventPublisher eventPublisher, DenormalisedServiceStateDao denormalisedServiceStateDao, org.springframework.transaction.PlatformTransactionManager transactionManager, DenormalisedPermissionStateLogService denormalisedPermissionStateLogService, DenormalisedLockService denormalisedLockService, DenormalisedChangeLogDao denormalisedChangeLogDao) -
Method Summary
Modifier and TypeMethodDescriptionvoidWhen the service is starting up for the first time, we need to create "state records".voiddestroy()voiddisableService(boolean cleanDenormalisedData) Disables the service and deletes all triggers/functions, so denormalised data will not be updated.voidvoidEnables the service.voidReturns the time difference between updating regular content permissions and denormalised content permissionsgetContentServiceState(boolean realTimeData) Get the state of denormalised content service.Returns the time difference between updating regular space permissions and denormalised space permissionsgetSpaceServiceState(boolean realTimeData) Get the state of denormalised space service.getStateChangeLog(int limit) Returns a list of service state change eventsvoidinit()booleanReturns true if the state of the service is "READY", if both CONTENT and SPACE services are in ready state Possible reasons for returning false: 1.booleanReturns true if the state of denormalised CONTENT service is "READY", which means that denormalised content permissions reflect real permissions.booleanReturns true if the state of denormalised SPACE service is "READY", which means that denormalised space permissions reflect real permissions.voidvoidvoidvoidvoidWe need to support it's state in memory because we'd like to avoid reading this value from DB for every request denormalised permissions receive.void
-
Field Details
-
MAX_ALLOWED_RELOAD_STATE_DELAY
public static final long MAX_ALLOWED_RELOAD_STATE_DELAY -
SERVICE_STATE_RELOADING_INTERVAL_WHEN_SERVICE_IS_DISABLED
public static final int SERVICE_STATE_RELOADING_INTERVAL_WHEN_SERVICE_IS_DISABLED- See Also:
-
SERVICE_STATE_RELOADING_INTERVAL
public static final int SERVICE_STATE_RELOADING_INTERVAL- See Also:
-
-
Constructor Details
-
DenormalisedPermissionStateManagerImpl
public DenormalisedPermissionStateManagerImpl(com.atlassian.event.api.EventPublisher eventPublisher, DenormalisedServiceStateDao denormalisedServiceStateDao, org.springframework.transaction.PlatformTransactionManager transactionManager, DenormalisedPermissionStateLogService denormalisedPermissionStateLogService, DenormalisedLockService denormalisedLockService, DenormalisedChangeLogDao denormalisedChangeLogDao)
-
-
Method Details
-
init
@PostConstruct public void init() -
scheduled
@Scheduled(fixedDelay=3000L) public void scheduled()- Specified by:
scheduledin interfaceDenormalisedPermissionStateManager
-
onApplicationStarted
-
reloadServiceState
@Internal public void reloadServiceState()We need to support it's state in memory because we'd like to avoid reading this value from DB for every request denormalised permissions receive. This state is used in router to switch between real denormalised permissions and the fallback service. -
isApiReady
public boolean isApiReady()Returns true if the state of the service is "READY", if both CONTENT and SPACE services are in ready state Possible reasons for returning false: 1. Service is disabled 2. Denormalized tables are not ready- Specified by:
isApiReadyin interfaceDenormalisedPermissionStateManager- Returns:
- the state of the service
-
isSpaceApiReady
public boolean isSpaceApiReady()Returns true if the state of denormalised SPACE service is "READY", which means that denormalised space permissions reflect real permissions. Possible reasons for returning false: 1. Service is disabled 2. Denormalized tables are not ready- Specified by:
isSpaceApiReadyin interfaceDenormalisedPermissionStateManager- Returns:
- the state of the SPACe service
-
isContentApiReady
public boolean isContentApiReady()Returns true if the state of denormalised CONTENT service is "READY", which means that denormalised content permissions reflect real permissions. Possible reasons for returning false: 1. Service is disabled 2. Denormalized tables are not ready- Specified by:
isContentApiReadyin interfaceDenormalisedPermissionStateManager- Returns:
- the state of the SPACe service
-
getSpaceServiceState
Description copied from interface:DenormalisedPermissionStateManagerGet the state of denormalised space service.- Specified by:
getSpaceServiceStatein interfaceDenormalisedPermissionStateManager- Parameters:
realTimeData- if true, data will be read from the DB. If false, cached data will be returned.- Returns:
- the state of denormalised SPACE service
-
getContentServiceState
Description copied from interface:DenormalisedPermissionStateManagerGet the state of denormalised content service.- Specified by:
getContentServiceStatein interfaceDenormalisedPermissionStateManager- Parameters:
realTimeData- if true, data will be read from the DB. If false, cached data will be returned.- Returns:
- the state of denormalised CONTENT service
-
enableService
public void enableService()Enables the service. It would take some time to update denormalised data- Specified by:
enableServicein interfaceDenormalisedPermissionStateManager
-
enableSpaceService
public void enableSpaceService() -
enableContentService
public void enableContentService() -
createStateRecordsIfTheyDoNotExist
@Internal public void createStateRecordsIfTheyDoNotExist() throws ExecutionException, InterruptedExceptionWhen the service is starting up for the first time, we need to create "state records". It's important to do this in separate transaction because these records will be used for cluster-wide locking. -
getSpacePermissionUpdateLag
Returns the time difference between updating regular space permissions and denormalised space permissions- Specified by:
getSpacePermissionUpdateLagin interfaceDenormalisedPermissionStateManager- Returns:
- lag in ms, or null if the data record is not found (for example, the service has never been enabled)
-
getContentPermissionUpdateLag
Returns the time difference between updating regular content permissions and denormalised content permissions- Specified by:
getContentPermissionUpdateLagin interfaceDenormalisedPermissionStateManager- Returns:
- lag in ms, or null if the data record is not found (for example, the service has never been enabled)
-
disableService
public void disableService(boolean cleanDenormalisedData) Disables the service and deletes all triggers/functions, so denormalised data will not be updated.- Specified by:
disableServicein interfaceDenormalisedPermissionStateManager- Parameters:
cleanDenormalisedData- - if true, all denormalised data will be truncated
-
getStateChangeLog
Returns a list of service state change events- Specified by:
getStateChangeLogin interfaceDenormalisedPermissionStateManager- Parameters:
limit- limit- Returns:
- list or events, sorted by event date (desc)
-
onImportStartEvent
-
onImportFinishEvent
-
onApplicationStoppingEvent
-
destroy
- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean- Throws:
Exception
-