From 6cfe4c6c9840afb2fee35db78d3d8929ceeb2b91 Mon Sep 17 00:00:00 2001
From: brinn <brinn>
Date: Tue, 11 May 2010 19:06:12 +0000
Subject: [PATCH] fix: allow not to have a preprocessing by skipping the
 preprocessing configuration (provide a dummy implementation in this case)

SVN: 15918
---
 .../utils/PreprocessingExecutor.java          | 21 ++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/datastore_server/source/java/ch/systemsx/cisd/etlserver/utils/PreprocessingExecutor.java b/datastore_server/source/java/ch/systemsx/cisd/etlserver/utils/PreprocessingExecutor.java
index 8530a262a17..d168255c214 100644
--- a/datastore_server/source/java/ch/systemsx/cisd/etlserver/utils/PreprocessingExecutor.java
+++ b/datastore_server/source/java/ch/systemsx/cisd/etlserver/utils/PreprocessingExecutor.java
@@ -24,7 +24,6 @@ import java.util.concurrent.Callable;
 
 import org.apache.log4j.Logger;
 
-import ch.systemsx.cisd.common.exceptions.EnvironmentFailureException;
 import ch.systemsx.cisd.common.logging.LogCategory;
 import ch.systemsx.cisd.common.logging.LogFactory;
 import ch.systemsx.cisd.common.process.CallableExecutor;
@@ -44,6 +43,21 @@ public class PreprocessingExecutor
 
     private final static Logger machineLog =
             LogFactory.getLogger(LogCategory.MACHINE, PreprocessingExecutor.class);
+    
+    private final static PreprocessingExecutor DUMMY = new PreprocessingExecutor(null, 0, 0L)
+    {
+        @Override
+        public boolean execute(String filePath)
+        {
+            return true;
+        }
+
+        @Override
+        public boolean executeOnce(String filePath)
+        {
+            return true;
+        }
+    };
 
     /**
      * A path to a script which should be called from command line for every dataset batch before it
@@ -69,8 +83,9 @@ public class PreprocessingExecutor
                     millisToSleepOnFailure);
         } else
         {
-            throw EnvironmentFailureException.fromTemplate("Property '%s' is not set!",
-                    PREPROCESSING_SCRIPT_PATH);
+            operationLog.info("No preprocessing script found, skipping preprocessing.");
+            // Return a dummy that always return true;
+            return DUMMY;
         }
     }
 
-- 
GitLab