String resId = DefaultUserResource.getId(key);
ps = con.prepareStatement(props.getProperty("userNameQuery"));
ps.setString(1, resId);
rs = ps.executeQuery();
if (!rs.next()) {
throw new ResourceNotFoundException
("No user with id: " + resId);
}
return new DefaultUserResource (rasCtx, resId, rs.getString(1));
} else if (DefaultGroupResource.isValidKey(key)) {
String resId = DefaultGroupResource.getId(key);
ps = con.prepareStatement(props.getProperty("groupNameQuery"));
ps.setString(1, resId);
rs = ps.executeQuery();
if (!rs.next()) {
throw new ResourceNotFoundException
("No group with id: " + resId);
}
return new DefaultGroupResource (rasCtx, resId, rs.getString(1));
} else if (DefaultRoleResource.isValidKey(key)) {
String resId = DefaultRoleResource.getId(key);
ps = con.prepareStatement(props.getProperty("roleNameQuery"));
ps.setString(1, resId);
rs = ps.executeQuery();
if (!rs.next()) {
throw new ResourceNotFoundException
("No role with id: " + resId);
}
return new DefaultRoleResource (rasCtx, resId, rs.getString(1));
} else {
throw new IllegalArgumentException