Jan Vonka 21bb599e20 Merged V3.0 to HEAD
12140: Merged V2.2 to V3.0
    11732: Fixed ETWOTWO-804: Node and Transaction Cleanup Job
    11747: Missed config for Node and Txn purging
    11826: WCM - fix ETWOTWO-817
    11951: Fixed ETWOTWO-901: NodeService cleanup must be pluggable
    11961: Merged V2.1 to V2.2
      11561: ETWOONE-224: when renaming duplicates during copy association names where not renamed 
      11583: (ALREADY PRESENT) Updated NTLM config example in web.xml - adding missing servlet mappings
      11584: Fix for ETWOONE-209 - JavaScript People.createGroup() API now correctly checks for actual group name when testing for existence
      11585: Fix for ETWOONE-214 - View In CIFS link now works even when users des not have view permissions on the parent folder
      11612: Fix for ETWOONE-91: the description textarea in the modify space properties web form eats one leading newline each time it is submitted
      11613: Fix 2.1 build and adjust implementation of ETWOONE-224 fix
      11621: Fix for ETWOONE-343
      11669: Improved debug from index tracking when exceptions occur
  12141: Avoid annoying Spring WARN messages for ClientAbortException
  12143: File that should have been deleted in CHK-5460 (rev 12140)
  12177: Fix failing FS Deployment Tests since introduction of transaction check advice.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12507 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2008-12-19 10:21:51 +00:00

65 lines
2.0 KiB
Java

package org.alfresco.repo.node.cleanup;
import java.util.ArrayList;
import java.util.List;
import org.alfresco.error.StackTraceUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* A {@link NodeCleanupWorker worker} that aggregates any number of
* {@link #register(NodeCleanupWorker) registered} workers.
*
* @author Derek Hulley
* @since 2.2 SP2
*/
public class NodeCleanupRegistry implements NodeCleanupWorker
{
private static Log logger = LogFactory.getLog(NodeCleanupRegistry.class);
private List<NodeCleanupWorker> cleanupWorkers;
public NodeCleanupRegistry()
{
cleanupWorkers = new ArrayList<NodeCleanupWorker>(5);
}
public void register(NodeCleanupWorker cleanupWorker)
{
cleanupWorkers.add(cleanupWorker);
}
/**
* Calls all registered cleaners in order, without transactions or authentication.
* The return messages are aggregated.
*/
public List<String> doClean()
{
List<String> results = new ArrayList<String>(100);
for (NodeCleanupWorker cleanupWorker : cleanupWorkers)
{
try
{
results.addAll(cleanupWorker.doClean());
}
catch (Throwable e)
{
// This failed. The cleaner should be handling this, but we can't guarantee it.
logger.error(
"NodeCleanupWork doesn't handle all exception conditions: " +
cleanupWorker.getClass().getName());
StringBuilder sb = new StringBuilder(1024);
StackTraceUtil.buildStackTrace(
"Node cleanup failed: " +
" Worker: " + cleanupWorker.getClass().getName() + "\n" +
" Error: ",
e.getStackTrace(),
sb,
20);
results.add(sb.toString());
}
}
return results;
}
}