use of org.apache.hadoop.tools.proto.GetUserMappingsProtocolProtos.GetGroupsForUserResponseProto in project hadoop by apache.
the class GetUserMappingsProtocolClientSideTranslatorPB method getGroupsForUser.
@Override
public String[] getGroupsForUser(String user) throws IOException {
GetGroupsForUserRequestProto request = GetGroupsForUserRequestProto.newBuilder().setUser(user).build();
GetGroupsForUserResponseProto resp;
try {
resp = rpcProxy.getGroupsForUser(NULL_CONTROLLER, request);
} catch (ServiceException se) {
throw ProtobufHelper.getRemoteException(se);
}
return resp.getGroupsList().toArray(new String[resp.getGroupsCount()]);
}
use of org.apache.hadoop.tools.proto.GetUserMappingsProtocolProtos.GetGroupsForUserResponseProto in project hadoop by apache.
the class GetUserMappingsProtocolServerSideTranslatorPB method getGroupsForUser.
@Override
public GetGroupsForUserResponseProto getGroupsForUser(RpcController controller, GetGroupsForUserRequestProto request) throws ServiceException {
String[] groups;
try {
groups = impl.getGroupsForUser(request.getUser());
} catch (IOException e) {
throw new ServiceException(e);
}
GetGroupsForUserResponseProto.Builder builder = GetGroupsForUserResponseProto.newBuilder();
for (String g : groups) {
builder.addGroups(g);
}
return builder.build();
}
Aggregations