Skip to content
Snippets Groups Projects
Commit 70d44673 authored by brinn's avatar brinn
Browse files

remove obsolete code and options that allowed to use ln for doing extra copies

SVN: 7403
parent 6b41a4da
No related branches found
No related tags found
No related merge requests found
......@@ -111,27 +111,6 @@ public final class Parameters implements ITimingParameters, IFileSysParameters
@Option(longName = PropertyNames.SSH_EXECUTABLE, metaVar = "EXEC", usage = "The ssh executable to use for creating tunnels.")
private String sshExecutable = null;
/**
* The path to the <code>ln</code> executable file for creating hard links.
*/
@Option(longName = PropertyNames.HARD_LINK_EXECUTABLE, metaVar = "EXEC", usage = "The executable to use for creating hard links.")
private String hardLinkExecutable = null;
/**
* Default of whether rsync should be used for creating the extra copy or ln should be called on
* each individual file.
*/
private static final boolean DEFAULT_USE_RSYNC_FOR_EXTRA_COPIES = true;
/**
* If set to <code>true</code>, rsync is used to perform the extra copy using hard links.
* Otherwise, <code>ln</code> will be called on each single file.
*/
@Option(longName = PropertyNames.USE_RSYNC_FOR_EXTRA_COPIES, usage = "If true, rsync is used "
+ "for performing the extra copy (it will create hard links), otherwise the ln "
+ "executable will be used (default: true).")
private boolean useRsyncForExtraCopies = DEFAULT_USE_RSYNC_FOR_EXTRA_COPIES;
/**
* The path to the <code>find</code> executable file on the incoming host.
*/
......@@ -451,15 +430,9 @@ public final class Parameters implements ITimingParameters, IFileSysParameters
rsyncOverwrite =
PropertyUtils.getBoolean(serviceProperties, PropertyNames.RSYNC_OVERWRITE,
rsyncOverwrite);
useRsyncForExtraCopies =
PropertyUtils.getBoolean(serviceProperties,
PropertyNames.USE_RSYNC_FOR_EXTRA_COPIES, useRsyncForExtraCopies);
sshExecutable =
PropertyUtils.getProperty(serviceProperties, PropertyNames.SSH_EXECUTABLE,
sshExecutable);
hardLinkExecutable =
PropertyUtils.getProperty(serviceProperties, PropertyNames.HARD_LINK_EXECUTABLE,
hardLinkExecutable);
incomingHostFindExecutableOrNull =
PropertyUtils.getProperty(serviceProperties,
PropertyNames.INCOMING_HOST_FIND_EXECUTABLE,
......@@ -606,25 +579,6 @@ public final class Parameters implements ITimingParameters, IFileSysParameters
return sshExecutable;
}
/**
* @return The name of the <code>ln</code> executable to use for creating hard links or
* <code>null</code> if not specified.
*/
public final String getHardLinkExecutable()
{
return hardLinkExecutable;
}
/**
* @return <code>true</code>, if <code>rsync</code> will be used for creating the extra (hard
* link) copies, <code>false</code> if <code>ln</code> will be called on every file
* individually (which is a lot slower).
*/
public boolean useRsyncForExtraCopies()
{
return useRsyncForExtraCopies;
}
/**
* @return The interval to wait between two checks for activity (in milliseconds).
*/
......@@ -787,20 +741,6 @@ public final class Parameters implements ITimingParameters, IFileSysParameters
{
operationLog.info(String.format("Extra copy directory: '%s'.", extraCopyDirectory
.getAbsolutePath()));
if (useRsyncForExtraCopies)
{
operationLog.info("Using 'rsync' for doing extra copies.");
} else
{
if (hardLinkExecutable != null)
{
operationLog.info(String.format("Using '%s' for doing extra copies.",
hardLinkExecutable));
} else
{
operationLog.info("Using 'ln' for doing extra copies.");
}
}
}
operationLog.info(String.format("Check intervall (external): %s s.",
DurationFormatUtils.formatDuration(getCheckIntervalMillis(), "s")));
......
......@@ -19,18 +19,12 @@ package ch.systemsx.cisd.datamover.filesystem;
import java.io.File;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import ch.systemsx.cisd.common.exceptions.ConfigurationFailureException;
import ch.systemsx.cisd.common.exceptions.Status;
import ch.systemsx.cisd.common.exceptions.StatusFlag;
import ch.systemsx.cisd.common.filesystem.IPathCopier;
import ch.systemsx.cisd.common.filesystem.rsync.RsyncCopier;
import ch.systemsx.cisd.common.logging.LogCategory;
import ch.systemsx.cisd.common.logging.LogFactory;
import ch.systemsx.cisd.common.utilities.IDirectoryImmutableCopier;
import ch.systemsx.cisd.common.utilities.OSUtilities;
import ch.systemsx.cisd.common.utilities.RecursiveHardLinkMaker;
import ch.systemsx.cisd.datamover.filesystem.intf.IFileSysOperationsFactory;
import ch.systemsx.cisd.datamover.filesystem.intf.IPathMover;
import ch.systemsx.cisd.datamover.filesystem.intf.IPathRemover;
......@@ -45,9 +39,6 @@ public class FileSysOperationsFactory implements IFileSysOperationsFactory
private static final String RSYNC_BINARY_NAME = "rsync";
private static final Logger notificationLog =
LogFactory.getLogger(LogCategory.NOTIFY, FileSysOperationsFactory.class);
private final IFileSysParameters parameters;
public FileSysOperationsFactory(final IFileSysParameters parameters)
......@@ -76,32 +67,6 @@ public class FileSysOperationsFactory implements IFileSysOperationsFactory
return executableFile;
}
private final IDirectoryImmutableCopier createFakedImmCopier()
{
final IPathCopier normalCopier = getCopier(false);
return new IDirectoryImmutableCopier()
{
//
// IDirectoryImmutableCopier
//
public final boolean copyDirectoryImmutably(final File file,
final File destinationDirectory, String targetNameOrNull)
{
final Status status = normalCopier.copy(file, destinationDirectory);
if (StatusFlag.OK.equals(status.getFlag()))
{
return true;
} else
{
notificationLog.error(String.format("Copy of '%s' to '%s' failed: %s.",
file.getPath(), destinationDirectory.getPath(), status));
return false;
}
}
};
}
//
// IFileSysOperationsFactory
//
......@@ -114,27 +79,8 @@ public class FileSysOperationsFactory implements IFileSysOperationsFactory
public final IDirectoryImmutableCopier getImmutableCopier()
{
if (parameters.useRsyncForExtraCopies())
{
final File rsyncExecutable = findRsyncExecutable();
return new RsyncCopier(rsyncExecutable);
}
final String lnExecOrNull = parameters.getHardLinkExecutable();
if (lnExecOrNull != null)
{
return RecursiveHardLinkMaker.create(lnExecOrNull);
}
IDirectoryImmutableCopier copier = null;
if (OSUtilities.isWindows() == false)
{
copier = RecursiveHardLinkMaker.tryCreate();
if (copier != null)
{
return copier;
}
}
return createFakedImmCopier();
final File rsyncExecutable = findRsyncExecutable();
return new RsyncCopier(rsyncExecutable);
}
public final IPathCopier getCopier(final boolean requiresDeletionBeforeCreation)
......
......@@ -21,11 +21,6 @@ package ch.systemsx.cisd.datamover.intf;
*/
public interface IFileSysParameters
{
/**
* The path to the <code>ln</code> executable file for creating hard links.
*/
String getHardLinkExecutable();
/**
* The name of the <code>rsync</code> executable to use for copy operations.
*/
......@@ -43,13 +38,6 @@ public interface IFileSysParameters
*/
String getSshExecutable();
/**
* @return <code>true</code>, if <code>rsync</code> should be used for creating the
* additional hard link copies, <code>false</code> if <code>ln</code> should be
* called on every file individually (which is a lot slower).
*/
boolean useRsyncForExtraCopies();
/**
* @return The time interval to wait after a retriable error has occurred before a new attempt
* is made.
......
......@@ -123,14 +123,6 @@ public final class ParametersTest extends AbstractFileSystemTestCase
assertEquals(sshExec, parameters.getSshExecutable());
}
@Test
public void testSetLnExecutableLong() throws Exception
{
final String exec = "/usr/local/bin/ln";
final Parameters parameters = parse("--hard-link-executable", exec);
assertEquals(exec, parameters.getHardLinkExecutable());
}
@Test
public void testSetCleansingRegexLong() throws Exception
{
......
......@@ -34,11 +34,6 @@ public class FileOperationsUtil
{
return new IFileSysParameters()
{
public String getHardLinkExecutable()
{
return null;
}
public String getRsyncExecutable()
{
return null;
......@@ -54,11 +49,6 @@ public class FileOperationsUtil
return false;
}
public boolean useRsyncForExtraCopies()
{
return true;
}
public long getIntervalToWaitAfterFailure()
{
return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment