parent
8e67ef81b5
commit
ea3a1966e5
@ -1,13 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="owner.project.facets" value="java"/>
|
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="D:/git_gfs/aggregation-platform/WebContent/WEB-INF/lib"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
|
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||||
<classpathentry kind="output" path="WebRoot/WEB-INF/classes"/>
|
<classpathentry kind="output" path="WebContent/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
@ -1,36 +1,36 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<projectDescription>
|
<projectDescription>
|
||||||
<name>jfinal-demo</name>
|
<name>jfinal-demo</name>
|
||||||
<comment></comment>
|
<comment></comment>
|
||||||
<projects>
|
<projects>
|
||||||
</projects>
|
</projects>
|
||||||
<buildSpec>
|
<buildSpec>
|
||||||
<buildCommand>
|
<buildCommand>
|
||||||
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
|
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
|
||||||
<arguments>
|
<arguments>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
<buildCommand>
|
<buildCommand>
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
<arguments>
|
<arguments>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
<buildCommand>
|
<buildCommand>
|
||||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||||
<arguments>
|
<arguments>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
<buildCommand>
|
<buildCommand>
|
||||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||||
<arguments>
|
<arguments>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
</buildSpec>
|
</buildSpec>
|
||||||
<natures>
|
<natures>
|
||||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
|
||||||
</natures>
|
</natures>
|
||||||
</projectDescription>
|
</projectDescription>
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||||
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.source=1.7
|
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project-modules id="moduleCoreId" project-version="1.5.0">
|
||||||
|
<wb-module deploy-name="jfinal-demo">
|
||||||
|
<wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
|
||||||
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
|
||||||
|
<property name="context-root" value="jfinal-demo"/>
|
||||||
|
<property name="java-output-path" value="/jfinal-demo/WebContent/WEB-INF/classes"/>
|
||||||
|
</wb-module>
|
||||||
|
</project-modules>
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<faceted-project>
|
||||||
|
<fixed facet="wst.jsdt.web"/>
|
||||||
|
<installed facet="java" version="1.7"/>
|
||||||
|
<installed facet="jst.web" version="3.0"/>
|
||||||
|
<installed facet="wst.jsdt.web" version="1.0"/>
|
||||||
|
</faceted-project>
|
@ -1,3 +1,3 @@
|
|||||||
Manifest-Version: 1.0
|
Manifest-Version: 1.0
|
||||||
Class-Path:
|
Class-Path:
|
||||||
|
|
@ -0,0 +1 @@
|
|||||||
|
/com
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,31 +1,31 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns="http://java.sun.com/xml/ns/javaee"
|
xmlns="http://java.sun.com/xml/ns/javaee"
|
||||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
|
||||||
id="WebApp_ID" version="3.0">
|
id="WebApp_ID" version="3.0">
|
||||||
<display-name>jfinal-demo</display-name>
|
<display-name>JFinal-demo</display-name>
|
||||||
<welcome-file-list>
|
<welcome-file-list>
|
||||||
<welcome-file>index.html</welcome-file>
|
<welcome-file>index.html</welcome-file>
|
||||||
<welcome-file>index.htm</welcome-file>
|
<welcome-file>index.htm</welcome-file>
|
||||||
<welcome-file>index.jsp</welcome-file>
|
<welcome-file>index.jsp</welcome-file>
|
||||||
<welcome-file>default.html</welcome-file>
|
<welcome-file>default.html</welcome-file>
|
||||||
<welcome-file>default.htm</welcome-file>
|
<welcome-file>default.htm</welcome-file>
|
||||||
<welcome-file>default.jsp</welcome-file>
|
<welcome-file>default.jsp</welcome-file>
|
||||||
</welcome-file-list>
|
</welcome-file-list>
|
||||||
|
|
||||||
<!-- 添加至 web.xml 1.4 添加 java文件 在项目 src 目录下创建 com.platform.config 包,并在 包下创建 JfinalConfig
|
<!-- 添加至 web.xml 1.4 添加 java文件 在项目 src 目录下创建 com.platform.config 包,并在 包下创建 JfinalConfig
|
||||||
文件, -->
|
文件, -->
|
||||||
<filter>
|
<filter>
|
||||||
<filter-name>jfinalF</filter-name>
|
<filter-name>jfinalF</filter-name>
|
||||||
<filter-class>com.jfinal.core.JFinalFilter</filter-class>
|
<filter-class>com.jfinal.core.JFinalFilter</filter-class>
|
||||||
<init-param>
|
<init-param>
|
||||||
<param-name>configClass</param-name>
|
<param-name>configClass</param-name>
|
||||||
<param-value>com.platform.config.JfinalConfig</param-value>
|
<param-value>com.platform.config.JfinalConfig</param-value>
|
||||||
</init-param>
|
</init-param>
|
||||||
</filter>
|
</filter>
|
||||||
<filter-mapping>
|
<filter-mapping>
|
||||||
<filter-name>jfinalF</filter-name>
|
<filter-name>jfinalF</filter-name>
|
||||||
<url-pattern>/*</url-pattern>
|
<url-pattern>/*</url-pattern>
|
||||||
</filter-mapping>
|
</filter-mapping>
|
||||||
|
|
||||||
</web-app>
|
</web-app>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,53 +1,63 @@
|
|||||||
package com.platform.controller;
|
package com.platform.controller;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
import net.sf.json.JSONObject;
|
|
||||||
|
import net.sf.json.JSONArray;
|
||||||
import com.jfinal.core.Controller;
|
import net.sf.json.JSONObject;
|
||||||
import com.platform.entities.FolderNode;
|
|
||||||
import com.platform.entities.VolumeEntity;
|
import com.alibaba.druid.util.DaemonThreadFactory;
|
||||||
import com.platform.utils.CacheTreeData;
|
import com.jfinal.core.Controller;
|
||||||
import com.platform.utils.getTreeDataByPath;
|
import com.platform.entities.FolderNode;
|
||||||
|
import com.platform.entities.VolumeEntity;
|
||||||
public class GfsController extends Controller {
|
import com.platform.utils.CacheTreeData;
|
||||||
|
import com.platform.utils.ThreadVolume;
|
||||||
/** gfs目录树形查询 */
|
import com.platform.utils.getTreeDataByPath;
|
||||||
private getTreeDataByPath getFolder = new getTreeDataByPath();
|
|
||||||
|
public class GfsController extends Controller {
|
||||||
/**
|
|
||||||
* 首页-"/gfs"下没有匹配到的路径时的请求方法
|
/** gfs目录树形查询 */
|
||||||
*/
|
private getTreeDataByPath getFolder = new getTreeDataByPath();
|
||||||
public void index() {
|
|
||||||
renderText("hello gfs !");
|
/**
|
||||||
}
|
* 首页-"/gfs"下没有匹配到的路径时的请求方法
|
||||||
|
*/
|
||||||
public void getAllvolume(){
|
public void index() {
|
||||||
|
renderText("hello gfs !");
|
||||||
List<VolumeEntity> volumeList = CacheTreeData.getVolumeList();
|
}
|
||||||
if (null == volumeList) {
|
|
||||||
JSONObject jsondata = JSONObject.fromObject(new ArrayList<VolumeEntity>());
|
public void getAllvolume(){
|
||||||
renderJson(jsondata.toString());
|
Date a = new Date();
|
||||||
}
|
//查询volume信息
|
||||||
for (VolumeEntity volume : volumeList) {
|
new ThreadVolume().getVolumeMsg();
|
||||||
if (null != volume.getPath()) {
|
//获得volume信息
|
||||||
// 获得 folder 目录
|
List<VolumeEntity> volumeList = CacheTreeData.getVolumeList();
|
||||||
List<FolderNode> list = new ArrayList<FolderNode>();
|
if (null == volumeList) {
|
||||||
FolderNode currNode = getFolder(volume.getPath());
|
JSONObject jsondata = JSONObject.fromObject(new ArrayList<VolumeEntity>());
|
||||||
if (null != currNode && null != currNode.getChildNodes()) {
|
renderJson(jsondata.toString());
|
||||||
list.addAll(currNode.getChildNodes());
|
}
|
||||||
}
|
for (VolumeEntity volume : volumeList) {
|
||||||
volume.setFolder(list);
|
if (null != volume.getPath()) {
|
||||||
}
|
// 获得 folder 目录
|
||||||
}
|
List<FolderNode> list = new ArrayList<FolderNode>();
|
||||||
JSONObject jsondata = JSONObject.fromObject(volumeList);
|
FolderNode currNode = getFolder(volume.getPath());
|
||||||
renderJson(jsondata.toString());
|
if (null != currNode && null != currNode.getChildNodes()) {
|
||||||
}
|
list.addAll(currNode.getChildNodes());
|
||||||
|
}
|
||||||
public FolderNode getFolder(String path) {
|
volume.setFolder(list);
|
||||||
FolderNode result = getFolder.findByPath(path);
|
}
|
||||||
return result;
|
}
|
||||||
}
|
List<FolderNode> folList = CacheTreeData.getFolders();
|
||||||
|
JSONArray jsondata = JSONArray.fromObject(volumeList);
|
||||||
}
|
JSONArray jsonfold = JSONArray.fromObject(folList);
|
||||||
|
Date b = new Date();
|
||||||
|
renderJson(jsondata.toString()+" :"+jsonfold.toString()+ " :"+ (b.getTime()-a.getTime()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public FolderNode getFolder(String path) {
|
||||||
|
FolderNode result = getFolder.findByPath(path);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -1,48 +1,48 @@
|
|||||||
package com.platform.controller;
|
package com.platform.controller;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import net.sf.json.JSONObject;
|
import net.sf.json.JSONObject;
|
||||||
import com.jfinal.core.Controller;
|
import com.jfinal.core.Controller;
|
||||||
import com.platform.entities.FolderNode;
|
import com.platform.entities.FolderNode;
|
||||||
import com.platform.form.baseForm;
|
import com.platform.form.baseForm;
|
||||||
|
|
||||||
public class HelloController extends Controller {
|
public class HelloController extends Controller {
|
||||||
|
|
||||||
public void index() {
|
public void index() {
|
||||||
renderText("hello jfinal index !");
|
renderText("hello jfinal index !");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tojson() {
|
public void tojson() {
|
||||||
renderText("hello jfinal tojson !");
|
renderText("hello jfinal tojson !");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void gain() {
|
public void gain() {
|
||||||
baseForm form = new baseForm();
|
baseForm form = new baseForm();
|
||||||
form.setId("12");
|
form.setId("12");
|
||||||
form.setName("n3");
|
form.setName("n3");
|
||||||
|
|
||||||
String base = getPara("jsondata");
|
String base = getPara("jsondata");
|
||||||
System.err.println(base);
|
System.err.println(base);
|
||||||
if (null != base) {
|
if (null != base) {
|
||||||
FolderNode f = new FolderNode();
|
FolderNode f = new FolderNode();
|
||||||
f.setIsFolder(2);
|
f.setIsFolder(2);
|
||||||
f.setName("1");
|
f.setName("1");
|
||||||
f.setPath("/da");
|
f.setPath("/da");
|
||||||
FolderNode f1 = new FolderNode();
|
FolderNode f1 = new FolderNode();
|
||||||
f1.setIsFolder(2);
|
f1.setIsFolder(2);
|
||||||
f1.setName("1");
|
f1.setName("1");
|
||||||
f1.setPath("/da");
|
f1.setPath("/da");
|
||||||
List<FolderNode> lis = new ArrayList<FolderNode>();
|
List<FolderNode> lis = new ArrayList<FolderNode>();
|
||||||
lis.add(f1);
|
lis.add(f1);
|
||||||
f.setChildNodes(lis);
|
f.setChildNodes(lis);
|
||||||
JSONObject jsondata = JSONObject.fromObject(f);
|
JSONObject jsondata = JSONObject.fromObject(f);
|
||||||
renderJson(jsondata.toString());
|
renderJson(jsondata.toString());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
renderText("hello jfinal gaindata ! ");
|
renderText("hello jfinal gaindata ! ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,65 +1,65 @@
|
|||||||
package com.platform.entities;
|
package com.platform.entities;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class FolderNode {
|
public class FolderNode {
|
||||||
private String name;
|
private String name;
|
||||||
private int isFolder; // 1 is file and other integer is folder show children number
|
private int isFolder; // 1 is file and other integer is folder show children number
|
||||||
private String path;
|
private String path;
|
||||||
private List<FolderNode> childNodes = new ArrayList<FolderNode>();
|
private List<FolderNode> childNodes = new ArrayList<FolderNode>();
|
||||||
|
|
||||||
|
|
||||||
public FolderNode() {
|
public FolderNode() {
|
||||||
// TODO Auto-generated constructor stub
|
// TODO Auto-generated constructor stub
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public FolderNode(String name) {
|
public FolderNode(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FolderNode(String name, int isFolder) {
|
public FolderNode(String name, int isFolder) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.isFolder = isFolder;
|
this.isFolder = isFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the isFolder
|
* @return the isFolder
|
||||||
*/
|
*/
|
||||||
public int getIsFolder() {
|
public int getIsFolder() {
|
||||||
return isFolder;
|
return isFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param isFolder the isFolder to set
|
* @param isFolder the isFolder to set
|
||||||
*/
|
*/
|
||||||
public void setIsFolder(int isFolder) {
|
public void setIsFolder(int isFolder) {
|
||||||
this.isFolder = isFolder;
|
this.isFolder = isFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPath() {
|
public String getPath() {
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPath(String path) {
|
public void setPath(String path) {
|
||||||
this.path = path;
|
this.path = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<FolderNode> getChildNodes() {
|
public List<FolderNode> getChildNodes() {
|
||||||
return childNodes;
|
return childNodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChildNodes(List<FolderNode> childNodes) {
|
public void setChildNodes(List<FolderNode> childNodes) {
|
||||||
this.childNodes = childNodes;
|
this.childNodes = childNodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,87 +1,87 @@
|
|||||||
package com.platform.form;
|
package com.platform.form;
|
||||||
|
|
||||||
import java.beans.BeanInfo;
|
import java.beans.BeanInfo;
|
||||||
import java.beans.IntrospectionException;
|
import java.beans.IntrospectionException;
|
||||||
import java.beans.Introspector;
|
import java.beans.Introspector;
|
||||||
import java.beans.PropertyDescriptor;
|
import java.beans.PropertyDescriptor;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class Bean2MapUtils {
|
public class Bean2MapUtils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将一个 Map 对象转化为一个 JavaBean
|
* 将一个 Map 对象转化为一个 JavaBean
|
||||||
* @param type 要转化的类型
|
* @param type 要转化的类型
|
||||||
* @param map 包含属性值的 map
|
* @param map 包含属性值的 map
|
||||||
* @return 转化出来的 JavaBean 对象
|
* @return 转化出来的 JavaBean 对象
|
||||||
* @throws IntrospectionException
|
* @throws IntrospectionException
|
||||||
* 如果分析类属性失败
|
* 如果分析类属性失败
|
||||||
* @throws IllegalAccessException
|
* @throws IllegalAccessException
|
||||||
* 如果实例化 JavaBean 失败
|
* 如果实例化 JavaBean 失败
|
||||||
* @throws InstantiationException
|
* @throws InstantiationException
|
||||||
* 如果实例化 JavaBean 失败
|
* 如果实例化 JavaBean 失败
|
||||||
* @throws InvocationTargetException
|
* @throws InvocationTargetException
|
||||||
* 如果调用属性的 setter 方法失败
|
* 如果调用属性的 setter 方法失败
|
||||||
*/
|
*/
|
||||||
public static Object convertMap(Class type, Map map)
|
public static Object convertMap(Class type, Map map)
|
||||||
throws IntrospectionException, IllegalAccessException,
|
throws IntrospectionException, IllegalAccessException,
|
||||||
InstantiationException, InvocationTargetException {
|
InstantiationException, InvocationTargetException {
|
||||||
BeanInfo beanInfo = Introspector.getBeanInfo(type); // 获取类属性
|
BeanInfo beanInfo = Introspector.getBeanInfo(type); // 获取类属性
|
||||||
Object obj = type.newInstance(); // 创建 JavaBean 对象
|
Object obj = type.newInstance(); // 创建 JavaBean 对象
|
||||||
|
|
||||||
// 给 JavaBean 对象的属性赋值
|
// 给 JavaBean 对象的属性赋值
|
||||||
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
|
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
|
||||||
for (int i = 0; i< propertyDescriptors.length; i++) {
|
for (int i = 0; i< propertyDescriptors.length; i++) {
|
||||||
PropertyDescriptor descriptor = propertyDescriptors[i];
|
PropertyDescriptor descriptor = propertyDescriptors[i];
|
||||||
String propertyName = descriptor.getName();
|
String propertyName = descriptor.getName();
|
||||||
try{
|
try{
|
||||||
if (map.containsKey(propertyName)) {
|
if (map.containsKey(propertyName)) {
|
||||||
// 下面一句可以 try 起来,这样当一个属性赋值失败的时候就不会影响其他属性赋值。
|
// 下面一句可以 try 起来,这样当一个属性赋值失败的时候就不会影响其他属性赋值。
|
||||||
Object value = map.get(propertyName);
|
Object value = map.get(propertyName);
|
||||||
|
|
||||||
Object[] args = new Object[1];
|
Object[] args = new Object[1];
|
||||||
args[0] = value;
|
args[0] = value;
|
||||||
|
|
||||||
descriptor.getWriteMethod().invoke(obj, args);
|
descriptor.getWriteMethod().invoke(obj, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception e){
|
catch(Exception e){
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将一个 JavaBean 对象转化为一个 Map
|
* 将一个 JavaBean 对象转化为一个 Map
|
||||||
* @param bean 要转化的JavaBean 对象
|
* @param bean 要转化的JavaBean 对象
|
||||||
* @return 转化出来的 Map 对象
|
* @return 转化出来的 Map 对象
|
||||||
* @throws IntrospectionException 如果分析类属性失败
|
* @throws IntrospectionException 如果分析类属性失败
|
||||||
* @throws IllegalAccessException 如果实例化 JavaBean 失败
|
* @throws IllegalAccessException 如果实例化 JavaBean 失败
|
||||||
* @throws InvocationTargetException 如果调用属性的 setter 方法失败
|
* @throws InvocationTargetException 如果调用属性的 setter 方法失败
|
||||||
*/
|
*/
|
||||||
public static Map convertBean(Object bean)
|
public static Map convertBean(Object bean)
|
||||||
throws IntrospectionException, IllegalAccessException, InvocationTargetException {
|
throws IntrospectionException, IllegalAccessException, InvocationTargetException {
|
||||||
Class type = bean.getClass();
|
Class type = bean.getClass();
|
||||||
Map returnMap = new HashMap();
|
Map returnMap = new HashMap();
|
||||||
BeanInfo beanInfo = Introspector.getBeanInfo(type);
|
BeanInfo beanInfo = Introspector.getBeanInfo(type);
|
||||||
|
|
||||||
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
|
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
|
||||||
for (int i = 0; i< propertyDescriptors.length; i++) {
|
for (int i = 0; i< propertyDescriptors.length; i++) {
|
||||||
PropertyDescriptor descriptor = propertyDescriptors[i];
|
PropertyDescriptor descriptor = propertyDescriptors[i];
|
||||||
String propertyName = descriptor.getName();
|
String propertyName = descriptor.getName();
|
||||||
if (!propertyName.equals("class")) {
|
if (!propertyName.equals("class")) {
|
||||||
Method readMethod = descriptor.getReadMethod();
|
Method readMethod = descriptor.getReadMethod();
|
||||||
Object result = readMethod.invoke(bean, new Object[0]);
|
Object result = readMethod.invoke(bean, new Object[0]);
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
returnMap.put(propertyName, result);
|
returnMap.put(propertyName, result);
|
||||||
} else {
|
} else {
|
||||||
returnMap.put(propertyName, "");
|
returnMap.put(propertyName, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return returnMap;
|
return returnMap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,55 +1,55 @@
|
|||||||
package com.platform.form;
|
package com.platform.form;
|
||||||
|
|
||||||
public class baseForm {
|
public class baseForm {
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
private baseForm base;
|
private baseForm base;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the id
|
* @return the id
|
||||||
*/
|
*/
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param id the id to set
|
* @param id the id to set
|
||||||
*/
|
*/
|
||||||
public void setId(String id) {
|
public void setId(String id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the name
|
* @return the name
|
||||||
*/
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param name the name to set
|
* @param name the name to set
|
||||||
*/
|
*/
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the base
|
* @return the base
|
||||||
*/
|
*/
|
||||||
public baseForm getBase() {
|
public baseForm getBase() {
|
||||||
return base;
|
return base;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param base the base to set
|
* @param base the base to set
|
||||||
*/
|
*/
|
||||||
public void setBase(baseForm base) {
|
public void setBase(baseForm base) {
|
||||||
this.base = base;
|
this.base = base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,56 +1,56 @@
|
|||||||
package com.platform.glusterfs;
|
package com.platform.glusterfs;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.apache.log4j.PropertyConfigurator;
|
import org.apache.log4j.PropertyConfigurator;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import com.platform.utils.Constant;
|
import com.platform.utils.Constant;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class RemoveData {
|
public class RemoveData {
|
||||||
|
|
||||||
public static Logger log = Logger.getLogger ( RemoveData.class);
|
public static Logger log = Logger.getLogger ( RemoveData.class);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* -1 :error; 0: the filename is not exists ; 1: right
|
* -1 :error; 0: the filename is not exists ; 1: right
|
||||||
* @param folderName
|
* @param folderName
|
||||||
* @param fileName
|
* @param fileName
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int deleteFolder(String folderName){
|
public int deleteFolder(String folderName){
|
||||||
log.info("start delete "+folderName);
|
log.info("start delete "+folderName);
|
||||||
|
|
||||||
ShowData showData=new ShowData();
|
ShowData showData=new ShowData();
|
||||||
Map<String,String> reStrings=showData.showFolderData(folderName);
|
Map<String,String> reStrings=showData.showFolderData(folderName);
|
||||||
|
|
||||||
if(reStrings==null){
|
if(reStrings==null){
|
||||||
log.error("3301 "+folderName+" is not exists");
|
log.error("3301 "+folderName+" is not exists");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
String command="rm -r "+folderName;
|
String command="rm -r "+folderName;
|
||||||
|
|
||||||
// int status=runCommand.runCommand(command);
|
// int status=runCommand.runCommand(command);
|
||||||
Constant.ganymedSSH.execCmdNoWaitAcquiescent(command);
|
Constant.ganymedSSH.execCmdNoWaitAcquiescent(command);
|
||||||
|
|
||||||
log.info("delete "+folderName+" running");
|
log.info("delete "+folderName+" running");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteFolderFiles() {
|
public void testDeleteFolderFiles() {
|
||||||
PropertyConfigurator.configure("log4j.properties");
|
PropertyConfigurator.configure("log4j.properties");
|
||||||
deleteFolder("/home/ubuntu");
|
deleteFolder("/home/ubuntu");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,39 +1,39 @@
|
|||||||
package com.platform.utils;
|
package com.platform.utils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.platform.entities.FolderNode;
|
import com.platform.entities.FolderNode;
|
||||||
import com.platform.entities.VolumeEntity;
|
import com.platform.entities.VolumeEntity;
|
||||||
|
|
||||||
public class CacheTreeData {
|
public class CacheTreeData {
|
||||||
|
|
||||||
private static List<FolderNode> folders = null;
|
private static List<FolderNode> folders = null;
|
||||||
|
|
||||||
private static List<VolumeEntity> volumeList = null;
|
private static List<VolumeEntity> volumeList = null;
|
||||||
|
|
||||||
public static List<FolderNode> getFolders() {
|
public static List<FolderNode> getFolders() {
|
||||||
return folders;
|
return folders;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized static void setFolders(List<FolderNode> folders) {
|
public synchronized static void setFolders(List<FolderNode> folders) {
|
||||||
CacheTreeData.folders = folders;
|
CacheTreeData.folders = folders;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the volumeList
|
* @return the volumeList
|
||||||
*/
|
*/
|
||||||
public static List<VolumeEntity> getVolumeList() {
|
public static List<VolumeEntity> getVolumeList() {
|
||||||
return volumeList;
|
return volumeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param volumeList the volumeList to set
|
* @param volumeList the volumeList to set
|
||||||
*/
|
*/
|
||||||
public synchronized static void setVolumeList(List<VolumeEntity> volumeList) {
|
public synchronized static void setVolumeList(List<VolumeEntity> volumeList) {
|
||||||
CacheTreeData.volumeList = volumeList;
|
CacheTreeData.volumeList = volumeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,50 +1,50 @@
|
|||||||
|
|
||||||
package com.platform.utils;
|
package com.platform.utils;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
public class Constant {
|
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.191.23";
|
// public static String hostIp = "192.168.191.23";
|
||||||
public static String hostIp = "";
|
public static String hostIp = "192.168.0.110";
|
||||||
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 ";
|
||||||
public static String df = "df -k ";
|
public static String df = "df -k ";
|
||||||
public static String peerincluster_connected = "PeerinCluster(Connected)";
|
public static String peerincluster_connected = "PeerinCluster(Connected)";
|
||||||
public static String peerincluster_disconnected = "PeerinCluster(Disconnected)";
|
public static String peerincluster_disconnected = "PeerinCluster(Disconnected)";
|
||||||
public static String peerNotinCluster = "PeerNotinCluster";
|
public static String peerNotinCluster = "PeerNotinCluster";
|
||||||
public static String distributed = "distributed";
|
public static String distributed = "distributed";
|
||||||
public static String replica = "replica";
|
public static String replica = "replica";
|
||||||
public static String stripe = "stripe";
|
public static String stripe = "stripe";
|
||||||
public static String noVolume = "No volumes present";
|
public static String noVolume = "No volumes present";
|
||||||
public static String success = "success";
|
public static String success = "success";
|
||||||
public static String failed = "failed";
|
public static String failed = "failed";
|
||||||
public static String noSuchFile = "No such file or directory";
|
public static String noSuchFile = "No such file or directory";
|
||||||
public static GanymedSSH ganymedSSH = null;
|
public static GanymedSSH ganymedSSH = null;
|
||||||
public static String fileGetTreeData = "WebContent\\WEB-INF\\config\\getTreedata.sh";
|
public static String fileGetTreeData = "WebContent\\WEB-INF\\config\\getTreedata.sh";
|
||||||
public static String AutoMountfile="/gfsAutoMount/AutoRun.sh";
|
public static String AutoMountfile="/gfsAutoMount/AutoRun.sh";
|
||||||
public static String MountRecord="/gfsAutoMount/mountPoint.record";
|
public static String MountRecord="/gfsAutoMount/mountPoint.record";
|
||||||
public static String strGetTreeData = "function ergodic(){\n "
|
public static String strGetTreeData = "function ergodic(){\n "
|
||||||
+ "for file in \\`ls \\$1\\`\n do\n if [ \"\\$file\" != \"app\" -a -d \\$1\\\"/\\\"\\$file ]\n "
|
+ "for file in \\`ls \\$1\\`\n do\n if [ \"\\$file\" != \"app\" -a -d \\$1\\\"/\\\"\\$file ]\n "
|
||||||
+ "then\n ergodic \\$1\"/\"\\$file\n else\n local path=\\$1\"/\"\\$file\n "
|
+ "then\n ergodic \\$1\"/\"\\$file\n else\n local path=\\$1\"/\"\\$file\n "
|
||||||
+ "echo \\$path \n fi\n done\n}\n\nIFS=\\$\\'\\n\\' "
|
+ "echo \\$path \n fi\n done\n}\n\nIFS=\\$\\'\\n\\' "
|
||||||
+ "#这个必须要,否则会在文件名中有空格时出错\nINIT_PATH=\".\";\nergodic \\$1\n";
|
+ "#这个必须要,否则会在文件名中有空格时出错\nINIT_PATH=\".\";\nergodic \\$1\n";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* volume 获取的线程休眠时间
|
* volume 获取的线程休眠时间
|
||||||
*/
|
*/
|
||||||
public final static int moveFileMaxNum = 1;
|
public final static int moveFileMaxNum = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* volume 获取的线程休眠时间
|
* volume 获取的线程休眠时间
|
||||||
*/
|
*/
|
||||||
public final static int get_volume_sleep_time = 10000;
|
public final static int get_volume_sleep_time = 10000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* volume 获取的线程休眠时间
|
* volume 获取的线程休眠时间
|
||||||
*/
|
*/
|
||||||
public final static int update_dataInfo_sleep_time = 1500;
|
public final static int update_dataInfo_sleep_time = 1500;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,99 +1,99 @@
|
|||||||
package com.platform.utils;
|
package com.platform.utils;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件读写操作帮助类
|
* 文件读写操作帮助类
|
||||||
*
|
*
|
||||||
* @author wuming
|
* @author wuming
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class FileOperateHelper {
|
public class FileOperateHelper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 以追加的方式将信息写入文件
|
* 以追加的方式将信息写入文件
|
||||||
*
|
*
|
||||||
* @param path
|
* @param path
|
||||||
* @param message
|
* @param message
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("resource")
|
@SuppressWarnings("resource")
|
||||||
public static void fileWrite(String path, String message) {
|
public static void fileWrite(String path, String message) {
|
||||||
if (null == path || "".equals(path)) {
|
if (null == path || "".equals(path)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
path = path+".log";
|
path = path+".log";
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
if (file.exists())
|
if (file.exists())
|
||||||
file.createNewFile();
|
file.createNewFile();
|
||||||
FileOutputStream out = new FileOutputStream(file, true); // 如果追加方式用true
|
FileOutputStream out = new FileOutputStream(file, true); // 如果追加方式用true
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
sb.append(message);
|
sb.append(message);
|
||||||
out.write(sb.toString().getBytes("utf-8"));
|
out.write(sb.toString().getBytes("utf-8"));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件读取方法
|
* 文件读取方法
|
||||||
* @param path
|
* @param path
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("resource")
|
@SuppressWarnings("resource")
|
||||||
public static String fileReader(String path) {
|
public static String fileReader(String path) {
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
String tempString = "";
|
String tempString = "";
|
||||||
try {
|
try {
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
if (!file.exists())
|
if (!file.exists())
|
||||||
return "当前没有日志信息!";
|
return "当前没有日志信息!";
|
||||||
FileInputStream fis = new FileInputStream(file);
|
FileInputStream fis = new FileInputStream(file);
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(fis,"UTF-8"));
|
BufferedReader br = new BufferedReader(new InputStreamReader(fis,"UTF-8"));
|
||||||
while ((tempString = br.readLine()) != null) {
|
while ((tempString = br.readLine()) != null) {
|
||||||
sb.append(tempString).append("\r\n");
|
sb.append(tempString).append("\r\n");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// Configs.CONSOLE_LOGGER.info(e.getMessage());
|
// Configs.CONSOLE_LOGGER.info(e.getMessage());
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件读取方法
|
* 文件读取方法
|
||||||
* @param path
|
* @param path
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@SuppressWarnings("resource")
|
@SuppressWarnings("resource")
|
||||||
public static String fileReaderAndendline(String path) {
|
public static String fileReaderAndendline(String path) {
|
||||||
|
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
String tempString = "";
|
String tempString = "";
|
||||||
try {
|
try {
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
if (!file.exists())
|
if (!file.exists())
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
FileInputStream fis = new FileInputStream(file);
|
FileInputStream fis = new FileInputStream(file);
|
||||||
BufferedReader br = new BufferedReader(new InputStreamReader(fis));
|
BufferedReader br = new BufferedReader(new InputStreamReader(fis));
|
||||||
while ((tempString = br.readLine()) != null) {
|
while ((tempString = br.readLine()) != null) {
|
||||||
sb.append(tempString+"\n");
|
sb.append(tempString+"\n");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,61 @@
|
|||||||
|
package com.platform.utils;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import ch.ethz.ssh2.Session;
|
||||||
|
import ch.ethz.ssh2.StreamGobbler;
|
||||||
|
|
||||||
|
public class ProcessMyUtil {
|
||||||
|
|
||||||
|
|
||||||
|
public List<String> execCmdWaitAcquiescent(String cmd) {
|
||||||
|
// String host=Constant.hostIp;
|
||||||
|
// String username=Constant.rootUser;
|
||||||
|
// String password=Constant.rootPasswd;
|
||||||
|
// int port=Constant.port;
|
||||||
|
List<String> reStrings = new ArrayList<String>();
|
||||||
|
|
||||||
|
try {
|
||||||
|
ProcessBuilder pb = null;
|
||||||
|
Process pro = null;
|
||||||
|
|
||||||
|
if (cmd.contains("grep")) {
|
||||||
|
List<String> cmds = new ArrayList<String>();
|
||||||
|
cmds.add("sh");
|
||||||
|
cmds.add("-c");
|
||||||
|
cmds.add(cmd);
|
||||||
|
new ProcessBuilder(cmds);
|
||||||
|
pro = pb.start();
|
||||||
|
|
||||||
|
}else {
|
||||||
|
pro = Runtime.getRuntime().exec(cmd);
|
||||||
|
}
|
||||||
|
if (null == pro) {
|
||||||
|
return reStrings;
|
||||||
|
}
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(pro.getInputStream()));
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
String line;
|
||||||
|
while ((line = br.readLine()) != null) {
|
||||||
|
if (line != null) {
|
||||||
|
// System.out.println(line);
|
||||||
|
reStrings.add(line);
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(reStrings.size()==0){
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return reStrings;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,49 +1,49 @@
|
|||||||
package com.platform.utils;
|
package com.platform.utils;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.platform.entities.FolderNode;
|
import com.platform.entities.FolderNode;
|
||||||
|
|
||||||
public class getTreeDataByPath {
|
public class getTreeDataByPath {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param path
|
* @param path
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public FolderNode findByPath(String path) {
|
public FolderNode findByPath(String path) {
|
||||||
List<FolderNode> folderNodelist = CacheTreeData.getFolders();
|
List<FolderNode> folderNodelist = CacheTreeData.getFolders();
|
||||||
if (null == folderNodelist) {
|
if (null == folderNodelist) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
FolderNode folder = null;
|
FolderNode folder = null;
|
||||||
for (FolderNode folderNode : folderNodelist) {
|
for (FolderNode folderNode : folderNodelist) {
|
||||||
folder = getFolder(folderNode, path);
|
folder = getFolder(folderNode, path);
|
||||||
if (null != folder) {
|
if (null != folder) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return folder;
|
return folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param f
|
* @param f
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private FolderNode getFolder(FolderNode f, String path){
|
private FolderNode getFolder(FolderNode f, String path){
|
||||||
FolderNode result = null;
|
FolderNode result = null;
|
||||||
if(path.equals(f.getPath())){
|
if(path.equals(f.getPath())){
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
List<FolderNode> folds = f.getChildNodes();
|
List<FolderNode> folds = f.getChildNodes();
|
||||||
if (null != folds) {
|
if (null != folds) {
|
||||||
for (FolderNode folderNode : folds) {
|
for (FolderNode folderNode : folds) {
|
||||||
result = getFolder(folderNode, path);
|
result = getFolder(folderNode, path);
|
||||||
if (null != result) {
|
if (null != result) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in new issue