org.alfresco.repo.content.cleanup
Class ContentStoreCleaner

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

public class ContentStoreCleaner
extends java.lang.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.


Nested Class Summary
static class ContentStoreCleaner.DeleteFailureAction
          Enumeration of actions to take in the even that an orphaned binary fails to get deleted.
 
Constructor Summary
ContentStoreCleaner()
           
 
Method Summary
 void execute()
           
 void init()
          Initializes the cleaner based on the eagerCleanup flag.
 void setAvmNodeDAO(AVMNodeDAO avmNodeDAO)
           
 void setContentDataDAO(ContentDataDAO contentDataDAO)
           
 void setContentService(ContentService contentService)
           
 void setDeletionFailureAction(ContentStoreCleaner.DeleteFailureAction deletionFailureAction)
          Set the action to take in the event that an orphaned binary failed to get deleted.
 void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
           
 void setEagerContentStoreCleaner(EagerContentStoreCleaner eagerContentStoreCleaner)
          Set the component that will do the physical deleting
 void setJobLockService(JobLockService jobLockService)
           
 void setProtectDays(int protectDays)
          Set the minimum number of days old that orphaned content must be before deletion is possible.
 void setTransactionService(TransactionService transactionService)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentStoreCleaner

public ContentStoreCleaner()
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

setAvmNodeDAO

public void setAvmNodeDAO(AVMNodeDAO avmNodeDAO)
Parameters:
avmNodeDAO - The AVM Node DAO to get urls with.

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 is ContentStoreCleaner.DeleteFailureAction.IGNORE.

Parameters:
deletionFailureAction - the action to take when deletes fail

init

public void init()
Initializes the cleaner based on the eagerCleanup flag.


execute

public void execute()


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.