web_backend_develope
wu ming 9 years ago
parent 5b7257719b
commit 939f2a0de3

1
.gitignore vendored

@ -0,0 +1 @@
*.class

@ -1,6 +1,8 @@
package com.platform.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -14,9 +16,13 @@ import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.platform.entities.FolderNode;
import com.platform.entities.PagerOptions;
import com.platform.service.DataInfoService;
import com.platform.service.OracleStatusService;
import com.platform.test.Brick;
import com.platform.test.FolderReader;
import com.platform.test.Volume;
import com.platform.utils.Configs;
import com.platform.utils.UtilsHelper;
@ -92,8 +98,18 @@ public class DataModelController {
}
@RequestMapping("/getFolder")
public void getFolder(HttpServletRequest res, HttpServletResponse req) {
System.out.println("ooooooooo");
@RequestMapping("/volume/list")
@ResponseBody
public Volume getFolder(HttpServletRequest res, HttpServletResponse req) {
System.out.println("get Request");
Brick brick1 = new Brick("192.168.0.101", "D:/bootstrap");
Brick brick2 = new Brick("192.168.0.103", "D:\book");
List<Brick> bricks = new ArrayList<Brick>();
bricks.add(brick1);
bricks.add(brick2);
List<FolderNode> folderNodes = new ArrayList<>();
folderNodes.add(FolderReader.reader("D:/bootstrap"));
Volume volume = new Volume("volume", 1555551024, 153561024, bricks, folderNodes);
return volume;
}
}

@ -5,11 +5,18 @@ import java.util.List;
public class FolderNode {
private String name;
private String path;
private List<FolderNode> childNodes;
private List<FolderNode> childNodes;
public FolderNode(String name, String path, List<FolderNode> childNodes) {
super();
this.name = name;
this.path = path;
this.childNodes = childNodes;
}
public String getName() {
return name;
}
}
public void setName(String name) {
this.name = name;

@ -0,0 +1,26 @@
package com.platform.test;
public class Brick {
private String ip;
private String path;
public Brick(String ip, String path) {
super();
this.ip = ip;
this.path = path;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
}

@ -0,0 +1,37 @@
package com.platform.test;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import com.platform.entities.FolderNode;
public class FolderReader {
public static FolderNode reader(String path) {
FolderNode folderNode = null;
File file = new File(path);
if (file.exists()) {
List<FolderNode> childrens = new ArrayList<FolderNode>();
if (file.isDirectory()) {
File[] files = file.listFiles();
for (int i = 0; i < files.length; i++) {
FolderNode children = reader(files[i].getAbsolutePath());
if (children != null)
childrens.add(children);
}
}
folderNode = new FolderNode(file.getName(), file.getAbsolutePath(),
childrens);
}
return folderNode;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
FolderReader folderReader = new FolderReader();
FolderNode folderNode = folderReader.reader("D:/bootstrap");
//folderReader.print(folderNode);
}
}

@ -0,0 +1,64 @@
package com.platform.test;
import java.util.List;
import com.platform.entities.FolderNode;
public class Volume {
private String name;
private long totalSize;
private long usedSize;
private List<Brick> bricks;
private List<FolderNode> folderNode;
public Volume(String volume, long totalSize, long usedSize,
List<Brick> bricks, List<FolderNode> folderNode) {
super();
this.name = volume;
this.totalSize = totalSize;
this.usedSize = usedSize;
this.bricks = bricks;
this.folderNode = folderNode;
}
public String getVolume() {
return name;
}
public void setVolume(String name) {
this.name = name;
}
public long getTotalSize() {
return totalSize;
}
public void setTotalSize(long totalSize) {
this.totalSize = totalSize;
}
public long getUsedSize() {
return usedSize;
}
public void setUsedSize(long usedSize) {
this.usedSize = usedSize;
}
public List<Brick> getBricks() {
return bricks;
}
public void setBricks(List<Brick> bricks) {
this.bricks = bricks;
}
public List<FolderNode> getFolderNode() {
return folderNode;
}
public void setFolderNode(List<FolderNode> folderNode) {
this.folderNode = folderNode;
}
}
Loading…
Cancel
Save