Search in sources :

Example 1 with RenameRequest

use of com.obs.services.model.fs.RenameRequest in project alluxio by Alluxio.

the class OBSUnderFileSystem method renameDirectory.

@Override
public boolean renameDirectory(String src, String dst) throws IOException {
    if (!isEnvironmentPFS()) {
        return super.renameDirectory(src, dst);
    }
    try {
        RenameRequest request = new RenameRequest(mBucketName, stripPrefixIfPresent(src), stripPrefixIfPresent(dst));
        RenameResult response = mClient.renameFolder(request);
        if (isSuccessResponse(response.getStatusCode())) {
            return true;
        } else {
            LOG.error("Failed to rename directory from {} to {}.", src, dst);
            return false;
        }
    } catch (ObsException e) {
        LOG.error("Failed to rename directory from {} to {}.", src, dst, e);
        return false;
    }
}
Also used : ObsException(com.obs.services.exception.ObsException) RenameRequest(com.obs.services.model.fs.RenameRequest) RenameResult(com.obs.services.model.fs.RenameResult)

Aggregations

ObsException (com.obs.services.exception.ObsException)1 RenameRequest (com.obs.services.model.fs.RenameRequest)1 RenameResult (com.obs.services.model.fs.RenameResult)1