if (debug >= 1) {
log("roles: List security roles from user database");
}
// Look up the UserDatabase instance we should use
UserDatabase database = null;
try {
InitialContext ic = new InitialContext();
database = (UserDatabase) ic.lookup("java:comp/env/users");
} catch (NamingException e) {
writer.println(sm.getString("managerServlet.userDatabaseError"));
log("java:comp/env/users", e);
return;
}
if (database == null) {
writer.println(sm.getString("managerServlet.userDatabaseMissing"));
return;
}
// Enumerate the available roles
writer.println(sm.getString("managerServlet.rolesList"));
Iterator roles = database.getRoles();
if (roles != null) {
while (roles.hasNext()) {
Role role = (Role) roles.next();
writer.print(role.getRolename());
writer.print(':');