From 9758d3d79dc88d16f1cbf516d3244a9296ea6df9 Mon Sep 17 00:00:00 2001
From: brinn <brinn>
Date: Mon, 15 Nov 2010 22:31:52 +0000
Subject: [PATCH] fix: make skip-accessibility-test-on-incoming really work,
 i.e. skip all remote operations if this parameter is set 'true'

SVN: 18718
---
 .../filesystem/intf/AbstractFileStore.java      | 17 ++++++++++++-----
 .../filesystem/store/FileStoreLocal.java        |  5 +----
 .../filesystem/store/FileStoreRemote.java       |  5 +----
 .../store/FileStoreRemoteMounted.java           |  2 +-
 4 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/datamover/source/java/ch/systemsx/cisd/datamover/filesystem/intf/AbstractFileStore.java b/datamover/source/java/ch/systemsx/cisd/datamover/filesystem/intf/AbstractFileStore.java
index 648f8ba23cd..cff12010527 100644
--- a/datamover/source/java/ch/systemsx/cisd/datamover/filesystem/intf/AbstractFileStore.java
+++ b/datamover/source/java/ch/systemsx/cisd/datamover/filesystem/intf/AbstractFileStore.java
@@ -47,15 +47,18 @@ public abstract class AbstractFileStore implements IFileStore
 
     protected final IFileSysOperationsFactory factory;
 
+    protected final boolean skipAccessibilityTest;
+
     protected AbstractFileStore(
             final HostAwareFileWithHighwaterMark hostAwareFileWithHighwaterMark, final String kind,
-            final IFileSysOperationsFactory factory)
+            final IFileSysOperationsFactory factory, final boolean skipAccessibilityTest)
     {
         assert hostAwareFileWithHighwaterMark != null;
         assert kind != null;
         this.hostAwareFileWithHighwaterMark = hostAwareFileWithHighwaterMark;
         this.kind = kind;
         this.factory = factory;
+        this.skipAccessibilityTest = skipAccessibilityTest;
     }
 
     private final String getCanonicalPath(final File file)
@@ -134,18 +137,22 @@ public abstract class AbstractFileStore implements IFileStore
 
                 public void check() throws ConfigurationFailureException
                 {
+                    if (skipAccessibilityTest)
+                    {
+                        return;
+                    }
                     if (srcHostOrNull != null)
                     {
-                        String executable = factory.tryGetIncomingRsyncExecutable();
-                        FileUtilities.checkPathCopier(copier, srcHostOrNull, executable,
+                        final String executableOrNull = factory.tryGetIncomingRsyncExecutable();
+                        FileUtilities.checkPathCopier(copier, srcHostOrNull, executableOrNull,
                                 tryGetRsyncModuleName(),
                                 DatamoverConstants.RSYNC_PASSWORD_FILE_INCOMING,
                                 DatamoverConstants.TIMEOUT_REMOTE_CONNECTION_MILLIS);
                     }
                     if (destHostOrNull != null)
                     {
-                        String executable = factory.tryGetOutgoingRsyncExecutable();
-                        FileUtilities.checkPathCopier(copier, destHostOrNull, executable,
+                        final String executableOrNull = factory.tryGetOutgoingRsyncExecutable();
+                        FileUtilities.checkPathCopier(copier, destHostOrNull, executableOrNull,
                                 destinationStore.tryGetRsyncModuleName(),
                                 DatamoverConstants.RSYNC_PASSWORD_FILE_OUTGOING,
                                 DatamoverConstants.TIMEOUT_REMOTE_CONNECTION_MILLIS);
diff --git a/datamover/source/java/ch/systemsx/cisd/datamover/filesystem/store/FileStoreLocal.java b/datamover/source/java/ch/systemsx/cisd/datamover/filesystem/store/FileStoreLocal.java
index cf948135065..fe97a6a3051 100644
--- a/datamover/source/java/ch/systemsx/cisd/datamover/filesystem/store/FileStoreLocal.java
+++ b/datamover/source/java/ch/systemsx/cisd/datamover/filesystem/store/FileStoreLocal.java
@@ -60,16 +60,13 @@ public class FileStoreLocal extends AbstractFileStore implements IExtendedFileSt
 
     private final HighwaterMarkWatcher highwaterMarkWatcher;
 
-    private final boolean skipAccessibilityTest;
-
     private final LastModificationChecker lastModificationChecker;
 
     public FileStoreLocal(final HostAwareFileWithHighwaterMark hostAwareFileWithHighwaterMark,
             final String description, final IFileSysOperationsFactory factory,
             final boolean skipAccessibilityTest)
     {
-        super(hostAwareFileWithHighwaterMark, description, factory);
-        this.skipAccessibilityTest = skipAccessibilityTest;
+        super(hostAwareFileWithHighwaterMark, description, factory, skipAccessibilityTest);
         this.remover = factory.getRemover();
         this.mover = factory.getMover();
         this.highwaterMarkWatcher = createHighwaterMarkWatcher(hostAwareFileWithHighwaterMark);
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 0612a721a71..65ef2d80086 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
@@ -112,8 +112,6 @@ public class FileStoreRemote extends AbstractFileStore
 
     private final HighwaterMarkWatcher highwaterMarkWatcher;
 
-    private final boolean skipAccessibilityTest;
-
     private String remoteLastchangedExecutableOrNull;
 
     private String remoteFindExecutableOrNull;
@@ -140,9 +138,8 @@ public class FileStoreRemote extends AbstractFileStore
             final IFileSysOperationsFactory factory, final boolean skipAccessibilityTest,
             final String remoteFindExecutableOrNull, final String remoteLastchangedExecutableOrNull)
     {
-        super(hostAwareFileWithHighwaterMark, kind, factory);
+        super(hostAwareFileWithHighwaterMark, kind, factory, skipAccessibilityTest);
         assert hostAwareFileWithHighwaterMark.tryGetHost() != null : "Unspecified host";
-        this.skipAccessibilityTest = skipAccessibilityTest;
         this.sshCommandExecutor =
                 new SshCommandExecutor(sshCommandBuilder,
                         hostAwareFileWithHighwaterMark.tryGetHost());
diff --git a/datamover/source/java/ch/systemsx/cisd/datamover/filesystem/store/FileStoreRemoteMounted.java b/datamover/source/java/ch/systemsx/cisd/datamover/filesystem/store/FileStoreRemoteMounted.java
index 47ad94ac88f..bb859d27e49 100644
--- a/datamover/source/java/ch/systemsx/cisd/datamover/filesystem/store/FileStoreRemoteMounted.java
+++ b/datamover/source/java/ch/systemsx/cisd/datamover/filesystem/store/FileStoreRemoteMounted.java
@@ -57,7 +57,7 @@ public final class FileStoreRemoteMounted extends AbstractFileStore
             final String description, final IFileSysOperationsFactory factory,
             final boolean skipAccessibilityTest, final long lastChangedTimeoutMillis)
     {
-        super(file, description, factory);
+        super(file, description, factory, skipAccessibilityTest);
         this.localImpl = new FileStoreLocal(file, description, factory, skipAccessibilityTest);
         this.localImplMonitored =
                 MonitoringProxy.create(IFileStore.class, localImpl).timing(
-- 
GitLab