From 5eca8bd6e005fbf3bb576d67b86c48760198968c Mon Sep 17 00:00:00 2001 From: Britt Park Date: Thu, 14 Sep 2006 21:46:41 +0000 Subject: [PATCH] Added hooks for some of AVMSyncService to diagnostic utility. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3798 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../org/alfresco/repo/avm/AVMInterpreter.java | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/source/java/org/alfresco/repo/avm/AVMInterpreter.java b/source/java/org/alfresco/repo/avm/AVMInterpreter.java index 0205383354..ec1c57ba96 100644 --- a/source/java/org/alfresco/repo/avm/AVMInterpreter.java +++ b/source/java/org/alfresco/repo/avm/AVMInterpreter.java @@ -24,6 +24,7 @@ import java.io.InputStreamReader; import java.io.PrintStream; import java.io.InputStream; import java.io.OutputStream; +import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; @@ -34,6 +35,8 @@ import org.alfresco.service.cmr.avm.AVMNodeDescriptor; import org.alfresco.service.cmr.avm.AVMService; import org.alfresco.service.cmr.avm.AVMStoreDescriptor; import org.alfresco.service.cmr.avm.VersionDescriptor; +import org.alfresco.service.cmr.avmsync.AVMDifference; +import org.alfresco.service.cmr.avmsync.AVMSyncService; import org.alfresco.service.namespace.QName; import org.springframework.context.support.FileSystemXmlApplicationContext; @@ -48,6 +51,11 @@ public class AVMInterpreter */ private AVMService fService; + /** + * The sync service. + */ + private AVMSyncService fSyncService; + /** * The reader for interaction. */ @@ -88,6 +96,15 @@ public class AVMInterpreter fService = service; } + /** + * Set the AVM sync service. + * @param syncService + */ + public void setAvmSyncService(AVMSyncService syncService) + { + fSyncService = syncService; + } + /** * Set the bulk loader. * @param loader @@ -440,6 +457,49 @@ public class AVMInterpreter out.println(name + ": " + props.get(name)); } } + else if (command[0].equals("compare")) + { + if (command.length != 5) + { + return "Syntax Error."; + } + List diffs = fSyncService.compare(Integer.parseInt(command[2]), + command[1], + Integer.parseInt(command[4]), + command[3]); + for (AVMDifference diff : diffs) + { + out.println(diff); + } + } + else if (command[0].equals("update")) + { + if (command.length != 4) + { + return "Syntax Error."; + } + AVMDifference diff = new AVMDifference(Integer.parseInt(command[2]), command[1], + -1, command[3], AVMDifference.NEWER); + List diffs = new ArrayList(); + diffs.add(diff); + fSyncService.update(diffs, false, false, false, false); + } + else if (command[0].equals("resetLayer")) + { + if (command.length != 2) + { + return "Syntax Error."; + } + fSyncService.resetLayer(command[1]); + } + else if (command[0].equals("flatten")) + { + if (command.length != 3) + { + return "Syntax Error."; + } + fSyncService.flatten(command[1], command[2]); + } else { return "Syntax Error.";