Class FileWipingContentCleanerListener

java.lang.Object
org.alfresco.repo.content.cleanup.FileWipingContentCleanerListener
All Implemented Interfaces:
ContentStoreCleanerListener

public class FileWipingContentCleanerListener extends Object implements ContentStoreCleanerListener
Simple listener that overwrites files with zeros.

Wire this into the EagerContentStoreCleaner as a listener and it will ensure that files have their contents overwritten with zeros before deletion. Note that this process does not affect the content lifecycyle in any way i.e. content will still follow the same orphan path as before.

Clearly wiring this up with a DeletedContentBackupCleanerListener is pointless as you will be making a copy of the before wiping it or end up copying a file full of zero depending on the order of the listeners.

Since:
4.0.1
Author:
Derek Hulley
  • Constructor Details

    • FileWipingContentCleanerListener

      public FileWipingContentCleanerListener()
  • Method Details

    • beforeDelete

      public void beforeDelete(ContentStore sourceStore, String contentUrl) throws ContentIOException
      Description copied from interface: ContentStoreCleanerListener
      Handle the notification that a store is about to be deleted
      Specified by:
      beforeDelete in interface ContentStoreCleanerListener
      Parameters:
      sourceStore - the store from which the content will be deleted
      contentUrl - the URL of the content to be deleted
      Throws:
      ContentIOException
    • shred

      protected void shred(ContentReader reader) throws IOException
      Override to perform shredding on disparate forms of readers. This implementation will, by default, identify more specific readers and make calls for those.
      Parameters:
      reader - the reader to the content needing shredding
      Throws:
      IOException - any IO error
    • shred

      protected void shred(File file) throws IOException
      Called by shred(ContentReader) when the reader points to a physical file. The default implementation simply overwrites the content with zeros.
      Parameters:
      file - the file to shred before deletion
      Throws:
      IOException - any IO error