From 6230b5680225ea55893394a45d0e892bcee0bd17 Mon Sep 17 00:00:00 2001
From: brinn <brinn>
Date: Fri, 31 Aug 2007 13:49:57 +0000
Subject: [PATCH] minor: - formatting - add some final qualifiers where it
 doesn't hurt

SVN: 1564
---
 .../cisd/datamover/LocalProcessorHandler.java | 20 ++++----
 .../cisd/datamover/MonitorStarter.java        | 49 ++++++++++---------
 2 files changed, 37 insertions(+), 32 deletions(-)

diff --git a/datamover/source/java/ch/systemsx/cisd/datamover/LocalProcessorHandler.java b/datamover/source/java/ch/systemsx/cisd/datamover/LocalProcessorHandler.java
index 493ed68e11d..4d119884855 100644
--- a/datamover/source/java/ch/systemsx/cisd/datamover/LocalProcessorHandler.java
+++ b/datamover/source/java/ch/systemsx/cisd/datamover/LocalProcessorHandler.java
@@ -90,7 +90,7 @@ public class LocalProcessorHandler implements IPathHandler
 
     private static void recoverTemporaryExtraCopy(File tempDir, File inputDir, File extraCopyDirOrNull)
     {
-        File[] files = FileSystemHelper.listFiles(tempDir);
+        final File[] files = FileSystemHelper.listFiles(tempDir);
         if (files == null || files.length == 0)
         {
             return; // directory is empty, no recovery is needed
@@ -138,7 +138,7 @@ public class LocalProcessorHandler implements IPathHandler
 
     public boolean handle(File path)
     {
-        Boolean result = tryMoveManualOrClean(path);
+        final Boolean result = tryMoveManualOrClean(path);
         if (result != null)
         {
             return result.booleanValue(); // stop processing
@@ -152,7 +152,7 @@ public class LocalProcessorHandler implements IPathHandler
             ok = ok && (extraTmpCopy != null);
         }
 
-        File movedFile = FileSystemHelper.tryMoveLocal(path, outputDir);
+        final File movedFile = FileSystemHelper.tryMoveLocal(path, outputDir);
         if (movedFile != null)
         {
             outgoingHandler.handle(movedFile);
@@ -168,10 +168,10 @@ public class LocalProcessorHandler implements IPathHandler
         return ok;
     }
 
-    // @return true if successed, false if failed, null if succeded and file still exists
+    // @return true if succeeded, false if failed, null if succeeded and file still exists
     private Boolean tryMoveManualOrClean(File file)
     {
-        EFileManipResult manualMoveStatus = doManualIntervention(file);
+        final EFileManipResult manualMoveStatus = doManualIntervention(file);
         if (manualMoveStatus == EFileManipResult.FAILURE)
         {
             return Boolean.FALSE;
@@ -182,7 +182,7 @@ public class LocalProcessorHandler implements IPathHandler
         {
             // continue processing
         }
-        boolean wholeDeleted = doCleansing(file);
+        final boolean wholeDeleted = doCleansing(file);
         if (wholeDeleted)
         {
             return Boolean.TRUE;
@@ -195,7 +195,7 @@ public class LocalProcessorHandler implements IPathHandler
     private boolean doCleansing(File resource)
     {
         final RegexFileFilter cleansingFilter = new RegexFileFilter();
-        Pattern cleansingRegex = parameters.getCleansingRegex();
+        final Pattern cleansingRegex = parameters.getCleansingRegex();
         if (cleansingRegex != null)
         {
             log(resource, "Doing cleansing");
@@ -203,7 +203,7 @@ public class LocalProcessorHandler implements IPathHandler
         }
         final ISimpleLogger logger =
                 operationLog.isDebugEnabled() ? new Log4jSimpleLogger(Level.DEBUG, operationLog) : null;
-        boolean pathDeleted = FileUtilities.deleteRecursively(resource, cleansingFilter, logger);
+        final boolean pathDeleted = FileUtilities.deleteRecursively(resource, cleansingFilter, logger);
         return pathDeleted;
     }
 
@@ -214,8 +214,8 @@ public class LocalProcessorHandler implements IPathHandler
 
     private EFileManipResult doManualIntervention(File resource)
     {
-        RegexFileFilter manualInterventionFilter = new RegexFileFilter();
-        Pattern manualInterventionRegex = parameters.getManualInterventionRegex();
+        final RegexFileFilter manualInterventionFilter = new RegexFileFilter();
+        final Pattern manualInterventionRegex = parameters.getManualInterventionRegex();
         if (manualInterventionRegex != null)
         {
             manualInterventionFilter.add(PathType.ALL, manualInterventionRegex);
diff --git a/datamover/source/java/ch/systemsx/cisd/datamover/MonitorStarter.java b/datamover/source/java/ch/systemsx/cisd/datamover/MonitorStarter.java
index 8b14c122319..e40683e81f9 100644
--- a/datamover/source/java/ch/systemsx/cisd/datamover/MonitorStarter.java
+++ b/datamover/source/java/ch/systemsx/cisd/datamover/MonitorStarter.java
@@ -104,8 +104,8 @@ public class MonitorStarter
 
     private LazyPathHandler startupLocalProcessing(LazyPathHandler outgoingHandler)
     {
-        IPathImmutableCopier copier = factory.getImmutableCopier();
-        IPathHandler localProcesingHandler =
+        final IPathImmutableCopier copier = factory.getImmutableCopier();
+        final IPathHandler localProcesingHandler =
                 LocalProcessorHandler.createAndRecover(parameters, bufferDirs.getCopyCompleteDir(), bufferDirs
                         .getReadyToMoveDir(), bufferDirs.getTempDir(), outgoingHandler, copier);
         return LazyPathHandler.create(localProcesingHandler, "Local Processor");
@@ -115,8 +115,8 @@ public class MonitorStarter
 
     private Timer startupIncomingMovingProcess(FileStore incomingStore, LazyPathHandler localProcessor)
     {
-        IReadPathOperations readOperations = factory.getReadAccessor();
-        boolean isIncomingRemote = parameters.getTreatIncomingAsRemote();
+        final IReadPathOperations readOperations = factory.getReadAccessor();
+        final boolean isIncomingRemote = parameters.getTreatIncomingAsRemote();
 
         recoverIncomingAfterShutdown(incomingStore, readOperations, isIncomingRemote, localProcessor);
         IPathHandler pathHandler =
@@ -138,7 +138,9 @@ public class MonitorStarter
             boolean isIncomingRemote, LazyPathHandler localProcessor)
     {
         if (isIncomingRemote == false)
+        {
             return; // no recovery is needed
+        }
 
         recoverIncomingInProgress(incomingStore, incomingReadOperations, bufferDirs.getCopyInProgressDir(), bufferDirs
                 .getCopyCompleteDir());
@@ -148,13 +150,14 @@ public class MonitorStarter
     private static void recoverIncomingInProgress(FileStore incomingStore, IReadPathOperations incomingReadOperations,
             File copyInProgressDir, File copyCompleteDir)
     {
-        File[] files = FileSystemHelper.listFiles(copyInProgressDir);
+        final File[] files = FileSystemHelper.listFiles(copyInProgressDir);
         if (files == null || files.length == 0)
+        {
             return; // directory is empty, no recovery is needed
+        }
 
-        for (int i = 0; i < files.length; i++)
+        for (File file : files)
         {
-            File file = files[i];
             recoverIncomingAfterShutdown(file, incomingStore, incomingReadOperations, copyCompleteDir);
         }
     }
@@ -164,8 +167,8 @@ public class MonitorStarter
     {
         if (CopyFinishedMarker.isMarker(unfinishedFile))
         {
-            File markerFile = unfinishedFile;
-            File localCopy = CopyFinishedMarker.extractOriginal(markerFile);
+            final File markerFile = unfinishedFile;
+            final File localCopy = CopyFinishedMarker.extractOriginal(markerFile);
             if (localCopy.exists())
             {
                 // copy and marker exist - do nothing, recovery will be done for copied resource
@@ -177,8 +180,8 @@ public class MonitorStarter
         } else
         // handle local copy
         {
-            File localCopy = unfinishedFile;
-            File markerFile = CopyFinishedMarker.extractMarker(localCopy);
+            final File localCopy = unfinishedFile;
+            final File markerFile = CopyFinishedMarker.extractMarker(localCopy);
             if (markerFile.exists())
             {
                 // copy and marker exist - copy finished, but copied resource not moved
@@ -203,9 +206,11 @@ public class MonitorStarter
     // schedule processing of all resources which were previously copied
     private static void recoverIncomingCopyComplete(File copyCompleteDir, LazyPathHandler localProcessor)
     {
-        File[] files = FileSystemHelper.listFiles(copyCompleteDir);
+        final File[] files = FileSystemHelper.listFiles(copyCompleteDir);
         if (files == null || files.length == 0)
+        {
             return; // directory is empty, no recovery is needed
+        }
 
         for (int i = 0; i < files.length; i++)
         {
@@ -233,7 +238,7 @@ public class MonitorStarter
 
     private boolean moveFromLocalIncoming(File source, LazyPathHandler localProcessor)
     {
-        File finalFile = tryMoveLocal(source, bufferDirs.getCopyCompleteDir());
+        final File finalFile = tryMoveLocal(source, bufferDirs.getCopyCompleteDir());
         if (finalFile == null)
         {
             return false;
@@ -244,19 +249,19 @@ public class MonitorStarter
     private boolean moveFromRemoteIncoming(File source, String sourceHostOrNull, LazyPathHandler localProcessor)
     {
         // 1. move from incoming: copy, delete, create copy-finished-marker
-        File copyInProgressDir = bufferDirs.getCopyInProgressDir();
-        boolean ok = moveFromRemoteToLocal(source, sourceHostOrNull, copyInProgressDir);
+        final File copyInProgressDir = bufferDirs.getCopyInProgressDir();
+        final boolean ok = moveFromRemoteToLocal(source, sourceHostOrNull, copyInProgressDir);
         if (ok == false)
         {
             return false;
         }
-        File copiedFile = new File(copyInProgressDir, source.getName());
+        final File copiedFile = new File(copyInProgressDir, source.getName());
         assert copiedFile.exists();
-        File markerFile = CopyFinishedMarker.extractMarker(copiedFile);
+        final File markerFile = CopyFinishedMarker.extractMarker(copiedFile);
         assert markerFile.exists();
 
         // 2. Move to final directory, delete marker
-        File finalFile = tryMoveFromInProgressToFinished(copiedFile, markerFile, bufferDirs.getCopyCompleteDir());
+        final File finalFile = tryMoveFromInProgressToFinished(copiedFile, markerFile, bufferDirs.getCopyCompleteDir());
         if (finalFile == null)
         {
             return false;
@@ -269,7 +274,7 @@ public class MonitorStarter
 
     private static File tryMoveFromInProgressToFinished(File copiedFile, File markerFileOrNull, File copyCompleteDir)
     {
-        File finalFile = tryMoveLocal(copiedFile, copyCompleteDir);
+        final File finalFile = tryMoveLocal(copiedFile, copyCompleteDir);
         if (finalFile != null)
         {
             if (markerFileOrNull != null)
@@ -305,10 +310,10 @@ public class MonitorStarter
 
     private IPathHandler createRemotePathMover(String sourceHost, File destinationDirectory, String destinationHost)
     {
-        IPathCopier copier = factory.getCopier(destinationDirectory);
-        CopyActivityMonitor monitor =
+        final IPathCopier copier = factory.getCopier(destinationDirectory);
+        final CopyActivityMonitor monitor =
                 new CopyActivityMonitor(destinationDirectory, factory.getReadAccessor(), copier, parameters);
-        IPathRemover remover = factory.getRemover();
+        final IPathRemover remover = factory.getRemover();
         return new RemotePathMover(destinationDirectory, destinationHost, monitor, remover, copier, sourceHost,
                 parameters);
     }
-- 
GitLab