jiapeng 6 years ago
parent
commit
7b75ca660b

+ 6 - 6
src/main/java/com/ekexiu/project/hdfs/HdfsService.java

12
//	private Configuration configuration = new Configuration();
12
//	private Configuration configuration = new Configuration();
13
//	private DistributedFileSystem dfs;
13
//	private DistributedFileSystem dfs;
14
//	private Path root = new Path("/");
14
//	private Path root = new Path("/");
15
//	private String remoteUrl;
15
	private String remoteUrl;
16
//	
16
//	
17
//
17
//
18
//
18
//
20
//		this.root = new Path(rootPath);
20
//		this.root = new Path(rootPath);
21
//	}
21
//	}
22
//	
22
//	
23
//	public String getRemoteUrl() {
24
//		return remoteUrl;
25
//	}
23
	public String getRemoteUrl() {
24
		return remoteUrl;
25
	}
26
//
26
//
27
//
27
//
28
//	public void setRemoteUrl(String remoteUrl) {
28
	public void setRemoteUrl(String remoteUrl) {
29
//		System.setProperty("HADOOP_USER_NAME", "hadoop");
29
//		System.setProperty("HADOOP_USER_NAME", "hadoop");
30
//		this.remoteUrl = remoteUrl;
30
//		this.remoteUrl = remoteUrl;
31
//		configuration.set("fs.default.name", this.remoteUrl);
31
//		configuration.set("fs.default.name", this.remoteUrl);
35
//		} catch (IOException e) {
35
//		} catch (IOException e) {
36
//			throw new RuntimeException(e);
36
//			throw new RuntimeException(e);
37
//		}
37
//		}
38
//	}
38
	}
39
	
39
	
40
	public void upload(String path,File src) throws IOException{
40
	public void upload(String path,File src) throws IOException{
41
//		byte[] buffer = new byte[8192];
41
//		byte[] buffer = new byte[8192];

+ 3 - 3
src/main/java/com/ekexiu/project/storage/diacrisis/AiTaskService.java

241
	   
241
	   
242
	   for(String f:file){
242
	   for(String f:file){
243
		   int idx = f.indexOf('.');
243
		   int idx = f.indexOf('.');
244
		   if(idx!=16){
244
		   if(idx!=32){
245
			   throw new IllegalArgumentException("invalid param file");
245
			   throw new IllegalArgumentException("invalid param file");
246
		   }
246
		   }
247
		   File taskSrc = new File(this.uploadPath,f.substring(0,16));
248
		   File taskDst = new File(path,f.substring(17));
247
		   File taskSrc = new File(this.uploadPath,f.substring(0,32));
248
		   File taskDst = new File(path,f.substring(33));
249
		   InputStream in = new FileInputStream(taskSrc);
249
		   InputStream in = new FileInputStream(taskSrc);
250
		   try{
250
		   try{
251
			  OutputStream os = new FileOutputStream(taskDst) ;
251
			  OutputStream os = new FileOutputStream(taskDst) ;