use of com.google.protobuf.ServiceException in project hadoop by apache.
the class ClientNamenodeProtocolServerSideTranslatorPB method createSnapshot.
@Override
public CreateSnapshotResponseProto createSnapshot(RpcController controller, CreateSnapshotRequestProto req) throws ServiceException {
try {
final CreateSnapshotResponseProto.Builder builder = CreateSnapshotResponseProto.newBuilder();
final String snapshotPath = server.createSnapshot(req.getSnapshotRoot(), req.hasSnapshotName() ? req.getSnapshotName() : null);
if (snapshotPath != null) {
builder.setSnapshotPath(snapshotPath);
}
return builder.build();
} catch (IOException e) {
throw new ServiceException(e);
}
}
use of com.google.protobuf.ServiceException in project hadoop by apache.
the class ClientNamenodeProtocolServerSideTranslatorPB method getEZForPath.
@Override
public GetEZForPathResponseProto getEZForPath(RpcController controller, GetEZForPathRequestProto req) throws ServiceException {
try {
GetEZForPathResponseProto.Builder builder = GetEZForPathResponseProto.newBuilder();
final EncryptionZone ret = server.getEZForPath(req.getSrc());
if (ret != null) {
builder.setZone(PBHelperClient.convert(ret));
}
return builder.build();
} catch (IOException e) {
throw new ServiceException(e);
}
}
use of com.google.protobuf.ServiceException in project hadoop by apache.
the class ClientNamenodeProtocolServerSideTranslatorPB method listEncryptionZones.
@Override
public ListEncryptionZonesResponseProto listEncryptionZones(RpcController controller, ListEncryptionZonesRequestProto req) throws ServiceException {
try {
BatchedEntries<EncryptionZone> entries = server.listEncryptionZones(req.getId());
ListEncryptionZonesResponseProto.Builder builder = ListEncryptionZonesResponseProto.newBuilder();
builder.setHasMore(entries.hasMore());
for (int i = 0; i < entries.size(); i++) {
builder.addZones(PBHelperClient.convert(entries.get(i)));
}
return builder.build();
} catch (IOException e) {
throw new ServiceException(e);
}
}
use of com.google.protobuf.ServiceException in project hadoop by apache.
the class ClientNamenodeProtocolServerSideTranslatorPB method updatePipeline.
@Override
public UpdatePipelineResponseProto updatePipeline(RpcController controller, UpdatePipelineRequestProto req) throws ServiceException {
try {
List<DatanodeIDProto> newNodes = req.getNewNodesList();
List<String> newStorageIDs = req.getStorageIDsList();
server.updatePipeline(req.getClientName(), PBHelperClient.convert(req.getOldBlock()), PBHelperClient.convert(req.getNewBlock()), PBHelperClient.convert(newNodes.toArray(new DatanodeIDProto[newNodes.size()])), newStorageIDs.toArray(new String[newStorageIDs.size()]));
return VOID_UPDATEPIPELINE_RESPONSE;
} catch (IOException e) {
throw new ServiceException(e);
}
}
use of com.google.protobuf.ServiceException in project hadoop by apache.
the class ClientNamenodeProtocolServerSideTranslatorPB method listCacheDirectives.
@Override
public ListCacheDirectivesResponseProto listCacheDirectives(RpcController controller, ListCacheDirectivesRequestProto request) throws ServiceException {
try {
CacheDirectiveInfo filter = PBHelperClient.convert(request.getFilter());
BatchedEntries<CacheDirectiveEntry> entries = server.listCacheDirectives(request.getPrevId(), filter);
ListCacheDirectivesResponseProto.Builder builder = ListCacheDirectivesResponseProto.newBuilder();
builder.setHasMore(entries.hasMore());
for (int i = 0, n = entries.size(); i < n; i++) {
builder.addElements(PBHelperClient.convert(entries.get(i)));
}
return builder.build();
} catch (IOException e) {
throw new ServiceException(e);
}
}
Aggregations