Class ContentStoreCleaner
java.lang.Object
org.alfresco.repo.content.cleanup.ContentStoreCleaner
This component is responsible cleaning up orphaned content.
Clean-up happens at two levels.
Eager cleanup: (since 3.2)
If eager cleanup is activated, then this
component listens to all content property change events and recorded for post-transaction
processing. All orphaned content is deleted from the registered store(s). Note that
any listeners are called as normal; backup or scrubbing
procedures should be plugged in as listeners if this is required.
Lazy cleanup:
This is triggered by means of a
(a) have a listeners configured to backup the deleted content e.g.
(b) ensure consistent backups across the database and content stores: backup when the system is not running; use a DB-based content store. This is the recommended route when running with eager cleanup. Lazy cleanup protects the content for a given period (e.g. 7 days) giving plenty of time for a backup to be taken; this allows hot backup without needing metadata-content consistency to be enforced.
Quartz job. This process
gets content URLs that have been marked as orphaned and cleans up the various stores.
Once again, the listeners are called appropriately.
How backup policies are affected:
When restoring the system from a backup, the type of restore required is dictated by
the cleanup policy being enforced. If eager cleanup is active, the system must(a) have a listeners configured to backup the deleted content e.g.
DeletedContentBackupCleanerListener, or (b) ensure consistent backups across the database and content stores: backup when the system is not running; use a DB-based content store. This is the recommended route when running with eager cleanup. Lazy cleanup protects the content for a given period (e.g. 7 days) giving plenty of time for a backup to be taken; this allows hot backup without needing metadata-content consistency to be enforced.
- Author:
- Derek Hulley
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnumeration of actions to take in the even that an orphaned binary fails to get deleted. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute()voidinit()Initializes the cleaner.voidsetBatchSize(int batchSize) Set the batch size used by the cleaning jobs.voidsetContentDataDAO(ContentDataDAO contentDataDAO) voidsetContentService(ContentService contentService) voidsetDeletionFailureAction(ContentStoreCleaner.DeleteFailureAction deletionFailureAction) Set the action to take in the event that an orphaned binary failed to get deleted.voidsetDictionaryService(DictionaryService dictionaryService) voidsetEagerContentStoreCleaner(EagerContentStoreCleaner eagerContentStoreCleaner) Set the component that will do the physical deletingvoidsetJobLockService(JobLockService jobLockService) voidsetProtectDays(int protectDays) Set the minimum number of days old that orphaned content must be before deletion is possible.voidsetTransactionService(TransactionService transactionService)
-
Constructor Details
-
ContentStoreCleaner
public ContentStoreCleaner()
-
-
Method Details
-
setEagerContentStoreCleaner
Set the component that will do the physical deleting -
setJobLockService
- Parameters:
jobLockService- service used to ensure that cleanup runs are not duplicated
-
setContentDataDAO
- Parameters:
contentDataDAO- DAO used for enumerating DM content URLs
-
setDictionaryService
- Parameters:
dictionaryService- used to determine which properties are content properties
-
setContentService
- Parameters:
contentService- service to copy content binaries
-
setTransactionService
- Parameters:
transactionService- the component to ensure proper transactional wrapping
-
setProtectDays
public void setProtectDays(int protectDays) Set the minimum number of days old that orphaned content must be before deletion is possible. The default is 7 days.- Parameters:
protectDays- minimum age (in days) of deleted content
-
setBatchSize
public void setBatchSize(int batchSize) Set the batch size used by the cleaning jobs. The default is 1000- Parameters:
batchSize- batch size for each cleanup job
-
setDeletionFailureAction
Set the action to take in the event that an orphaned binary failed to get deleted. The default isContentStoreCleaner.DeleteFailureAction.IGNORE.- Parameters:
deletionFailureAction- the action to take when deletes fail
-
init
public void init()Initializes the cleaner. -
execute
public void execute()
-