validatePath(source, true);
validatePath(target, false);
FileSystem fs = getFileSystemFor(source, context);
if (!fs.exists(source) && !recovery) {
throw new ActionExecutorException(ActionExecutorException.ErrorType.ERROR, "FS006",
"move, source path [{0}] does not exist", source);
}
Path path = new Path(source, target);
if (fs.exists(path) && !recovery) {
throw new ActionExecutorException(ActionExecutorException.ErrorType.ERROR, "FS007",
"move, target path [{0}] already exists", target);
}
if (!fs.rename(source, target) && !recovery) {
throw new ActionExecutorException(ActionExecutorException.ErrorType.ERROR, "FS008",
"move, could not move [{0}] to [{1}]", source, target);
}
}
catch (Exception ex) {
throw convertException(ex);