throws ResourceNotFoundException, RemoteException {
RmsConnection con = null;
try {
con = conFac.getConnection();
if (DefaultUserResource.isValidKey(key)) {
RmsEntry e = con.lookupResource(DefaultUserResource.getId(key));
return new DefaultUserResource(rasCtx, e.getKey(), e.getDisplayName());
} else if (DefaultRoleResource.isValidKey(key)) {
RmsEntry e = con.lookupResource(DefaultRoleResource.getId(key));
return new DefaultRoleResource(rasCtx, e.getKey(), e.getDisplayName());
} else if (DefaultGroupResource.isValidKey(key)) {
RmsEntry e
= con.lookupResource(DefaultGroupResource.getId(key));
return new DefaultGroupResource(rasCtx, e.getKey(), e.getDisplayName());
} else {
RmsEntry e = con.lookupResource (key);
return new DefaultResource(rasCtx, e.getKey(), e.getDisplayName());
}
} catch (ResourceException e) {
maybeMapToRemoteException (e);
throw new ResourceNotFoundException("Not found: " + e.getMessage());
} catch (NameNotFoundException e) {
throw new ResourceNotFoundException
("No entry with key \"" + key + "\" found: " + e.getMessage());
} finally {
closeConnection(con);
}
}