@Override
public Map.Entry<StringPredicate,UserAuthzInformation> accept(String line) {
line = line.trim();
if (line.isEmpty() || line.startsWith("#") || line.startsWith("version 2.")) {
return null;
}
Matcher matcher = USER_MAP_FILE_LINE_PATTERN.matcher(line);
try {
if (matcher.lookingAt()) {
final String key = matcher.group(UM_KEY_GROUP);
final String access = matcher.group(UM_ACCESS_GROUP);
final String uid = matcher.group(UM_UID_GROUP);
final long[] gids = toLongs(matcher.group(UM_GID_GROUP).split(","));
final String home = stripQuotes(matcher.group(UM_HOME_GROUP));
final String root = stripQuotes(matcher.group(UM_ROOT_GROUP));
final String fsroot = stripQuotes(matcher.group(UM_FS_ROOT_GROUP));
String maxUploadValue = matcher.group("maxupload");
OptionalLong maxUpload = maxUploadValue == null
? OptionalLong.empty()
: OptionalLong.of(ByteSizeParser.using(isoSymbol()).parse(maxUploadValue));
UserAuthzInformation info = new UserAuthzInformation(key, access,
Long.parseLong(uid), gids, home, root, fsroot, maxUpload);
return new SimpleImmutableEntry<>(new StringPredicate(key), info);
}
_log.warn("Ignored malformed line in AuthzDB-File: '{}'", line);
} catch (NumberFormatException e) {
_log.warn("Ignored malformed line '{}': {}", line, e.getMessage());
}
return null;
}