From f4a78180b0522aedfbfc8349007746abbfaa24f4 Mon Sep 17 00:00:00 2001
From: ribeaudc <ribeaudc>
Date: Thu, 15 May 2008 12:39:36 +0000
Subject: [PATCH] [DMV-12] add: - 'AlwaysAboveFreeSpaceProvider'. change: -
 'RemoteFreeSpaceProvider' finished.

SVN: 6078
---
 .../filesystem/store/FileStoreRemote.java        | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/datamover/source/java/ch/systemsx/cisd/datamover/filesystem/store/FileStoreRemote.java b/datamover/source/java/ch/systemsx/cisd/datamover/filesystem/store/FileStoreRemote.java
index cf0d88c50ea..84781c0800d 100644
--- a/datamover/source/java/ch/systemsx/cisd/datamover/filesystem/store/FileStoreRemote.java
+++ b/datamover/source/java/ch/systemsx/cisd/datamover/filesystem/store/FileStoreRemote.java
@@ -22,9 +22,11 @@ import org.apache.log4j.Logger;
 
 import ch.systemsx.cisd.common.exceptions.NotImplementedException;
 import ch.systemsx.cisd.common.exceptions.Status;
+import ch.systemsx.cisd.common.highwatermark.AlwaysAboveFreeSpaceProvider;
 import ch.systemsx.cisd.common.highwatermark.FileWithHighwaterMark;
 import ch.systemsx.cisd.common.highwatermark.HighwaterMarkWatcher;
 import ch.systemsx.cisd.common.highwatermark.RemoteFreeSpaceProvider;
+import ch.systemsx.cisd.common.highwatermark.HighwaterMarkWatcher.IFreeSpaceProvider;
 import ch.systemsx.cisd.common.logging.ISimpleLogger;
 import ch.systemsx.cisd.common.logging.LogCategory;
 import ch.systemsx.cisd.common.logging.LogFactory;
@@ -58,15 +60,17 @@ public class FileStoreRemote extends FileStore
             final String host)
     {
         final File sshExecutable = factory.tryFindSshExecutable();
+        final IFreeSpaceProvider freeSpaceProvider;
         if (sshExecutable != null)
         {
-            return new HighwaterMarkWatcher(highwaterMark, new RemoteFreeSpaceProvider(host,
-                    sshExecutable));
+            freeSpaceProvider = new RemoteFreeSpaceProvider(host, sshExecutable);
+        } else
+        {
+            operationLog.warn("Impossible to remotely watch the 'high water mark' "
+                    + "('ssh' executable not found).");
+            freeSpaceProvider = AlwaysAboveFreeSpaceProvider.INSTANCE;
         }
-        // We set the "high water mark" to -1, meaning that the system will not be watching.
-        operationLog.warn("Impossible to remotely watch the 'high water mark' "
-                + "(ssh executable not found).");
-        return new HighwaterMarkWatcher(-1);
+        return new HighwaterMarkWatcher(highwaterMark, freeSpaceProvider);
     }
 
     //
-- 
GitLab