Search in sources :

Example 1 with GetGroupsForUserResponseProto

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()]);
}
Also used : ServiceException(com.google.protobuf.ServiceException) GetGroupsForUserResponseProto(org.apache.hadoop.tools.proto.GetUserMappingsProtocolProtos.GetGroupsForUserResponseProto) GetGroupsForUserRequestProto(org.apache.hadoop.tools.proto.GetUserMappingsProtocolProtos.GetGroupsForUserRequestProto)

Example 2 with GetGroupsForUserResponseProto

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();
}
Also used : ServiceException(com.google.protobuf.ServiceException) GetGroupsForUserResponseProto(org.apache.hadoop.tools.proto.GetUserMappingsProtocolProtos.GetGroupsForUserResponseProto) IOException(java.io.IOException)

Aggregations

ServiceException (com.google.protobuf.ServiceException)2 GetGroupsForUserResponseProto (org.apache.hadoop.tools.proto.GetUserMappingsProtocolProtos.GetGroupsForUserResponseProto)2 IOException (java.io.IOException)1 GetGroupsForUserRequestProto (org.apache.hadoop.tools.proto.GetUserMappingsProtocolProtos.GetGroupsForUserRequestProto)1