Class FileWipingContentCleanerListener

  • All Implemented Interfaces:
    ContentStoreCleanerListener

    public class FileWipingContentCleanerListener
    extends java.lang.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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void beforeDelete​(org.alfresco.repo.content.ContentStore sourceStore, java.lang.String contentUrl)
      Handle the notification that a store is about to be deleted
      protected void shred​(java.io.File file)
      Called by shred(ContentReader) when the reader points to a physical file.
      protected void shred​(org.alfresco.service.cmr.repository.ContentReader reader)
      Override to perform shredding on disparate forms of readers.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileWipingContentCleanerListener

        public FileWipingContentCleanerListener()
    • Method Detail

      • beforeDelete

        public void beforeDelete​(org.alfresco.repo.content.ContentStore sourceStore,
                                 java.lang.String contentUrl)
                          throws org.alfresco.service.cmr.repository.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:
        org.alfresco.service.cmr.repository.ContentIOException
      • shred

        protected void shred​(org.alfresco.service.cmr.repository.ContentReader reader)
                      throws java.io.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:
        java.io.IOException - any IO error
      • shred

        protected void shred​(java.io.File file)
                      throws java.io.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:
        java.io.IOException - any IO error