use of org.apache.hadoop.hdfs.protocol.proto.ClientNamenodeProtocolProtos.Rename2RequestProto in project hadoop by apache.
the class ClientNamenodeProtocolTranslatorPB method rename2.
@Override
public void rename2(String src, String dst, Rename... options) throws IOException {
boolean overwrite = false;
boolean toTrash = false;
if (options != null) {
for (Rename option : options) {
if (option == Rename.OVERWRITE) {
overwrite = true;
} else if (option == Rename.TO_TRASH) {
toTrash = true;
}
}
}
Rename2RequestProto req = Rename2RequestProto.newBuilder().setSrc(src).setDst(dst).setOverwriteDest(overwrite).setMoveToTrash(toTrash).build();
try {
if (Client.isAsynchronousMode()) {
rpcProxy.rename2(null, req);
setAsyncReturnValue();
} else {
rpcProxy.rename2(null, req);
}
} catch (ServiceException e) {
throw ProtobufHelper.getRemoteException(e);
}
}
Aggregations