我想设计一个web项目,当用户上传文件到hadoop hdfs时,用户可以通过web看到他们的上传状态。有没有简单的java api?
任何人都可以帮忙吗?
现在我只知道方法,如何使用api将文件上传到hdfs。
public synchronized static void upload(FileSystem fs, String local,
String remote) {
// Path home = fs.getHomeDirectory();
Path workDir = fs.getWorkingDirectory();
Path dst = new Path(workDir + "/" + remote);
Path src = new Path(local);
try {
fs.copyFromLocalFile(false, true, src, dst);
log.info("upload " + local + " to " + remote + " successed. ");
} catch (Exception e) {
log.error("upload " + local + " to " + remote + " failed :"
+ ExceptionUtils.getFullStackTrace(e));
}
}