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

(merged from Datamover 1.0.x branch, r2161)

change: strip leading and trailing whitespaces from all but the regex parameters in order to make configuration less error prone

SVN: 2168
parent d12a27fc
No related branches found
No related tags found
No related merge requests found
...@@ -64,13 +64,18 @@ public class Parameters implements ITimingParameters, IFileSysParameters ...@@ -64,13 +64,18 @@ public class Parameters implements ITimingParameters, IFileSysParameters
+ "copy operations.") + "copy operations.")
private String rsyncExecutable = null; private String rsyncExecutable = null;
/**
* Default of whether rsync should use overwrite or append mode, if append mode is available.
*/
private static final boolean DEFAULT_RSYNC_OVERWRITE = false;
/** /**
* If set to <code>true</code>, rsync is called in such a way to files that already exist are overwritten rather * If set to <code>true</code>, rsync is called in such a way to files that already exist are overwritten rather
* than appended to. * than appended to.
*/ */
@Option(longName = "rsync-overwrite", usage = "If true, files that already exist on the remote side are always " @Option(longName = "rsync-overwrite", usage = "If true, files that already exist on the remote side are always "
+ "overwritten rather than appended.") + "overwritten rather than appended.")
private boolean rsyncOverwrite = false; private boolean rsyncOverwrite;
/** /**
* The name of the <code>ssh</code> executable to use for creating tunnels. * The name of the <code>ssh</code> executable to use for creating tunnels.
...@@ -381,9 +386,23 @@ public class Parameters implements ITimingParameters, IFileSysParameters ...@@ -381,9 +386,23 @@ public class Parameters implements ITimingParameters, IFileSysParameters
{ {
final Properties serviceProperties = loadServiceProperties(); final Properties serviceProperties = loadServiceProperties();
rsyncExecutable = serviceProperties.getProperty("rsync-executable"); rsyncExecutable = serviceProperties.getProperty("rsync-executable");
rsyncOverwrite = Boolean.parseBoolean(serviceProperties.getProperty("rsync-overwrite", "false")); if (rsyncExecutable != null)
{
rsyncExecutable = rsyncExecutable.trim();
}
rsyncOverwrite =
Boolean.parseBoolean(serviceProperties.getProperty("rsync-overwrite",
Boolean.toString(DEFAULT_RSYNC_OVERWRITE)).trim());
sshExecutable = serviceProperties.getProperty("ssh-executable"); sshExecutable = serviceProperties.getProperty("ssh-executable");
if (sshExecutable != null)
{
sshExecutable = sshExecutable.trim();
}
hardLinkExecutable = serviceProperties.getProperty("hard-link-executable"); hardLinkExecutable = serviceProperties.getProperty("hard-link-executable");
if (hardLinkExecutable != null)
{
hardLinkExecutable = hardLinkExecutable.trim();
}
checkIntervalMillis = checkIntervalMillis =
Integer.parseInt(serviceProperties.getProperty("check-interval", Integer Integer.parseInt(serviceProperties.getProperty("check-interval", Integer
.toString(DEFAULT_CHECK_INTERVAL))) * 1000; .toString(DEFAULT_CHECK_INTERVAL))) * 1000;
...@@ -403,29 +422,29 @@ public class Parameters implements ITimingParameters, IFileSysParameters ...@@ -403,29 +422,29 @@ public class Parameters implements ITimingParameters, IFileSysParameters
.toString(DEFAULT_MAXIMAL_NUMBER_OF_RETRIES))); .toString(DEFAULT_MAXIMAL_NUMBER_OF_RETRIES)));
treatIncomingAsRemote = treatIncomingAsRemote =
Boolean.parseBoolean(serviceProperties.getProperty("treat-incoming-as-remote", Boolean Boolean.parseBoolean(serviceProperties.getProperty("treat-incoming-as-remote", Boolean
.toString(DEFAULT_TREAT_INCOMING_AS_REMOTE))); .toString(DEFAULT_TREAT_INCOMING_AS_REMOTE)).trim());
prefixForIncoming = serviceProperties.getProperty("prefix-for-incoming", ""); prefixForIncoming = serviceProperties.getProperty("prefix-for-incoming", "").trim();
if (serviceProperties.getProperty("incoming-dir") != null) if (serviceProperties.getProperty("incoming-dir") != null)
{ {
incomingDirectory = new File(serviceProperties.getProperty("incoming-dir")); incomingDirectory = new File(serviceProperties.getProperty("incoming-dir").trim());
} }
incomingHost = serviceProperties.getProperty("incoming-host"); incomingHost = serviceProperties.getProperty("incoming-host");
if (serviceProperties.getProperty("buffer-dir") != null) if (serviceProperties.getProperty("buffer-dir") != null)
{ {
bufferDirectory = new File(serviceProperties.getProperty("buffer-dir")); bufferDirectory = new File(serviceProperties.getProperty("buffer-dir").trim());
} }
if (serviceProperties.getProperty("manual-intervention-dir") != null) if (serviceProperties.getProperty("manual-intervention-dir") != null)
{ {
manualInterventionDirectoryOrNull = new File(serviceProperties.getProperty("manual-intervention-dir")); manualInterventionDirectoryOrNull = new File(serviceProperties.getProperty("manual-intervention-dir").trim());
} }
if (serviceProperties.getProperty("outgoing-dir") != null) if (serviceProperties.getProperty("outgoing-dir") != null)
{ {
outgoingDirectory = new File(serviceProperties.getProperty("outgoing-dir")); outgoingDirectory = new File(serviceProperties.getProperty("outgoing-dir").trim());
} }
outgoingHost = serviceProperties.getProperty("outgoing-host"); outgoingHost = serviceProperties.getProperty("outgoing-host");
if (serviceProperties.getProperty("extra-copy-dir") != null) if (serviceProperties.getProperty("extra-copy-dir") != null)
{ {
extraCopyDirectory = new File(serviceProperties.getProperty("extra-copy-dir")); extraCopyDirectory = new File(serviceProperties.getProperty("extra-copy-dir").trim());
} }
if (serviceProperties.getProperty("cleansing-regex") != null) if (serviceProperties.getProperty("cleansing-regex") != null)
{ {
......
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