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"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="D:/Program Files/apache-tomcat-7.0.70/lib/servlet-api.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>

@ -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<String, String> 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<FileOrFolder> 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<FileOrFolder> 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
*/

@ -108,16 +108,18 @@ public class SetVolume {
return -1;
}
String mountPoint = new VolumeInfo().getVolumeMountPoint(volumeName);
List<String> 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<String> reStrings=Constant.ganymedSSH.execCmdWaitAcquiescent(command);

@ -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 ";

Loading…
Cancel
Save