Skip to content
Snippets Groups Projects
Commit ee1cab36 authored by felmer's avatar felmer
Browse files

LMS-1506 new factory method

SVN: 15762
parent 555c0f08
No related branches found
No related tags found
No related merge requests found
......@@ -114,6 +114,22 @@ public final class HostAwareFileWithHighwaterMark extends HostAwareFile
assert properties != null : "Unspecified properties";
assert StringUtils.isNotBlank(hostFilePropertyKey) : "Host-file property key is blank";
final String hostFile = PropertyUtils.getMandatoryProperty(properties, hostFilePropertyKey);
final long highwaterMarkInKb =
PropertyUtils.getLong(properties, hostFilePropertyKey.concat(SEP).concat(
HIGHWATER_MARK_PROPERTY_KEY), -1L);
return create(hostFile, highwaterMarkInKb);
}
/**
* Instantiates a new <code>FileWithHighwaterMark</code> from specified host file and
* high-water mark.
*
* @param hostFile Either a local file or remote file in SSH notation (i.e. <host>:<path>).
* @param highwaterMarkInKb -1 means no checking for high water.
*/
public static HostAwareFileWithHighwaterMark create(final String hostFile,
final long highwaterMarkInKb)
{
File file;
String hostNameOrNull = null;
final int index = hostFile.indexOf(HOST_FILE_SEP);
......@@ -136,9 +152,6 @@ public final class HostAwareFileWithHighwaterMark extends HostAwareFile
rsyncModuleOrNull = null;
file = getCanonicalFile(hostFile);
}
final long highwaterMarkInKb =
PropertyUtils.getLong(properties, hostFilePropertyKey.concat(SEP).concat(
HIGHWATER_MARK_PROPERTY_KEY), -1L);
return new HostAwareFileWithHighwaterMark(hostNameOrNull, file, rsyncModuleOrNull,
highwaterMarkInKb);
}
......
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