new Object[]{keyFile, authRealmName}));
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
return;
}
// We have the right impl so let's try to remove one
FileRealm fr = null;
try {
realmsManager.createRealms(config);
//account for updates to realms from outside this config sharing
//same keyfile
CreateFileUser.refreshRealm(config.getName(), authRealmName);
fr = (FileRealm) realmsManager.getFromLoadedRealms(config.getName(),authRealmName);
if (fr == null) {
throw new NoSuchRealmException(authRealmName);
}
} catch(NoSuchRealmException e) {
report.setMessage(
localStrings.getLocalString(
"list.file.user.realmnotsupported",
"Configured file realm {0} is not supported.", authRealmName) +
" " + e.getLocalizedMessage());
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setFailureCause(e);
return;
}
try {
Enumeration users = fr.getUserNames();
List userList = new ArrayList();
while (users.hasMoreElements()) {
final ActionReport.MessagePart part = report.getTopMessagePart().addChild();
String userName = (String) users.nextElement();
part.setMessage(userName);
Map userMap = new HashMap();
userMap.put("name", userName);
try {
userMap.put("groups", Collections.list(fr.getGroupNames(userName)));
} catch (NoSuchUserException ex) {
// This should never be thrown since we just got the user name from the realm
}
userList.add(userMap);
}