commit
608e658d3a
@ -0,0 +1,151 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="com.platform.dao.DataInfoMoveTmpDao">
|
||||||
|
<resultMap id="getEntityByText" type="com.platform.entities.DataInfoEntityMoveTmp">
|
||||||
|
<id property="id" column="id" javaType="int" jdbcType="INTEGER" />
|
||||||
|
<result property="regionalismCode" column="regionalism_code"
|
||||||
|
javaType="string" jdbcType="VARCHAR" />
|
||||||
|
<result property="cityName" column="city_name" javaType="string"
|
||||||
|
jdbcType="VARCHAR" />
|
||||||
|
<result property="districtName" column="district_name"
|
||||||
|
javaType="string" jdbcType="VARCHAR" />
|
||||||
|
<result property="systemCode" column="system_code" javaType="int"
|
||||||
|
jdbcType="INTEGER" />
|
||||||
|
<result property="systemName" column="system_name" javaType="string"
|
||||||
|
jdbcType="VARCHAR" />
|
||||||
|
<result property="dataType" column="data_type" javaType="string"
|
||||||
|
jdbcType="VARCHAR" />
|
||||||
|
<result property="dataVersion" column="data_version" javaType="int"
|
||||||
|
jdbcType="INTEGER" />
|
||||||
|
<result property="submittedBatch" column="submitted_batch"
|
||||||
|
javaType="string" jdbcType="VARCHAR" />
|
||||||
|
<result property="dataPath" column="data_path" javaType="string"
|
||||||
|
jdbcType="VARCHAR" />
|
||||||
|
<result property="charset" column="data_charset" javaType="string"
|
||||||
|
jdbcType="VARCHAR" />
|
||||||
|
<result property="collectingTime" column="collection_time"
|
||||||
|
javaType="string" jdbcType="DATE" />
|
||||||
|
<result property="collectorContacts" column="collector_contacts"
|
||||||
|
javaType="string" jdbcType="VARCHAR" />
|
||||||
|
<result property="collectorName" column="collector_name"
|
||||||
|
javaType="string" jdbcType="VARCHAR" />
|
||||||
|
<result property="year" column="data_year" javaType="string"
|
||||||
|
jdbcType="VARCHAR" />
|
||||||
|
|
||||||
|
<result property="dstPath" column="dst_path" javaType="string"
|
||||||
|
jdbcType="VARCHAR" />
|
||||||
|
<result property="completeStatus" column="complete_status" javaType="string"
|
||||||
|
jdbcType="VARCHAR" />
|
||||||
|
<result property="rate" column="rate" javaType="int"
|
||||||
|
jdbcType="INTEGER" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 获取数据全部记录信息 -->
|
||||||
|
<select id="findAll" parameterType="" resultMap="getEntityByText">
|
||||||
|
SELECT
|
||||||
|
a.id,a.regionalism_code,b.city_name,b.district_name, a.system_code,b.system_name,b.data_type,b.data_version,b.submitted_batch,
|
||||||
|
b.data_path,b.data_charset,b.collection_time,b.collector_name,b.collector_contacts,b.data_year,a.dst_path,a.complete_status,a.rate
|
||||||
|
FROM
|
||||||
|
move_data_tmp a LEFT JOIN data_details b
|
||||||
|
ON a.system_code = b.system_code AND a.regionalism_code = b.regionalism_code;
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="update" parameterType="com.platform.entities.DataInfoEntityMoveTmp">
|
||||||
|
UPDATE
|
||||||
|
move_data_tmp
|
||||||
|
<set >
|
||||||
|
<trim suffixOverrides=",">
|
||||||
|
<if test="regionalismCode != null and regionalismCode != ''">
|
||||||
|
regionalism_code = #{regionalismCode},
|
||||||
|
</if>
|
||||||
|
<if test="systemCode != null and systemCode != ''">
|
||||||
|
system_code= #{systemCode},
|
||||||
|
</if>
|
||||||
|
<if test="dstPath != null and dstPath != ''">
|
||||||
|
dst_path= #{dstPath},
|
||||||
|
</if>
|
||||||
|
<if test="completeStatus != null and completeStatus != ''">
|
||||||
|
complete_status= #{completeStatus},
|
||||||
|
</if>
|
||||||
|
rate= #{rate}
|
||||||
|
</trim>
|
||||||
|
</set>
|
||||||
|
<where>
|
||||||
|
id = #{id}
|
||||||
|
</where>
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<insert id="save" parameterType="">
|
||||||
|
INSERT INTO
|
||||||
|
move_data_tmp(
|
||||||
|
<trim suffixOverrides=",">
|
||||||
|
<if test="id > 0">
|
||||||
|
id,
|
||||||
|
</if>
|
||||||
|
<if test="regionalismCode != null and regionalismCode != ''">
|
||||||
|
regionalism_code,
|
||||||
|
</if>
|
||||||
|
<if test="systemCode != null and systemCode != ''">
|
||||||
|
system_code,
|
||||||
|
</if>
|
||||||
|
<if test="dstPath != null and dstPath != ''">
|
||||||
|
dst_path,
|
||||||
|
</if>
|
||||||
|
<if test="completeStatus != null and completeStatus != ''">
|
||||||
|
complete_status,
|
||||||
|
</if>
|
||||||
|
rate
|
||||||
|
</trim>
|
||||||
|
)
|
||||||
|
VALUES(
|
||||||
|
<trim suffixOverrides=",">
|
||||||
|
<if test="id > 0">
|
||||||
|
id,
|
||||||
|
</if>
|
||||||
|
<if test="regionalismCode != null and regionalismCode != ''">
|
||||||
|
#{regionalismCode},
|
||||||
|
</if>
|
||||||
|
<if test="systemCode != null and systemCode != ''">
|
||||||
|
#{systemCode},
|
||||||
|
</if>
|
||||||
|
<if test="dstPath != null and dstPath != ''">
|
||||||
|
#{dstPath},
|
||||||
|
</if>
|
||||||
|
<if test="completeStatus != null and completeStatus != ''">
|
||||||
|
#{completeStatus},
|
||||||
|
</if>
|
||||||
|
#{rate}
|
||||||
|
</trim>
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<delete id="remove" parameterType="java.lang.INTEGER">
|
||||||
|
DELETE FROM
|
||||||
|
move_data_tmp
|
||||||
|
WHERE
|
||||||
|
id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<!-- 获取数据符合筛选条件的总记录条数 -->
|
||||||
|
<select id="getLimitedDataCount" resultType="java.lang.Integer"
|
||||||
|
parameterType="PagerOptions">
|
||||||
|
SELECT COUNT(id) FROM move_data_tmp
|
||||||
|
<if test="PagerOptions!=null">
|
||||||
|
<where>
|
||||||
|
<include refid="conditionsFilters" />
|
||||||
|
</where>
|
||||||
|
</if>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<!-- 获取数据查询的起始di -->
|
||||||
|
<select id="getLimitedBeginId" resultType="java.lang.Integer"
|
||||||
|
parameterType="PagerOptions">
|
||||||
|
SELECT MAX(idx) FROM (SELECT id idx FROM move_data_tmp
|
||||||
|
ORDER BY id LIMIT 0,#{PagerOptions.totalLimit}) AS TEMP
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
@ -0,0 +1,28 @@
|
|||||||
|
package com.platform.controller;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
import com.base.BaseController;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class TaskModelController extends BaseController{
|
||||||
|
|
||||||
|
@RequestMapping("/task/transfer/list")
|
||||||
|
@ResponseBody
|
||||||
|
public List<Integer> getTransferTask(HttpServletRequest res, HttpServletResponse req) {
|
||||||
|
List<Integer> list = new ArrayList<Integer>();
|
||||||
|
list.add(1);
|
||||||
|
list.add(2);
|
||||||
|
list.add(3);
|
||||||
|
list.add(4);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
package com.platform.entities;
|
||||||
|
|
||||||
|
public class DataInfoEntityMoveTmp extends DataInfoEntity {
|
||||||
|
|
||||||
|
private String dstPath;
|
||||||
|
|
||||||
|
private String completeStatus;
|
||||||
|
|
||||||
|
private int rate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the dstPath
|
||||||
|
*/
|
||||||
|
public String getDstPath() {
|
||||||
|
return dstPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param dstPath the dstPath to set
|
||||||
|
*/
|
||||||
|
public void setDstPath(String dstPath) {
|
||||||
|
this.dstPath = dstPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the completeStatus
|
||||||
|
*/
|
||||||
|
public String getCompleteStatus() {
|
||||||
|
return completeStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param completeStatus the completeStatus to set
|
||||||
|
*/
|
||||||
|
public void setCompleteStatus(String completeStatus) {
|
||||||
|
this.completeStatus = completeStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the rate
|
||||||
|
*/
|
||||||
|
public int getRate() {
|
||||||
|
return rate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param rate the rate to set
|
||||||
|
*/
|
||||||
|
public void setRate(int rate) {
|
||||||
|
this.rate = rate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,5 +1,11 @@
|
|||||||
package com.platform.glusterfs;
|
package com.platform.glusterfs;
|
||||||
|
|
||||||
public class SetCluster {
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
}
|
public class SetCluster {
|
||||||
|
public static Logger log = Logger.getLogger ( SetCluster.class);
|
||||||
|
|
||||||
|
public int addPeer(String peerip){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,104 +1,105 @@
|
|||||||
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 ShowData {
|
public class ShowData {
|
||||||
|
|
||||||
public static Logger log = Logger.getLogger ( ShowData.class);
|
public static Logger log = Logger.getLogger ( ShowData.class);
|
||||||
/**
|
|
||||||
* get the data of volumeName Map<string s1,string s2> s1 is data name and s2 is type file or folder
|
/**
|
||||||
* @param volumeName
|
* get the data of volumeName Map<string s1,string s2> s1 is data name and s2 is type file or folder
|
||||||
* @return
|
* <功能详细描述>
|
||||||
*/
|
* @param volumeName
|
||||||
|
* @return
|
||||||
|
* @see [类、类#方法、类#成员]
|
||||||
public Map<String,String> showVolumeFiles(String volumeName){
|
*/
|
||||||
log.info("start show the data");
|
public Map<String,String> showVolumeFiles(String volumeName){
|
||||||
Map<String,String> data_type=new HashMap<String, String>();
|
log.info("start show the data");
|
||||||
/**
|
Map<String,String> data_type=new HashMap<String, String>();
|
||||||
* get mount point of volumeName
|
/**
|
||||||
*/
|
* get mount point of volumeName
|
||||||
String folderName=volumeName;
|
*/
|
||||||
|
String folderName=volumeName;
|
||||||
data_type=showFolderData(volumeName);
|
|
||||||
return data_type;
|
data_type=showFolderData(volumeName);
|
||||||
}
|
return data_type;
|
||||||
/**
|
}
|
||||||
* get the data of folder name
|
/**
|
||||||
* Map<String,String> is folder name and type 1 is file and others is folder
|
* get the data of folder name
|
||||||
|
* Map<String,String> is folder name and type 1 is file and others is folder
|
||||||
|
|
||||||
* @param FolderName
|
|
||||||
* @return
|
* @param FolderName
|
||||||
*/
|
* @return
|
||||||
public Map<String,String> showFolderData(String folderName){
|
*/
|
||||||
log.info(" start get "+folderName+" data");
|
public Map<String,String> showFolderData(String folderName){
|
||||||
|
log.info(" start get "+folderName+" data");
|
||||||
|
|
||||||
Map<String,String> data_type=new HashMap<String, String>();
|
|
||||||
String command="ls -l "+folderName;
|
Map<String,String> data_type=new HashMap<String, String>();
|
||||||
|
String command="ls -l "+folderName;
|
||||||
/*
|
|
||||||
RunCommand runCommand=new RunCommand();
|
/*
|
||||||
List<String> reStrings=runCommand.runCommandWait(command);
|
RunCommand runCommand=new RunCommand();
|
||||||
*/
|
List<String> reStrings=runCommand.runCommandWait(command);
|
||||||
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd, Constant.port, command);
|
*/
|
||||||
if(reStrings==null){
|
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd, Constant.port, command);
|
||||||
log.error("2101 command get result is null");
|
if(reStrings==null){
|
||||||
return null;
|
log.error("2101 command get result is null");
|
||||||
}
|
return null;
|
||||||
if(reStrings.size()==0){
|
}
|
||||||
log.info("2102 the folder is empty");
|
if(reStrings.size()==0){
|
||||||
return data_type;
|
log.info("2102 the folder is empty");
|
||||||
}
|
return data_type;
|
||||||
if(reStrings.get(0).contains("No such file or directory")){
|
}
|
||||||
log.info("2103 the "+folderName+" is not exists");
|
if(reStrings.get(0).contains("No such file or directory")){
|
||||||
return null;
|
log.info("2103 the "+folderName+" is not exists");
|
||||||
}
|
return null;
|
||||||
/**
|
}
|
||||||
* remove first line total number
|
/**
|
||||||
*/
|
* remove first line total number
|
||||||
reStrings.remove(0);
|
*/
|
||||||
|
reStrings.remove(0);
|
||||||
for(Iterator it2 = reStrings.iterator();it2.hasNext();){
|
|
||||||
String line=(String)it2.next();
|
for(Iterator it2 = reStrings.iterator();it2.hasNext();){
|
||||||
line=line.replaceAll(" +", " ");
|
String line=(String)it2.next();
|
||||||
String keyValue[]=line.split(" ");
|
line=line.replaceAll(" +", " ");
|
||||||
if(keyValue.length<9){
|
String keyValue[]=line.split(" ");
|
||||||
log.error("2104 "+line+" length is short");
|
if(keyValue.length<9){
|
||||||
continue;
|
log.error("2104 "+line+" length is short");
|
||||||
}
|
continue;
|
||||||
|
}
|
||||||
data_type.put(keyValue[8], keyValue[1]);
|
|
||||||
|
data_type.put(keyValue[8], keyValue[1]);
|
||||||
}
|
|
||||||
log.info(" get "+folderName+" data successed");
|
}
|
||||||
return data_type;
|
log.info(" get "+folderName+" data successed");
|
||||||
}
|
return data_type;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
/**
|
||||||
* <一句话功能简述>
|
*
|
||||||
* <功能详细描述>
|
* <一句话功能简述>
|
||||||
* @see [类、类#方法、类#成员]
|
* <功能详细描述>
|
||||||
*/
|
* @see [类、类#方法、类#成员]
|
||||||
@Test
|
*/
|
||||||
public void testShowData(){
|
@Test
|
||||||
|
public void testShowData(){
|
||||||
System.out.println(showFolderData("/home"));
|
|
||||||
|
System.out.println(showFolderData("/home"));
|
||||||
}
|
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,271 +1,334 @@
|
|||||||
package com.platform.glusterfs;
|
package com.platform.glusterfs;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.io.File;
|
import java.util.HashMap;
|
||||||
import java.util.ArrayList;
|
import java.util.Iterator;
|
||||||
import java.util.HashMap;
|
import java.util.List;
|
||||||
import java.util.Iterator;
|
import java.util.Map;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import org.apache.log4j.Logger;
|
||||||
|
import org.apache.log4j.PropertyConfigurator;
|
||||||
import org.apache.log4j.Logger;
|
import org.junit.Test;
|
||||||
import org.apache.log4j.PropertyConfigurator;
|
import org.omg.CosNaming.NamingContextExtPackage.StringNameHelper;
|
||||||
|
|
||||||
import com.platform.utils.Constant;
|
import com.platform.utils.Constant;
|
||||||
|
import com.platform.utils.GanymedSSH;
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
public class VolumeInfo {
|
|
||||||
public static Logger log = Logger.getLogger(VolumeInfo.class);
|
public class VolumeInfo {
|
||||||
|
public static Logger log = Logger.getLogger(VolumeInfo.class);
|
||||||
public List<String> showAllVolumeName() {
|
|
||||||
log.info("get volume name");
|
/**
|
||||||
List<String> volNames = new ArrayList<String>();
|
* 显示所有volume名称
|
||||||
|
* <功能详细描述>
|
||||||
/*
|
* @return
|
||||||
* String command = "echo \"" + Constant.rootPasswd +
|
* @see [类、类#方法、类#成员]
|
||||||
* "\" |sudo -S gluster volume info|grep ^Volume.Name"; RunCommand
|
*/
|
||||||
* runCommand = new RunCommand(); List<String> reStrings =
|
public List<String> showAllVolumeName() {
|
||||||
* runCommand.runCommandWait(command);
|
log.info("get volume name");
|
||||||
*/
|
List<String> volNames = new ArrayList<String>();
|
||||||
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd,
|
|
||||||
Constant.port, Constant.glusterVolumeInfo + "|grep ^Volume.Name");
|
/*
|
||||||
// System.out.println(reStrings);
|
* String command = "echo \"" + Constant.rootPasswd +
|
||||||
if(reStrings==null){
|
* "\" |sudo -S gluster volume info|grep ^Volume.Name"; RunCommand
|
||||||
log.error("1401 get result is null");
|
* runCommand = new RunCommand(); List<String> reStrings =
|
||||||
return null;
|
* runCommand.runCommandWait(command);
|
||||||
}
|
*/
|
||||||
if(reStrings.size()==0){
|
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser,
|
||||||
log.error("1402 get result is nothing");
|
Constant.rootPasswd, Constant.port, Constant.glusterVolumeInfo + "|grep ^Volume.Name");
|
||||||
return null;
|
// System.out.println(reStrings);
|
||||||
}
|
if (reStrings == null) {
|
||||||
if(reStrings.get(0).contains(Constant.noVolume)){
|
log.error("1401 get result is null");
|
||||||
reStrings.clear();
|
return null;
|
||||||
return reStrings;
|
}
|
||||||
}
|
if (reStrings.size() == 0) {
|
||||||
if (!(reStrings.get(0).split(":")[0].contains("Volume Name"))) {
|
log.error("1402 get result is nothing");
|
||||||
log.error("1403 get result string wrong");
|
return null;
|
||||||
return null;
|
}
|
||||||
}
|
if (reStrings.get(0).contains(Constant.noVolume)) {
|
||||||
|
reStrings.clear();
|
||||||
String nameInfo = "";
|
return reStrings;
|
||||||
for (Iterator it = reStrings.iterator(); it.hasNext();) {
|
}
|
||||||
String line = (String) it.next();
|
if (!(reStrings.get(0).split(":")[0].contains("Volume Name"))) {
|
||||||
String str[] = line.split(":");
|
log.error("1403 get result string wrong");
|
||||||
volNames.add(str[1].replaceAll(" ", ""));
|
return null;
|
||||||
}
|
}
|
||||||
return volNames;
|
|
||||||
|
String nameInfo = "";
|
||||||
}
|
for (Iterator it = reStrings.iterator(); it.hasNext();) {
|
||||||
|
String line = (String) it.next();
|
||||||
public String getVolumeType(String volumeName) {
|
String str[] = line.split(":");
|
||||||
log.info("get volume type");
|
volNames.add(str[1].replaceAll(" ", ""));
|
||||||
String volType = "";
|
}
|
||||||
|
return volNames;
|
||||||
/*
|
|
||||||
* =======
|
}
|
||||||
*
|
|
||||||
* >>>>>>> origin/AlexKie String command = "echo \"" +
|
/**
|
||||||
* Constant.rootPasswd + "\" |sudo -S gluster volume info " +
|
* 给定参数volume的名称获得volume的类型
|
||||||
* volumeName + "|grep ^Type"; RunCommand runCommand = new RunCommand();
|
* <功能详细描述>
|
||||||
* List<String> reStrings = runCommand.runCommandWait(command); <<<<<<<
|
* @param volumeName
|
||||||
* HEAD
|
* @return
|
||||||
*/
|
* @see [类、类#方法、类#成员]
|
||||||
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd,
|
*/
|
||||||
Constant.port, Constant.glusterVolumeInfo + volumeName + "|grep ^Type");
|
public String getVolumeType(String volumeName) {
|
||||||
// System.out.println(reStrings);
|
log.info("get volume type");
|
||||||
if(reStrings==null){
|
String volType = "";
|
||||||
log.error("1501 get result is null");
|
|
||||||
return null;
|
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser,
|
||||||
}
|
Constant.rootPasswd, Constant.port, Constant.glusterVolumeInfo + volumeName + "|grep ^Type");
|
||||||
if(reStrings.size()==0){
|
// System.out.println(reStrings);
|
||||||
log.error("1502 get result is nothing");
|
if (reStrings == null) {
|
||||||
return null;
|
log.error("1501 get result is null");
|
||||||
}
|
return null;
|
||||||
if (!(reStrings.get(0).split(":")[0].contains("Type"))) {
|
}
|
||||||
log.error("1503 get result string wrong");
|
if (reStrings.size() == 0) {
|
||||||
return null;
|
log.error("1502 get result is nothing");
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
// System.out.println(reStrings);
|
if (!(reStrings.get(0).split(":")[0].contains("Type"))) {
|
||||||
|
log.error("1503 get result string wrong");
|
||||||
for (Iterator it = reStrings.iterator(); it.hasNext();) {
|
return null;
|
||||||
String line = (String) it.next();
|
}
|
||||||
String str[] = line.split(":");
|
|
||||||
volType = str[1];
|
// System.out.println(reStrings);
|
||||||
}
|
|
||||||
volType=volType.replaceAll(" ", "");
|
for (Iterator it = reStrings.iterator(); it.hasNext();) {
|
||||||
return volType;
|
String line = (String) it.next();
|
||||||
}
|
String str[] = line.split(":");
|
||||||
|
volType = str[1];
|
||||||
public String getVolumeStatus(String volumeName) {
|
}
|
||||||
log.info("get volume status");
|
volType = volType.replaceAll(" ", "");
|
||||||
String volStatus = "";
|
return volType;
|
||||||
|
}
|
||||||
/*
|
|
||||||
* =======
|
public String getVolumeStatus(String volumeName) {
|
||||||
*
|
log.info("get volume status");
|
||||||
* >>>>>>> origin/AlexKie String command = "echo \"" +
|
String volStatus = "";
|
||||||
* Constant.rootPasswd + "\" |sudo -S gluster volume info " +
|
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser,
|
||||||
* volumeName + "|grep ^Status"; RunCommand runCommand = new
|
Constant.rootPasswd, Constant.port, Constant.glusterVolumeInfo + "|grep ^Status");
|
||||||
* RunCommand(); List<String> reStrings =
|
// System.out.println(reStrings);
|
||||||
* runCommand.runCommandWait(command); <<<<<<< HEAD
|
if (reStrings == null) {
|
||||||
*/
|
log.error("1701 get result is null");
|
||||||
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd,
|
return null;
|
||||||
Constant.port, Constant.glusterVolumeInfo + "|grep ^Status");
|
}
|
||||||
// System.out.println(reStrings);
|
if (reStrings.size() == 0) {
|
||||||
if(reStrings==null){
|
log.error("1702 get result is nothing");
|
||||||
log.error("1701 get result is null");
|
return null;
|
||||||
return null;
|
}
|
||||||
}
|
if (!(reStrings.get(0).split(":")[0].contains("Status"))) {
|
||||||
if(reStrings.size()==0){
|
log.error("1703 get result string wrong");
|
||||||
log.error("1702 get result is nothing");
|
return null;
|
||||||
return null;
|
}
|
||||||
}
|
|
||||||
if (!(reStrings.get(0).split(":")[0].contains("Status"))) {
|
for (Iterator it = reStrings.iterator(); it.hasNext();) {
|
||||||
log.error("1703 get result string wrong");
|
String line = (String) it.next();
|
||||||
return null;
|
String str[] = line.split(":");
|
||||||
}
|
volStatus = str[1].replaceAll(" ", "");
|
||||||
|
}
|
||||||
for (Iterator it = reStrings.iterator(); it.hasNext();) {
|
return volStatus;
|
||||||
String line = (String) it.next();
|
}
|
||||||
String str[] = line.split(":");
|
|
||||||
volStatus = str[1].replaceAll(" ", "");
|
public Double getVolumeAllSize(String volumeName) {
|
||||||
}
|
log.info("get volume allSize");
|
||||||
|
Double allSize = null;
|
||||||
return volStatus;
|
/*
|
||||||
}
|
* ======= // waiting for testing... public Double
|
||||||
|
* getVolumeAllSize(String volumeName) { log.info("get volume allSize");
|
||||||
public Double getVolumeAllSize(String volumeName) {
|
* Double allSize = null;
|
||||||
log.info("get volume allSize");
|
*
|
||||||
Double allSize = null;
|
* >>>>>>> origin/AlexKie String command = "echo \"" +
|
||||||
/*
|
* Constant.rootPasswd + "\" |sudo -S df -h|grep " + volumeName +
|
||||||
* ======= // waiting for testing... public Double
|
* "|awk '{print $2}'"; RunCommand runCommand = new RunCommand();
|
||||||
* getVolumeAllSize(String volumeName) { log.info("get volume allSize");
|
* List<String> reStrings = runCommand.runCommandWait(command); <<<<<<<
|
||||||
* Double allSize = null;
|
* HEAD
|
||||||
*
|
*/
|
||||||
* >>>>>>> origin/AlexKie String command = "echo \"" +
|
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd,
|
||||||
* Constant.rootPasswd + "\" |sudo -S df -h|grep " + volumeName +
|
Constant.port, Constant.df + "|grep " + volumeName + "|awk '{print $2}'");
|
||||||
* "|awk '{print $2}'"; RunCommand runCommand = new RunCommand();
|
// System.out.println(reStrings);
|
||||||
* List<String> reStrings = runCommand.runCommandWait(command); <<<<<<<
|
if(reStrings==null){
|
||||||
* HEAD
|
log.error("1801 get result is null");
|
||||||
*/
|
return null;
|
||||||
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd,
|
}
|
||||||
Constant.port, Constant.df + "|grep " + volumeName + "|awk '{print $2}'");
|
if(reStrings.size()==0){
|
||||||
// System.out.println(reStrings);
|
log.error("1802 get result is nothing");
|
||||||
if(reStrings==null){
|
return null;
|
||||||
log.error("1801 get result is null");
|
}
|
||||||
return null;
|
char flag = reStrings.get(0).trim().toCharArray()[0];
|
||||||
}
|
if (flag < 48 || flag > 57) {
|
||||||
if(reStrings.size()==0){
|
log.error("1803 get result string wrong");
|
||||||
log.error("1802 get result is nothing");
|
return null;
|
||||||
return null;
|
}
|
||||||
}
|
|
||||||
char flag = reStrings.get(0).trim().toCharArray()[0];
|
for (Iterator it = reStrings.iterator(); it.hasNext();) {
|
||||||
if (flag < 48 || flag > 57) {
|
String line = (String) it.next();
|
||||||
log.error("1803 get result string wrong");
|
String str[] = line.split("[^0-9]");
|
||||||
return null;
|
allSize = Double.parseDouble(str[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Iterator it = reStrings.iterator(); it.hasNext();) {
|
return allSize;
|
||||||
String line = (String) it.next();
|
}
|
||||||
String str[] = line.split("[^0-9]");
|
|
||||||
allSize = Double.parseDouble(str[0]);
|
public Double getVolumeUseSize(String volumeName) {
|
||||||
}
|
log.info("get volume used size");
|
||||||
|
Double usedSize = null;
|
||||||
return allSize;
|
|
||||||
}
|
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser,
|
||||||
|
Constant.rootPasswd, Constant.port, Constant.df + "|grep " + volumeName + "|awk '{print $3}'");
|
||||||
public Double getVolumeUseSize(String volumeName) {
|
// System.out.println(reStrings);
|
||||||
log.info("get volume used size");
|
if (reStrings == null) {
|
||||||
Double usedSize = null;
|
log.error("1901 get result is null");
|
||||||
|
return null;
|
||||||
/*
|
}
|
||||||
* =======
|
if (reStrings.size() == 0) {
|
||||||
*
|
log.error("1902 get result is nothing");
|
||||||
* >>>>>>> origin/AlexKie String command = "echo \"" +
|
return null;
|
||||||
* Constant.rootPasswd + "\" |sudo -S df -h|grep " + volumeName +
|
}
|
||||||
* "|awk '{print $3}'"; RunCommand runCommand = new RunCommand();
|
char flag = reStrings.get(0).trim().toCharArray()[0];
|
||||||
* List<String> reStrings = runCommand.runCommandWait(command); <<<<<<<
|
if (flag < 48 || flag > 57) {
|
||||||
* HEAD
|
log.error("1903 get result string wrong");
|
||||||
*/
|
return null;
|
||||||
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd,
|
}
|
||||||
Constant.port, Constant.df + "|grep " + volumeName + "|awk '{print $3}'");
|
|
||||||
// System.out.println(reStrings);
|
for (Iterator it = reStrings.iterator(); it.hasNext();) {
|
||||||
if(reStrings==null){
|
String line = (String) it.next();
|
||||||
log.error("1901 get result is null");
|
String str[] = line.split("[^0-9]");
|
||||||
return null;
|
|
||||||
}
|
usedSize = Double.parseDouble(str[0]);
|
||||||
if(reStrings.size()==0){
|
}
|
||||||
log.error("1902 get result is nothing");
|
|
||||||
return null;
|
return usedSize;
|
||||||
}
|
}
|
||||||
char flag = reStrings.get(0).trim().toCharArray()[0];
|
|
||||||
if (flag < 48 || flag > 57) {
|
/**
|
||||||
log.error("1903 get result string wrong");
|
* @param volumeName
|
||||||
return null;
|
* @return String ipAndpath[] = brick.split(":");
|
||||||
}
|
String ip = ipAndpath[0];
|
||||||
|
String path = ipAndpath[1];
|
||||||
for (Iterator it = reStrings.iterator(); it.hasNext();) {
|
*/
|
||||||
String line = (String) it.next();
|
public List<String> getVolumeBricks(String volumeName) {
|
||||||
String str[] = line.split("[^0-9]");
|
log.info("get volume bricks");
|
||||||
|
|
||||||
usedSize = Double.parseDouble(str[0]);
|
String cmd = "gluster volume info " + volumeName + " |grep ^Brick'[0-9]\\+' |awk '{print $2}'";
|
||||||
}
|
List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
|
||||||
|
// System.out.println(reStrings);
|
||||||
return usedSize;
|
if (reStrings == null) {
|
||||||
}
|
log.error("1601 get volume bricks wrong");
|
||||||
|
return null;
|
||||||
public String getVolumeMountPoint(String volumeName) {
|
}
|
||||||
log.info("get volume mountPoint");
|
|
||||||
// String mountPoint = "";
|
return reStrings;
|
||||||
|
}
|
||||||
/*
|
|
||||||
* =======
|
public List<String> getVolumeMountPoint(String volumeName) {
|
||||||
*
|
log.info("get volume MountPoint");
|
||||||
* >>>>>>> origin/AlexKie String command = "echo \"" +
|
|
||||||
* Constant.rootPasswd + "\" |sudo -S df -h|grep " + volumeName +
|
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd,
|
||||||
* "|awk '{print $6}'"; RunCommand runCommand = new RunCommand();
|
Constant.port, Constant.df + "|grep " + volumeName + "|awk '{print $6}'");
|
||||||
* List<String> reStrings = runCommand.runCommandWait(command); <<<<<<<
|
// System.out.println(reStrings);
|
||||||
* HEAD
|
if(reStrings==null){
|
||||||
*/
|
log.error("11001 get result string wrong");
|
||||||
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd,
|
return null;
|
||||||
Constant.port, Constant.df + "|grep " + volumeName + "|awk '{print $6}'");
|
}
|
||||||
// System.out.println(reStrings);
|
if(reStrings.size()==0){
|
||||||
if(reStrings==null){
|
log.error("11002 "+volumeName+" is no mountpoint");
|
||||||
log.error("11001 get result string wrong");
|
return null;
|
||||||
return null;
|
}
|
||||||
}
|
|
||||||
if(reStrings.size()==0){
|
char flag = reStrings.get(0).trim().toCharArray()[0];
|
||||||
log.error("11002 "+volumeName+" is no mountpoint");
|
if (flag != '/') {
|
||||||
return null;
|
log.error("11003 get result string wrong");
|
||||||
}
|
return null;
|
||||||
|
}
|
||||||
char flag = reStrings.get(0).trim().toCharArray()[0];
|
List<String> mountPoints = new ArrayList<>();
|
||||||
if (flag != '/') {
|
for(String mountPoint:reStrings){
|
||||||
log.error("11003 get result string wrong");
|
mountPoint=mountPoint.replaceAll(" ", "");
|
||||||
return null;
|
mountPoints.add(mountPoint);
|
||||||
}
|
}
|
||||||
|
return mountPoints;
|
||||||
Iterator it = reStrings.iterator();
|
}
|
||||||
String mountPoint = (String) it.next();
|
|
||||||
mountPoint=mountPoint.replaceAll(" ", "");
|
public Map<String, Double> getVolumebricksDataSize(String volumeName) {
|
||||||
return mountPoint;
|
List<String> bricks = getVolumeBricks(volumeName);
|
||||||
}
|
Map<String, Double> brick_size = new HashMap<>();
|
||||||
|
if (bricks == null) {
|
||||||
public static void main(String[] args) {
|
return null;
|
||||||
PropertyConfigurator.configure("log4j.properties");
|
}
|
||||||
|
for (String brick : bricks) {
|
||||||
System.out.println(new VolumeInfo().showAllVolumeName());
|
String ipAndpath[] = brick.split(":");
|
||||||
System.out.println(new VolumeInfo().getVolumeType("v1"));
|
String ip = ipAndpath[0];
|
||||||
|
String path = ipAndpath[1];
|
||||||
System.out.println(new VolumeInfo().getVolumeStatus("v1"));
|
String cmd = "du -d 0 " + path + "|awk '{print $1}'";
|
||||||
System.out.println(new VolumeInfo().getVolumeMountPoint("v1"));
|
List<String> reStrings = Constant.ganymedSSH.execCmdWait(ip, Constant.rootUser, Constant.rootPasswd,
|
||||||
|
Constant.port, cmd);
|
||||||
System.out.println(new VolumeInfo().getVolumeAllSize("v1"));
|
// System.out.println(reStrings);
|
||||||
System.out.println(new VolumeInfo().getVolumeUseSize("v1"));
|
if (reStrings == null) {
|
||||||
|
log.error("1901 get result is null");
|
||||||
}
|
return null;
|
||||||
}
|
}
|
||||||
|
if (reStrings.size() == 0) {
|
||||||
|
log.error("1902 get result is nothing");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Pattern pattern = Pattern.compile("[0-9]*");
|
||||||
|
Matcher isNum = pattern.matcher(reStrings.get(0));
|
||||||
|
if (!isNum.matches()) {
|
||||||
|
log.error("1903 " + reStrings.get(0) + " is unexpect");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
brick_size.put(brick, Double.parseDouble(reStrings.get(0)));
|
||||||
|
}
|
||||||
|
return brick_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Double> getVolumebricksAvailableSize(String volumeName) {
|
||||||
|
List<String> bricks = getVolumeBricks(volumeName);
|
||||||
|
Map<String, Double> brick_size = new HashMap<>();
|
||||||
|
if (bricks == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (String brick : bricks) {
|
||||||
|
String ipAndpath[] = brick.split(":");
|
||||||
|
String ip = ipAndpath[0];
|
||||||
|
String path = ipAndpath[1];
|
||||||
|
String cmd = "df " + path + "|awk '{print $4}'";
|
||||||
|
List<String> reStrings = Constant.ganymedSSH.execCmdWait(ip, Constant.rootUser, Constant.rootPasswd,
|
||||||
|
Constant.port, cmd);
|
||||||
|
// System.out.println(reStrings);
|
||||||
|
if (reStrings == null) {
|
||||||
|
log.error("1901 get result is null");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (reStrings.size() == 0) {
|
||||||
|
log.error("1902 get result is nothing");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Pattern pattern = Pattern.compile("[0-9]*");
|
||||||
|
Matcher isNum = pattern.matcher(reStrings.get(1));
|
||||||
|
if (!isNum.matches()) {
|
||||||
|
log.error("1903 " + reStrings.get(1) + " is unexpect");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
brick_size.put(brick, Double.parseDouble(reStrings.get(1)));
|
||||||
|
}
|
||||||
|
return brick_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_getVolumebricksDataSize() {
|
||||||
|
System.out.println(getVolumebricksDataSize("gfs_ftp"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_getVolumebricksAvailableSize() {
|
||||||
|
System.out.println(getVolumebricksAvailableSize("gfs_ftp"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Test
|
||||||
|
public void test_getVolumeBricks() {
|
||||||
|
getVolumeBricks("gfs_ftp");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
package com.platform.utils;
|
package com.platform.utils;
|
||||||
|
|
||||||
import com.platform.entities.FolderNode;
|
import java.util.List;
|
||||||
|
|
||||||
public class CacheTreeData {
|
import com.platform.entities.FolderNode;
|
||||||
|
|
||||||
private static FolderNode folders = null;
|
public class CacheTreeData {
|
||||||
|
|
||||||
public static FolderNode getFolders() {
|
private static List<FolderNode> folders = null;
|
||||||
return folders;
|
|
||||||
}
|
public static List<FolderNode> getFolders() {
|
||||||
|
return folders;
|
||||||
public static void setFolders(FolderNode folders) {
|
}
|
||||||
CacheTreeData.folders = folders;
|
|
||||||
}
|
public static void setFolders(List<FolderNode> folders) {
|
||||||
|
CacheTreeData.folders = folders;
|
||||||
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
|
@ -1,74 +1,74 @@
|
|||||||
package com.platform.utils;
|
package com.platform.utils;
|
||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.servlet.ServletContextEvent;
|
import javax.servlet.ServletContextEvent;
|
||||||
import javax.servlet.ServletContextListener;
|
import javax.servlet.ServletContextListener;
|
||||||
|
|
||||||
public class ConfigsLoader implements ServletContextListener {
|
public class ConfigsLoader implements ServletContextListener {
|
||||||
private static ConfigPropertyReader cReader = null;
|
private static ConfigPropertyReader cReader = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void contextDestroyed(ServletContextEvent sEvent) {
|
public void contextDestroyed(ServletContextEvent sEvent) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
Configs.CONSOLE_LOGGER.info("系统停止..");
|
Configs.CONSOLE_LOGGER.info("系统停止..");
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("static-access")
|
@SuppressWarnings("static-access")
|
||||||
@Override
|
@Override
|
||||||
public void contextInitialized(ServletContextEvent sEvent) {
|
public void contextInitialized(ServletContextEvent sEvent) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
Configs.CONSOLE_LOGGER.info("系统初始化..");
|
Configs.CONSOLE_LOGGER.info("系统初始化..");
|
||||||
String contextPath = sEvent.getServletContext().getRealPath("/")
|
String contextPath = sEvent.getServletContext().getRealPath("/")
|
||||||
+ "WEB-INF/config/config.properties";
|
+ "WEB-INF/config/config.properties";
|
||||||
this.cReader = ConfigPropertyReader.Builder(contextPath);
|
this.cReader = ConfigPropertyReader.Builder(contextPath);
|
||||||
init();
|
init();
|
||||||
new VolumeThread("").start();
|
new ThreadVolume("").start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
Properties properties = cReader.getProperties();
|
Properties properties = cReader.getProperties();
|
||||||
|
|
||||||
Configs.KUBE_MASTER_URL = properties.getProperty("kubeMasterUrl");
|
Configs.KUBE_MASTER_URL = properties.getProperty("kubeMasterUrl");
|
||||||
|
|
||||||
Configs.COLLECT_USER_NAME = properties.getProperty("collect-user-name");
|
Configs.COLLECT_USER_NAME = properties.getProperty("collect-user-name");
|
||||||
|
|
||||||
Configs.COLLECT_PASSWORD = properties.getProperty("collect-password");
|
Configs.COLLECT_PASSWORD = properties.getProperty("collect-password");
|
||||||
|
|
||||||
Configs.COLLECT_SERVICE_NAME = properties
|
Configs.COLLECT_SERVICE_NAME = properties
|
||||||
.getProperty("collect-service-name");
|
.getProperty("collect-service-name");
|
||||||
|
|
||||||
Configs.GATHER_USER_NAME = properties.getProperty("gather-user-name");
|
Configs.GATHER_USER_NAME = properties.getProperty("gather-user-name");
|
||||||
|
|
||||||
Configs.GATHER_USER_PASSWORD = properties
|
Configs.GATHER_USER_PASSWORD = properties
|
||||||
.getProperty("gather-user-password");
|
.getProperty("gather-user-password");
|
||||||
|
|
||||||
Configs.GATHER_PORT = properties.getProperty("gather-port");
|
Configs.GATHER_PORT = properties.getProperty("gather-port");
|
||||||
|
|
||||||
Configs.GATHER_SERVICE_NAME = properties
|
Configs.GATHER_SERVICE_NAME = properties
|
||||||
.getProperty("gather-service-name");
|
.getProperty("gather-service-name");
|
||||||
|
|
||||||
Configs.TABLE_SUFFIX = properties.getProperty("table-suffix");
|
Configs.TABLE_SUFFIX = properties.getProperty("table-suffix");
|
||||||
|
|
||||||
Configs.EXTRACT_LOG_LOCALTION = properties
|
Configs.EXTRACT_LOG_LOCALTION = properties
|
||||||
.getProperty("extract-log-localtion");
|
.getProperty("extract-log-localtion");
|
||||||
|
|
||||||
Configs.GATHER_TABLESPACE_NAME = properties
|
Configs.GATHER_TABLESPACE_NAME = properties
|
||||||
.getProperty("gather-tablespace-name");
|
.getProperty("gather-tablespace-name");
|
||||||
|
|
||||||
Configs.GATHER_TABLESPACE_PATH = properties
|
Configs.GATHER_TABLESPACE_PATH = properties
|
||||||
.getProperty("gather-tablespace-path");
|
.getProperty("gather-tablespace-path");
|
||||||
|
|
||||||
Configs.GATHER_TABLE_PASSWORD=properties.getProperty("gather-table-user-password");
|
Configs.GATHER_TABLE_PASSWORD=properties.getProperty("gather-table-user-password");
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConfigPropertyReader getcReader() {
|
public ConfigPropertyReader getcReader() {
|
||||||
return cReader;
|
return cReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("static-access")
|
@SuppressWarnings("static-access")
|
||||||
public void setcReader(ConfigPropertyReader cReader) {
|
public void setcReader(ConfigPropertyReader cReader) {
|
||||||
this.cReader = cReader;
|
this.cReader = cReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,32 @@
|
|||||||
package com.platform.utils;
|
package com.platform.utils;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
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.0.110";
|
||||||
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 ";
|
||||||
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 distributed="distributed";
|
public static String peerincluster_disconnected="PeerinCluster(Disconnected)";
|
||||||
public static String replica="replica";
|
public static String distributed="distributed";
|
||||||
public static String stripe="stripe";
|
public static String replica="replica";
|
||||||
public static String noVolume="No volumes present";
|
public static String stripe="stripe";
|
||||||
public static GanymedSSH ganymedSSH=new GanymedSSH(hostIp, rootUser, rootPasswd, port);
|
public static String noVolume="No volumes present";
|
||||||
|
public static GanymedSSH ganymedSSH=new GanymedSSH(hostIp, rootUser, rootPasswd, port);
|
||||||
/**
|
public static String fileGetTreeData="./WEB-INF/config/getTreedata.sh";
|
||||||
* volume 获取的线程休眠时间
|
|
||||||
*/
|
/**
|
||||||
public final static int get_volume_sleep_time = 300000;
|
* volume 获取的线程休眠时间
|
||||||
}
|
*/
|
||||||
|
public final static int get_volume_sleep_time = 300000;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* volume 获取的线程休眠时间
|
||||||
|
*/
|
||||||
|
public final static int update_dataInfo_sleep_time = 3000;
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
package com.platform.utils;
|
||||||
|
|
||||||
|
public class ThreadMoveData extends Thread {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* : 实时更新数据库--根据查询到的 正则迁移的数据
|
||||||
|
*/
|
||||||
|
public ThreadMoveData() {
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see java.lang.Thread#run()
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
super.run();
|
||||||
|
//查询 表 move_data_tmp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
Thread.sleep(Constant.update_dataInfo_sleep_time);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,52 +0,0 @@
|
|||||||
package com.platform.utils;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.platform.entities.FolderNode;
|
|
||||||
import com.platform.glusterfs.GetTreeData;
|
|
||||||
import com.platform.glusterfs.VolumeInfo;
|
|
||||||
|
|
||||||
public class VolumeThread extends Thread implements Runnable{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 挂载点路径
|
|
||||||
*/
|
|
||||||
private static String pointPath = "/home";
|
|
||||||
|
|
||||||
public VolumeThread() {
|
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
|
||||||
|
|
||||||
public VolumeThread(String path) {
|
|
||||||
if (null != path && !"".equals(path.trim())) {
|
|
||||||
VolumeThread.pointPath = path;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** gfs目录树形展示 */
|
|
||||||
private GetTreeData gfsTree = new GetTreeData();
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
super.run();
|
|
||||||
while(true){
|
|
||||||
FolderNode folders = gfsTree.getDatas(pointPath);
|
|
||||||
//TODO
|
|
||||||
CacheTreeData.setFolders(folders);
|
|
||||||
try {
|
|
||||||
Thread.sleep(Constant.get_volume_sleep_time);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getPointPath() {
|
|
||||||
return pointPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setPointPath(String pointPath) {
|
|
||||||
VolumeThread.pointPath = pointPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in new issue