Class ContentStoreCleaner

java.lang.Object
org.alfresco.repo.content.cleanup.ContentStoreCleaner

public class ContentStoreCleaner extends Object
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 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
  • Constructor Details

    • ContentStoreCleaner

      public ContentStoreCleaner()
  • Method Details

    • 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(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
    • 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

      public void setDeletionFailureAction(ContentStoreCleaner.DeleteFailureAction deletionFailureAction)
      Set the action to take in the event that an orphaned binary failed to get deleted. The default is ContentStoreCleaner.DeleteFailureAction.IGNORE.
      Parameters:
      deletionFailureAction - the action to take when deletes fail
    • init

      public void init()
      Initializes the cleaner.
    • execute

      public void execute()