use of com.google.protobuf.ServiceException in project hadoop by apache.
the class ClientNamenodeProtocolTranslatorPB method createSnapshot.
@Override
public String createSnapshot(String snapshotRoot, String snapshotName) throws IOException {
final CreateSnapshotRequestProto.Builder builder = CreateSnapshotRequestProto.newBuilder().setSnapshotRoot(snapshotRoot);
if (snapshotName != null) {
builder.setSnapshotName(snapshotName);
}
final CreateSnapshotRequestProto req = builder.build();
try {
return rpcProxy.createSnapshot(null, req).getSnapshotPath();
} catch (ServiceException e) {
throw ProtobufHelper.getRemoteException(e);
}
}
use of com.google.protobuf.ServiceException in project hadoop by apache.
the class ClientNamenodeProtocolTranslatorPB method unsetErasureCodingPolicy.
@Override
public void unsetErasureCodingPolicy(String src) throws IOException {
final UnsetErasureCodingPolicyRequestProto.Builder builder = ErasureCodingProtos.UnsetErasureCodingPolicyRequestProto.newBuilder();
builder.setSrc(src);
UnsetErasureCodingPolicyRequestProto req = builder.build();
try {
rpcProxy.unsetErasureCodingPolicy(null, req);
} catch (ServiceException e) {
throw ProtobufHelper.getRemoteException(e);
}
}
use of com.google.protobuf.ServiceException in project hadoop by apache.
the class ClientNamenodeProtocolTranslatorPB method getEZForPath.
@Override
public EncryptionZone getEZForPath(String src) throws IOException {
final GetEZForPathRequestProto.Builder builder = GetEZForPathRequestProto.newBuilder();
builder.setSrc(src);
final GetEZForPathRequestProto req = builder.build();
try {
final EncryptionZonesProtos.GetEZForPathResponseProto response = rpcProxy.getEZForPath(null, req);
if (response.hasZone()) {
return PBHelperClient.convert(response.getZone());
} else {
return null;
}
} catch (ServiceException e) {
throw ProtobufHelper.getRemoteException(e);
}
}
use of com.google.protobuf.ServiceException in project hadoop by apache.
the class ClientNamenodeProtocolTranslatorPB method mkdirs.
@Override
public boolean mkdirs(String src, FsPermission masked, boolean createParent) throws IOException {
MkdirsRequestProto.Builder builder = MkdirsRequestProto.newBuilder().setSrc(src).setMasked(PBHelperClient.convert(masked)).setCreateParent(createParent);
FsPermission unmasked = masked.getUnmasked();
if (unmasked != null) {
builder.setUnmasked(PBHelperClient.convert(unmasked));
}
MkdirsRequestProto req = builder.build();
try {
return rpcProxy.mkdirs(null, req).getResult();
} catch (ServiceException e) {
throw ProtobufHelper.getRemoteException(e);
}
}
use of com.google.protobuf.ServiceException in project hadoop by apache.
the class ClientNamenodeProtocolTranslatorPB method setAcl.
@Override
public void setAcl(String src, List<AclEntry> aclSpec) throws IOException {
SetAclRequestProto req = SetAclRequestProto.newBuilder().setSrc(src).addAllAclSpec(PBHelperClient.convertAclEntryProto(aclSpec)).build();
try {
if (Client.isAsynchronousMode()) {
rpcProxy.setAcl(null, req);
setAsyncReturnValue();
} else {
rpcProxy.setAcl(null, req);
}
} catch (ServiceException e) {
throw ProtobufHelper.getRemoteException(e);
}
}
Aggregations