use of com.google.protobuf.ServiceException 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();
}
use of com.google.protobuf.ServiceException in project hadoop by apache.
the class ProtocolMetaInfoServerSideTranslatorPB method getProtocolSignature.
@Override
public GetProtocolSignatureResponseProto getProtocolSignature(RpcController controller, GetProtocolSignatureRequestProto request) throws ServiceException {
GetProtocolSignatureResponseProto.Builder builder = GetProtocolSignatureResponseProto.newBuilder();
String protocol = request.getProtocol();
String rpcKind = request.getRpcKind();
long[] versions;
try {
versions = getProtocolVersionForRpcKind(RPC.RpcKind.valueOf(rpcKind), protocol);
} catch (ClassNotFoundException e1) {
throw new ServiceException(e1);
}
if (versions == null) {
return builder.build();
}
for (long v : versions) {
ProtocolSignatureProto.Builder sigBuilder = ProtocolSignatureProto.newBuilder();
sigBuilder.setVersion(v);
try {
ProtocolSignature signature = ProtocolSignature.getProtocolSignature(protocol, v);
for (int m : signature.getMethods()) {
sigBuilder.addMethods(m);
}
} catch (ClassNotFoundException e) {
throw new ServiceException(e);
}
builder.addProtocolSignature(sigBuilder.build());
}
return builder.build();
}
use of com.google.protobuf.ServiceException in project hadoop by apache.
the class ProtocolMetaInfoServerSideTranslatorPB method getProtocolVersions.
@Override
public GetProtocolVersionsResponseProto getProtocolVersions(RpcController controller, GetProtocolVersionsRequestProto request) throws ServiceException {
String protocol = request.getProtocol();
GetProtocolVersionsResponseProto.Builder builder = GetProtocolVersionsResponseProto.newBuilder();
for (RPC.RpcKind r : RPC.RpcKind.values()) {
long[] versions;
try {
versions = getProtocolVersionForRpcKind(r, protocol);
} catch (ClassNotFoundException e) {
throw new ServiceException(e);
}
ProtocolVersionProto.Builder b = ProtocolVersionProto.newBuilder();
if (versions != null) {
b.setRpcKind(r.toString());
for (long v : versions) {
b.addVersions(v);
}
}
builder.addProtocolVersions(b.build());
}
return builder.build();
}
use of com.google.protobuf.ServiceException in project hadoop by apache.
the class GenericRefreshProtocolServerSideTranslatorPB method refresh.
@Override
public GenericRefreshResponseCollectionProto refresh(RpcController controller, GenericRefreshRequestProto request) throws ServiceException {
try {
List<String> argList = request.getArgsList();
String[] args = argList.toArray(new String[argList.size()]);
if (!request.hasIdentifier()) {
throw new ServiceException("Request must contain identifier");
}
Collection<RefreshResponse> results = impl.refresh(request.getIdentifier(), args);
return pack(results);
} catch (IOException e) {
throw new ServiceException(e);
}
}
use of com.google.protobuf.ServiceException in project hadoop by apache.
the class HAServiceProtocolClientSideTranslatorPB method transitionToStandby.
@Override
public void transitionToStandby(StateChangeRequestInfo reqInfo) throws IOException {
try {
TransitionToStandbyRequestProto req = TransitionToStandbyRequestProto.newBuilder().setReqInfo(convert(reqInfo)).build();
rpcProxy.transitionToStandby(NULL_CONTROLLER, req);
} catch (ServiceException e) {
throw ProtobufHelper.getRemoteException(e);
}
}
Aggregations