fix get Tree data

glusterfs-api
lily 9 years ago
parent c4b345c6a2
commit 150437e97c

@ -14,5 +14,6 @@
<attribute name="owner.project.facets" value="java"/> <attribute name="owner.project.facets" value="java"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="lib" path="D:/Program Files/apache-tomcat-7.0.70/lib/servlet-api.jar"/>
<classpathentry kind="output" path="build/classes"/> <classpathentry kind="output" path="build/classes"/>
</classpath> </classpath>

@ -5,9 +5,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.log4j.PropertyConfigurator;
import org.junit.Test; import org.junit.Test;
import org.springframework.stereotype.Service;
import com.platform.entities.FolderNode; import com.platform.entities.FolderNode;
@ -30,7 +28,10 @@ public class GetTreeData {
* @see [##] * @see [##]
*/ */
public FolderNode getDatas(String name) { 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<String, String> files = showData.showFolderData(name); Map<String, String> files = showData.showFolderData(name);
if(files==null || files.size()==0){ if(files==null || files.size()==0){
return fileNode; return fileNode;
@ -55,28 +56,30 @@ public class GetTreeData {
return fileNode; return fileNode;
} }
// public static void main(String[] args) { @Test
// GetTreeData getTreeData=new GetTreeData(); public void test_getTreeData() {
// FileOrFolder fileOrFolder=getTreeData.getDatas("/home");
// System.out.println(fileOrFolder); 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<FileOrFolder> children;
public FileOrFolder(String name) {
// TODO Auto-generated constructor stub
this.name = name;
}
//class FileOrFolder { public FileOrFolder(String name, int isFolder) {
// String name; // TODO Auto-generated constructor stub
// int isFolder; // 1 is file and other integer is folder show children number this.name = name;
// List<FileOrFolder> children; this.isFolder = isFolder;
// }
// 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;
// }
//}
>>>>>>> 26f098b74e2941e68d0a85c1b9d580a28ed2ac41 */

@ -108,16 +108,18 @@ public class SetVolume {
return -1; return -1;
} }
String mountPoint = new VolumeInfo().getVolumeMountPoint(volumeName); List<String> mountPoints = new VolumeInfo().getVolumeMountPoint(volumeName);
if (stopVolume(volumeName) != 0) { if (stopVolume(volumeName) != 0) {
log.error("3802 " + volumeName + " stop failed !"); log.error("3802 " + volumeName + " stop failed !");
return -2; return -2;
} }
log.info("stop "+volumeName+" successed!"); log.info("stop "+volumeName+" successed!");
if (mountPoint != null) { for(String mountPoint:mountPoints){
String command = "umount " + mountPoint; if (mountPoint != null) {
String command = "umount -l " + mountPoint;
Constant.ganymedSSH.execCmdNoWaitAcquiescent(command); Constant.ganymedSSH.execCmdNoWaitAcquiescent(command);
log.info("umount "+mountPoint+" successed!"); log.info("umount "+mountPoint+" successed!");
}
} }
String command="echo -e \"y\"| gluster volume delete "+volumeName; String command="echo -e \"y\"| gluster volume delete "+volumeName;
List<String> reStrings=Constant.ganymedSSH.execCmdWaitAcquiescent(command); List<String> reStrings=Constant.ganymedSSH.execCmdWaitAcquiescent(command);

@ -6,6 +6,7 @@ public class Constant {
public static String rootUser = "root"; public static String rootUser = "root";
public static String rootPasswd = "root"; public static String rootPasswd = "root";
public static String hostIp = "192.168.0.116"; public static String hostIp = "192.168.0.116";
// public static String hostIp = "192.168.1.105";
public static int port = 22; public static int port = 22;
public static String glusterPeerStatus = "gluster peer status"; public static String glusterPeerStatus = "gluster peer status";
public static String glusterVolumeInfo = "gluster volume info "; public static String glusterVolumeInfo = "gluster volume info ";

Loading…
Cancel
Save