From 150437e97c0257dea5f9bcb7ee43c95cd9f975b7 Mon Sep 17 00:00:00 2001 From: lily Date: Sun, 11 Sep 2016 14:44:04 +0800 Subject: [PATCH] fix get Tree data --- .classpath | 1 + .../controller/DefaultController.class | Bin 1342 -> 1423 bytes src/com/platform/glusterfs/GetTreeData.java | 53 +++++++++--------- src/com/platform/glusterfs/SetVolume.java | 10 ++-- src/com/platform/utils/Constant.java | 1 + 5 files changed, 36 insertions(+), 29 deletions(-) diff --git a/.classpath b/.classpath index b6aa469c..63b90724 100644 --- a/.classpath +++ b/.classpath @@ -14,5 +14,6 @@ + diff --git a/build/classes/com/platform/controller/DefaultController.class b/build/classes/com/platform/controller/DefaultController.class index 41222a99266a9cc5a59dc9a86d9017d8f3d0e444..e9becdfc9b5581d13287478dc3f0a9ad048a08d2 100644 GIT binary patch delta 179 zcmdnT)z2+(>ff$?3=9m$43_K+OpFYg6BlZ3wA{nQSTyl|8c%7azHfd?YL0JWf%Rk$ z=6E)C1`|dG`N@WiA_7QqTtMxdlb17hG4f3|Vu@uHX5e5DnLLHXT`HJ?iGdktyx=AV zkxdM`+ZbeaGZ;s1XE5C``5lYAp&$bf120e-sDMF@L7jmS%+g@c1ZrbqFaz?K7|a<2 MfHWIW&Vqpf0R8tP>i_@% delta 133 zcmeC@-p3_y>ff$?3=9m$3});MOpFYg6BlZ3wA{nQ7&P&IAY<6%4CeUBADO!tc_-Jf z#Ig!8a4-l@zQ^J&?8Csszzo#KwTVGw6NBzH2APeM?OEjwxfpmDc!AfeVGsb)Y(P0v1_l6mrWfM? diff --git a/src/com/platform/glusterfs/GetTreeData.java b/src/com/platform/glusterfs/GetTreeData.java index df951cd7..48b2ff05 100644 --- a/src/com/platform/glusterfs/GetTreeData.java +++ b/src/com/platform/glusterfs/GetTreeData.java @@ -5,9 +5,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import org.apache.log4j.PropertyConfigurator; import org.junit.Test; -import org.springframework.stereotype.Service; import com.platform.entities.FolderNode; @@ -30,7 +28,10 @@ public class GetTreeData { * @see [类、类#方法、类#成员] */ public FolderNode getDatas(String name) { - FolderNode fileNode = new FolderNode(name); + String names[]=name.split("/"); + String only_name=names[names.length-1]; + FolderNode fileNode = new FolderNode(only_name); + Map files = showData.showFolderData(name); if(files==null || files.size()==0){ return fileNode; @@ -55,28 +56,30 @@ public class GetTreeData { return fileNode; } -// public static void main(String[] args) { -// GetTreeData getTreeData=new GetTreeData(); -// FileOrFolder fileOrFolder=getTreeData.getDatas("/home"); -// System.out.println(fileOrFolder); -// } + @Test + public void test_getTreeData() { + + GetTreeData getTreeData=new GetTreeData(); + FolderNode fileOrFolder=getTreeData.getDatas("/home"); + System.out.println(fileOrFolder); + } } +/* +class FileOrFolder { + String name; + int isFolder; // 1 is file and other integer is folder show children number + List children; + + public FileOrFolder(String name) { + // TODO Auto-generated constructor stub + this.name = name; + } -//class FileOrFolder { -// String name; -// int isFolder; // 1 is file and other integer is folder show children number -// List children; -// -// public FileOrFolder(String name) { -// // TODO Auto-generated constructor stub -// this.name = name; -// } -// -// public FileOrFolder(String name, int isFolder) { -// // TODO Auto-generated constructor stub -// this.name = name; -// this.isFolder = isFolder; -// } -//} + public FileOrFolder(String name, int isFolder) { + // TODO Auto-generated constructor stub + this.name = name; + this.isFolder = isFolder; + } +} ->>>>>>> 26f098b74e2941e68d0a85c1b9d580a28ed2ac41 +*/ diff --git a/src/com/platform/glusterfs/SetVolume.java b/src/com/platform/glusterfs/SetVolume.java index d6be2d41..0ea02c92 100644 --- a/src/com/platform/glusterfs/SetVolume.java +++ b/src/com/platform/glusterfs/SetVolume.java @@ -108,16 +108,18 @@ public class SetVolume { return -1; } - String mountPoint = new VolumeInfo().getVolumeMountPoint(volumeName); + List mountPoints = new VolumeInfo().getVolumeMountPoint(volumeName); if (stopVolume(volumeName) != 0) { log.error("3802 " + volumeName + " stop failed !"); return -2; } log.info("stop "+volumeName+" successed!"); - if (mountPoint != null) { - String command = "umount " + mountPoint; + for(String mountPoint:mountPoints){ + if (mountPoint != null) { + String command = "umount -l " + mountPoint; Constant.ganymedSSH.execCmdNoWaitAcquiescent(command); - log.info("umount "+mountPoint+" successed!"); + log.info("umount "+mountPoint+" successed!"); + } } String command="echo -e \"y\"| gluster volume delete "+volumeName; List reStrings=Constant.ganymedSSH.execCmdWaitAcquiescent(command); diff --git a/src/com/platform/utils/Constant.java b/src/com/platform/utils/Constant.java index 59c2b5ce..0a72c14d 100644 --- a/src/com/platform/utils/Constant.java +++ b/src/com/platform/utils/Constant.java @@ -6,6 +6,7 @@ public class Constant { public static String rootUser = "root"; public static String rootPasswd = "root"; public static String hostIp = "192.168.0.116"; +// public static String hostIp = "192.168.1.105"; public static int port = 22; public static String glusterPeerStatus = "gluster peer status"; public static String glusterVolumeInfo = "gluster volume info ";