From 62d4deb375e0f023bf8b33cdf79edefb843b8bec Mon Sep 17 00:00:00 2001
From: brinn <brinn>
Date: Tue, 22 Jul 2008 15:41:47 +0000
Subject: [PATCH] change: allow to specify rsync executable

SVN: 7404
---
 .../RsyncBasedRecursiveHardLinkMaker.java     | 23 +++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/common/source/java/ch/systemsx/cisd/common/utilities/RsyncBasedRecursiveHardLinkMaker.java b/common/source/java/ch/systemsx/cisd/common/utilities/RsyncBasedRecursiveHardLinkMaker.java
index 55f6ae1a66f..5ae3bcb6683 100644
--- a/common/source/java/ch/systemsx/cisd/common/utilities/RsyncBasedRecursiveHardLinkMaker.java
+++ b/common/source/java/ch/systemsx/cisd/common/utilities/RsyncBasedRecursiveHardLinkMaker.java
@@ -58,7 +58,7 @@ public class RsyncBasedRecursiveHardLinkMaker implements IDirectoryImmutableCopi
 
     private final long timeToSleepAfterCopyFails;
 
-    private RsyncCopier rsyncCopier = new RsyncCopier(OSUtilities.findExecutable(RSYNC_EXEC));
+    private final RsyncCopier rsyncCopier;
 
     public interface ILastChangedChecker
     {
@@ -67,13 +67,28 @@ public class RsyncBasedRecursiveHardLinkMaker implements IDirectoryImmutableCopi
 
     public RsyncBasedRecursiveHardLinkMaker()
     {
-        this(DEFAULT_INACTIVITY_TRESHOLD_MILLIS, DEFAULT_MAX_ERRORS_TO_IGNORE,
+        this(null, DEFAULT_INACTIVITY_TRESHOLD_MILLIS, DEFAULT_MAX_ERRORS_TO_IGNORE,
                 DEFAULT_MAX_ATTEMPTS, DEFAULT_TIME_TO_SLEEP_AFTER_COPY_FAILS);
     }
 
-    public RsyncBasedRecursiveHardLinkMaker(long inactivityThresholdMillis, int maxErrorsToIgnore,
-            int maxAttempts, long timeToSleepAfterCopyFails)
+    public RsyncBasedRecursiveHardLinkMaker(File rsyncExecutableOrNull)
     {
+        this(rsyncExecutableOrNull, DEFAULT_INACTIVITY_TRESHOLD_MILLIS,
+                DEFAULT_MAX_ERRORS_TO_IGNORE, DEFAULT_MAX_ATTEMPTS,
+                DEFAULT_TIME_TO_SLEEP_AFTER_COPY_FAILS);
+    }
+
+    public RsyncBasedRecursiveHardLinkMaker(File rsyncExecutableOrNull,
+            long inactivityThresholdMillis, int maxErrorsToIgnore, int maxAttempts,
+            long timeToSleepAfterCopyFails)
+    {
+        if (rsyncExecutableOrNull == null)
+        {
+            rsyncCopier = new RsyncCopier(OSUtilities.findExecutable(RSYNC_EXEC));
+        } else
+        {
+            rsyncCopier = new RsyncCopier(rsyncExecutableOrNull);
+        }
         this.inactivityThresholdMillis = inactivityThresholdMillis;
         this.timeToSleepAfterCopyFails = timeToSleepAfterCopyFails;
         this.maxErrorsToIgnore = maxErrorsToIgnore;
-- 
GitLab