Class DenormalisedSpaceChangeLogListener
- java.lang.Object
-
- com.atlassian.confluence.security.denormalisedpermissions.impl.DenormalisedChangeLogListenerBase
-
- com.atlassian.confluence.security.denormalisedpermissions.impl.space.DenormalisedSpaceChangeLogListener
-
public class DenormalisedSpaceChangeLogListener extends DenormalisedChangeLogListenerBase
Handles the events about changed spaces or space permissions and reads data from logs periodically It's required to maintain denormalised permissions up-to-date- Since:
- 7.11.0
-
-
Field Summary
-
Fields inherited from class com.atlassian.confluence.security.denormalisedpermissions.impl.DenormalisedChangeLogListenerBase
denormalisedLockService, denormalisedPermissionStateLogService, denormalisedPermissionStateManager, schedulingEnabled
-
-
Constructor Summary
Constructors Constructor Description DenormalisedSpaceChangeLogListener(com.atlassian.event.api.EventPublisher eventPublisher, DenormalisedSpacePermissionsUpdater denormalisedSpacePermissionsUpdater, DenormalisedSpaceChangeLogDao denormalisedSpaceChangeLogDao, org.springframework.transaction.PlatformTransactionManager txManager, DenormalisedPermissionsDdlExecutor denormalisedPermissionsDdlExecutor, DenormalisedPermissionStateLogService denormalisedPermissionStateLogService, DenormalisedLockService denormalisedLockService, DenormalisedPermissionStateManager denormalisedPermissionStateManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
activateTriggersInSeparateTransaction()
Space or content updater must implement it and activate triggers.protected void
deactivateTriggers()
Space of content updater must must remove all change log records.protected void
deleteAllRecordsFromChangeLogTable()
Space of content updater must must remove all change log records.protected DenormalisedLockService.LockName
getLockNameForLogProcessor()
protected DenormalisedLockService.LockName
getLockNameForStatus()
protected DenormalisedServiceStateRecord.ServiceType
getServiceType()
protected boolean
isServiceEnabled()
Checks the state of service.void
processChangedRecords()
Space of content updater must update changed records when it's called.protected int
updateAllRecordsInSmallSeparateTransactions()
Update all denormalised records in a bunch of small transactions.-
Methods inherited from class com.atlassian.confluence.security.denormalisedpermissions.impl.DenormalisedChangeLogListenerBase
disableScheduling, enableScheduling, init, isSchedulingEnabled, onApplicationStartedEvent, onApplicationStoppingEvent, onCronEvent, onImportFinishEvent, onImportStartEvent, preDestroy, processLogRecords, switchToReadyStateIfItIsInInitialisingState
-
-
-
-
Constructor Detail
-
DenormalisedSpaceChangeLogListener
public DenormalisedSpaceChangeLogListener(com.atlassian.event.api.EventPublisher eventPublisher, DenormalisedSpacePermissionsUpdater denormalisedSpacePermissionsUpdater, DenormalisedSpaceChangeLogDao denormalisedSpaceChangeLogDao, org.springframework.transaction.PlatformTransactionManager txManager, DenormalisedPermissionsDdlExecutor denormalisedPermissionsDdlExecutor, DenormalisedPermissionStateLogService denormalisedPermissionStateLogService, DenormalisedLockService denormalisedLockService, DenormalisedPermissionStateManager denormalisedPermissionStateManager)
-
-
Method Detail
-
isServiceEnabled
protected boolean isServiceEnabled()
Description copied from class:DenormalisedChangeLogListenerBase
Checks the state of service. Returns true if it is in any state except DISABLED.- Specified by:
isServiceEnabled
in classDenormalisedChangeLogListenerBase
- Returns:
- true if service not in DISABLED state
-
processChangedRecords
public void processChangedRecords()
Description copied from class:DenormalisedChangeLogListenerBase
Space of content updater must update changed records when it's called. The timeout should be taken into account to prevent long execution.- Specified by:
processChangedRecords
in classDenormalisedChangeLogListenerBase
-
deleteAllRecordsFromChangeLogTable
protected void deleteAllRecordsFromChangeLogTable()
Description copied from class:DenormalisedChangeLogListenerBase
Space of content updater must must remove all change log records. This method is usually called when the service is enabled or disabled.- Specified by:
deleteAllRecordsFromChangeLogTable
in classDenormalisedChangeLogListenerBase
-
deactivateTriggers
protected void deactivateTriggers()
Description copied from class:DenormalisedChangeLogListenerBase
Space of content updater must must remove all change log records. This method is usually called when the service is enabled or disabled.- Specified by:
deactivateTriggers
in classDenormalisedChangeLogListenerBase
-
getServiceType
protected DenormalisedServiceStateRecord.ServiceType getServiceType()
- Specified by:
getServiceType
in classDenormalisedChangeLogListenerBase
- Returns:
- service type (CONTENT or SPACE)
-
getLockNameForStatus
protected DenormalisedLockService.LockName getLockNameForStatus()
- Specified by:
getLockNameForStatus
in classDenormalisedChangeLogListenerBase
- Returns:
- lock name used for status changing (SPACE_STATUS or CONTENT_STATUS)
-
getLockNameForLogProcessor
protected DenormalisedLockService.LockName getLockNameForLogProcessor()
- Specified by:
getLockNameForLogProcessor
in classDenormalisedChangeLogListenerBase
- Returns:
- lock name used for log processing changing (SPACE_LOG_PROCESSOR or CONTENT_LOG_PROCESSOR)
-
activateTriggersInSeparateTransaction
protected void activateTriggersInSeparateTransaction()
Description copied from class:DenormalisedChangeLogListenerBase
Space or content updater must implement it and activate triggers. Note that it must be done it a separate transaction because we want to have then active before staring updating all the records. Because if some permissions are changed during the initialisation, we will process them when the initialisation finishes, so we can guarantee that denormalised permissions 100% reflect real permissions.- Specified by:
activateTriggersInSeparateTransaction
in classDenormalisedChangeLogListenerBase
-
updateAllRecordsInSmallSeparateTransactions
protected int updateAllRecordsInSmallSeparateTransactions() throws ExecutionException, InterruptedException
Description copied from class:DenormalisedChangeLogListenerBase
Update all denormalised records in a bunch of small transactions. We need a lot of small transactions to keep processed data in the DB, so if the service is interrupted, it will not have to process data again next time.- Specified by:
updateAllRecordsInSmallSeparateTransactions
in classDenormalisedChangeLogListenerBase
- Returns:
- Number of records that were processed
- Throws:
ExecutionException
InterruptedException
-
-