-
Notifications
You must be signed in to change notification settings - Fork 72
Copy, Rename and delete FileAction #773
Conversation
qiyuangong
commented
Jul 25, 2017
- CopyFileAction
- RenameFileAction
- DeleteFileAction
* Modify ReadAction * CopyFileAction basic. * Finish single file copy. * Rename constant values.
Modify DeleteFileAction. Add RenameFileAction and DeleteFileAction to HdfsActionFactory.
| Configuration conf = new Configuration(); | ||
| //get FileSystem object | ||
| FileSystem fs = FileSystem.get(URI.create(filePath), conf); | ||
| if (!fs.exists(new Path(filePath))){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a blank before {
| } | ||
| appendLog( | ||
| String.format("Action starts at %s : Read %s", Utils.getFormatedCurrentTime(), srcPath)); | ||
| if (!dfsClient.exists(srcPath)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to check the existence of dstPath too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need more parameters from configuration/map. Will be done later.
| //get FileSystem object | ||
| FileSystem fs = FileSystem.get(URI.create(dest), conf); | ||
| return fs.rename(new Path(src), new Path(dest)); | ||
| } else if (!dest.startsWith("hdfs") && !src.startsWith("hdfs")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about the following case: dest prefixed with the default hdfs uri while src not, the two path are in the same cluster
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be done after url handler is finished.