Class ContentStoreCleaner
- java.lang.Object
-
- org.alfresco.repo.content.cleanup.ContentStoreCleaner
-
public class ContentStoreCleaner extends java.lang.ObjectThis 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 aQuartz 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 Classes Modifier and Type Class Description static classContentStoreCleaner.DeleteFailureActionEnumeration of actions to take in the even that an orphaned binary fails to get deleted.
-
Constructor Summary
Constructors Constructor Description ContentStoreCleaner()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute()voidinit()Initializes the cleaner.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(org.alfresco.service.cmr.dictionary.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)
-
-
-
Method Detail
-
setEagerContentStoreCleaner
public void setEagerContentStoreCleaner(EagerContentStoreCleaner eagerContentStoreCleaner)
Set the component that will do the physical deleting
-
setJobLockService
public void setJobLockService(JobLockService jobLockService)
- Parameters:
jobLockService- service used to ensure that cleanup runs are not duplicated
-
setContentDataDAO
public void setContentDataDAO(ContentDataDAO contentDataDAO)
- Parameters:
contentDataDAO- DAO used for enumerating DM content URLs
-
setDictionaryService
public void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
- Parameters:
dictionaryService- used to determine which properties are content properties
-
setContentService
public void setContentService(ContentService contentService)
- Parameters:
contentService- service to copy content binaries
-
setTransactionService
public void setTransactionService(TransactionService transactionService)
- 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
-
setDeletionFailureAction
public void setDeletionFailureAction(ContentStoreCleaner.DeleteFailureAction deletionFailureAction)
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()
-
-