1 17 package org.alfresco.repo.content.cleanup; 18 19 import org.alfresco.repo.content.ContentStore; 20 import org.alfresco.service.cmr.repository.ContentIOException; 21 import org.alfresco.service.cmr.repository.ContentReader; 22 import org.alfresco.service.cmr.repository.ContentWriter; 23 import org.apache.commons.logging.Log; 24 import org.apache.commons.logging.LogFactory; 25 26 32 public class DeletedContentBackupCleanerListener implements ContentStoreCleanerListener 33 { 34 private static Log logger = LogFactory.getLog(DeletedContentBackupCleanerListener.class); 35 36 private ContentStore store; 37 38 public DeletedContentBackupCleanerListener() 39 { 40 } 41 42 47 public void setStore(ContentStore store) 48 { 49 this.store = store; 50 } 51 52 public void beforeDelete(ContentReader reader) throws ContentIOException 53 { 54 ContentWriter writer = store.getWriter(null, reader.getContentUrl()); 56 writer.putContent(reader); 58 if (logger.isDebugEnabled()) 60 { 61 logger.debug("Moved content before deletion: \n" + 62 " URL: " + reader.getContentUrl() + "\n" + 63 " Store: " + store); 64 } 65 } 66 } 67 | Popular Tags |