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;
|
||||
|
||||
public class SetCluster {
|
||||
|
||||
}
|
||||
package com.platform.glusterfs;
|
||||
|
||||
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;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
||||
import org.apache.log4j.PropertyConfigurator;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.platform.utils.Constant;
|
||||
|
||||
|
||||
public class ShowData {
|
||||
|
||||
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
|
||||
* @return
|
||||
*/
|
||||
|
||||
|
||||
public Map<String,String> showVolumeFiles(String volumeName){
|
||||
log.info("start show the data");
|
||||
Map<String,String> data_type=new HashMap<String, String>();
|
||||
/**
|
||||
* get mount point of volumeName
|
||||
*/
|
||||
String folderName=volumeName;
|
||||
|
||||
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
|
||||
|
||||
|
||||
* @param FolderName
|
||||
* @return
|
||||
*/
|
||||
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;
|
||||
|
||||
/*
|
||||
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){
|
||||
log.error("2101 command get result is null");
|
||||
return null;
|
||||
}
|
||||
if(reStrings.size()==0){
|
||||
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");
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* remove first line total number
|
||||
*/
|
||||
reStrings.remove(0);
|
||||
|
||||
for(Iterator it2 = reStrings.iterator();it2.hasNext();){
|
||||
String line=(String)it2.next();
|
||||
line=line.replaceAll(" +", " ");
|
||||
String keyValue[]=line.split(" ");
|
||||
if(keyValue.length<9){
|
||||
log.error("2104 "+line+" length is short");
|
||||
continue;
|
||||
}
|
||||
|
||||
data_type.put(keyValue[8], keyValue[1]);
|
||||
|
||||
}
|
||||
log.info(" get "+folderName+" data successed");
|
||||
return data_type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* <一句话功能简述>
|
||||
* <功能详细描述>
|
||||
* @see [类、类#方法、类#成员]
|
||||
*/
|
||||
@Test
|
||||
public void testShowData(){
|
||||
|
||||
System.out.println(showFolderData("/home"));
|
||||
|
||||
}
|
||||
package com.platform.glusterfs;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
||||
import org.apache.log4j.PropertyConfigurator;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.platform.utils.Constant;
|
||||
|
||||
|
||||
public class ShowData {
|
||||
|
||||
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
|
||||
* @return
|
||||
* @see [类、类#方法、类#成员]
|
||||
*/
|
||||
public Map<String,String> showVolumeFiles(String volumeName){
|
||||
log.info("start show the data");
|
||||
Map<String,String> data_type=new HashMap<String, String>();
|
||||
/**
|
||||
* get mount point of volumeName
|
||||
*/
|
||||
String folderName=volumeName;
|
||||
|
||||
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
|
||||
|
||||
|
||||
* @param FolderName
|
||||
* @return
|
||||
*/
|
||||
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;
|
||||
|
||||
/*
|
||||
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){
|
||||
log.error("2101 command get result is null");
|
||||
return null;
|
||||
}
|
||||
if(reStrings.size()==0){
|
||||
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");
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* remove first line total number
|
||||
*/
|
||||
reStrings.remove(0);
|
||||
|
||||
for(Iterator it2 = reStrings.iterator();it2.hasNext();){
|
||||
String line=(String)it2.next();
|
||||
line=line.replaceAll(" +", " ");
|
||||
String keyValue[]=line.split(" ");
|
||||
if(keyValue.length<9){
|
||||
log.error("2104 "+line+" length is short");
|
||||
continue;
|
||||
}
|
||||
|
||||
data_type.put(keyValue[8], keyValue[1]);
|
||||
|
||||
}
|
||||
log.info(" get "+folderName+" data successed");
|
||||
return data_type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* <一句话功能简述>
|
||||
* <功能详细描述>
|
||||
* @see [类、类#方法、类#成员]
|
||||
*/
|
||||
@Test
|
||||
public void testShowData(){
|
||||
|
||||
System.out.println(showFolderData("/home"));
|
||||
|
||||
}
|
||||
}
|
@ -1,271 +1,334 @@
|
||||
package com.platform.glusterfs;
|
||||
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.PropertyConfigurator;
|
||||
|
||||
import com.platform.utils.Constant;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
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>();
|
||||
|
||||
/*
|
||||
* String command = "echo \"" + Constant.rootPasswd +
|
||||
* "\" |sudo -S gluster volume info|grep ^Volume.Name"; RunCommand
|
||||
* runCommand = new RunCommand(); List<String> reStrings =
|
||||
* runCommand.runCommandWait(command);
|
||||
*/
|
||||
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd,
|
||||
Constant.port, Constant.glusterVolumeInfo + "|grep ^Volume.Name");
|
||||
// System.out.println(reStrings);
|
||||
if(reStrings==null){
|
||||
log.error("1401 get result is null");
|
||||
return null;
|
||||
}
|
||||
if(reStrings.size()==0){
|
||||
log.error("1402 get result is nothing");
|
||||
return null;
|
||||
}
|
||||
if(reStrings.get(0).contains(Constant.noVolume)){
|
||||
reStrings.clear();
|
||||
return reStrings;
|
||||
}
|
||||
if (!(reStrings.get(0).split(":")[0].contains("Volume Name"))) {
|
||||
log.error("1403 get result string wrong");
|
||||
return null;
|
||||
}
|
||||
|
||||
String nameInfo = "";
|
||||
for (Iterator it = reStrings.iterator(); it.hasNext();) {
|
||||
String line = (String) it.next();
|
||||
String str[] = line.split(":");
|
||||
volNames.add(str[1].replaceAll(" ", ""));
|
||||
}
|
||||
return volNames;
|
||||
|
||||
}
|
||||
|
||||
public String getVolumeType(String volumeName) {
|
||||
log.info("get volume type");
|
||||
String volType = "";
|
||||
|
||||
/*
|
||||
* =======
|
||||
*
|
||||
* >>>>>>> origin/AlexKie String command = "echo \"" +
|
||||
* Constant.rootPasswd + "\" |sudo -S gluster volume info " +
|
||||
* volumeName + "|grep ^Type"; RunCommand runCommand = new RunCommand();
|
||||
* List<String> reStrings = runCommand.runCommandWait(command); <<<<<<<
|
||||
* HEAD
|
||||
*/
|
||||
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd,
|
||||
Constant.port, Constant.glusterVolumeInfo + volumeName + "|grep ^Type");
|
||||
// System.out.println(reStrings);
|
||||
if(reStrings==null){
|
||||
log.error("1501 get result is null");
|
||||
return null;
|
||||
}
|
||||
if(reStrings.size()==0){
|
||||
log.error("1502 get result is nothing");
|
||||
return null;
|
||||
}
|
||||
if (!(reStrings.get(0).split(":")[0].contains("Type"))) {
|
||||
log.error("1503 get result string wrong");
|
||||
return null;
|
||||
}
|
||||
|
||||
// System.out.println(reStrings);
|
||||
|
||||
for (Iterator it = reStrings.iterator(); it.hasNext();) {
|
||||
String line = (String) it.next();
|
||||
String str[] = line.split(":");
|
||||
volType = str[1];
|
||||
}
|
||||
volType=volType.replaceAll(" ", "");
|
||||
return volType;
|
||||
}
|
||||
|
||||
public String getVolumeStatus(String volumeName) {
|
||||
log.info("get volume status");
|
||||
String volStatus = "";
|
||||
|
||||
/*
|
||||
* =======
|
||||
*
|
||||
* >>>>>>> origin/AlexKie String command = "echo \"" +
|
||||
* Constant.rootPasswd + "\" |sudo -S gluster volume info " +
|
||||
* volumeName + "|grep ^Status"; RunCommand runCommand = new
|
||||
* RunCommand(); List<String> reStrings =
|
||||
* runCommand.runCommandWait(command); <<<<<<< HEAD
|
||||
*/
|
||||
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd,
|
||||
Constant.port, Constant.glusterVolumeInfo + "|grep ^Status");
|
||||
// System.out.println(reStrings);
|
||||
if(reStrings==null){
|
||||
log.error("1701 get result is null");
|
||||
return null;
|
||||
}
|
||||
if(reStrings.size()==0){
|
||||
log.error("1702 get result is nothing");
|
||||
return null;
|
||||
}
|
||||
if (!(reStrings.get(0).split(":")[0].contains("Status"))) {
|
||||
log.error("1703 get result string wrong");
|
||||
return null;
|
||||
}
|
||||
|
||||
for (Iterator it = reStrings.iterator(); it.hasNext();) {
|
||||
String line = (String) it.next();
|
||||
String str[] = line.split(":");
|
||||
volStatus = str[1].replaceAll(" ", "");
|
||||
}
|
||||
|
||||
return volStatus;
|
||||
}
|
||||
|
||||
public Double getVolumeAllSize(String volumeName) {
|
||||
log.info("get volume allSize");
|
||||
Double allSize = null;
|
||||
/*
|
||||
* ======= // waiting for testing... public Double
|
||||
* getVolumeAllSize(String volumeName) { log.info("get volume allSize");
|
||||
* Double allSize = null;
|
||||
*
|
||||
* >>>>>>> origin/AlexKie String command = "echo \"" +
|
||||
* Constant.rootPasswd + "\" |sudo -S df -h|grep " + volumeName +
|
||||
* "|awk '{print $2}'"; RunCommand runCommand = new RunCommand();
|
||||
* List<String> reStrings = runCommand.runCommandWait(command); <<<<<<<
|
||||
* HEAD
|
||||
*/
|
||||
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd,
|
||||
Constant.port, Constant.df + "|grep " + volumeName + "|awk '{print $2}'");
|
||||
// System.out.println(reStrings);
|
||||
if(reStrings==null){
|
||||
log.error("1801 get result is null");
|
||||
return null;
|
||||
}
|
||||
if(reStrings.size()==0){
|
||||
log.error("1802 get result is nothing");
|
||||
return null;
|
||||
}
|
||||
char flag = reStrings.get(0).trim().toCharArray()[0];
|
||||
if (flag < 48 || flag > 57) {
|
||||
log.error("1803 get result string wrong");
|
||||
return null;
|
||||
}
|
||||
|
||||
for (Iterator it = reStrings.iterator(); it.hasNext();) {
|
||||
String line = (String) it.next();
|
||||
String str[] = line.split("[^0-9]");
|
||||
allSize = Double.parseDouble(str[0]);
|
||||
}
|
||||
|
||||
return allSize;
|
||||
}
|
||||
|
||||
public Double getVolumeUseSize(String volumeName) {
|
||||
log.info("get volume used size");
|
||||
Double usedSize = null;
|
||||
|
||||
/*
|
||||
* =======
|
||||
*
|
||||
* >>>>>>> origin/AlexKie String command = "echo \"" +
|
||||
* Constant.rootPasswd + "\" |sudo -S df -h|grep " + volumeName +
|
||||
* "|awk '{print $3}'"; RunCommand runCommand = new RunCommand();
|
||||
* List<String> reStrings = runCommand.runCommandWait(command); <<<<<<<
|
||||
* HEAD
|
||||
*/
|
||||
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);
|
||||
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;
|
||||
}
|
||||
char flag = reStrings.get(0).trim().toCharArray()[0];
|
||||
if (flag < 48 || flag > 57) {
|
||||
log.error("1903 get result string wrong");
|
||||
return null;
|
||||
}
|
||||
|
||||
for (Iterator it = reStrings.iterator(); it.hasNext();) {
|
||||
String line = (String) it.next();
|
||||
String str[] = line.split("[^0-9]");
|
||||
|
||||
usedSize = Double.parseDouble(str[0]);
|
||||
}
|
||||
|
||||
return usedSize;
|
||||
}
|
||||
|
||||
public String getVolumeMountPoint(String volumeName) {
|
||||
log.info("get volume mountPoint");
|
||||
// String mountPoint = "";
|
||||
|
||||
/*
|
||||
* =======
|
||||
*
|
||||
* >>>>>>> origin/AlexKie String command = "echo \"" +
|
||||
* Constant.rootPasswd + "\" |sudo -S df -h|grep " + volumeName +
|
||||
* "|awk '{print $6}'"; RunCommand runCommand = new RunCommand();
|
||||
* List<String> reStrings = runCommand.runCommandWait(command); <<<<<<<
|
||||
* HEAD
|
||||
*/
|
||||
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd,
|
||||
Constant.port, Constant.df + "|grep " + volumeName + "|awk '{print $6}'");
|
||||
// System.out.println(reStrings);
|
||||
if(reStrings==null){
|
||||
log.error("11001 get result string wrong");
|
||||
return null;
|
||||
}
|
||||
if(reStrings.size()==0){
|
||||
log.error("11002 "+volumeName+" is no mountpoint");
|
||||
return null;
|
||||
}
|
||||
|
||||
char flag = reStrings.get(0).trim().toCharArray()[0];
|
||||
if (flag != '/') {
|
||||
log.error("11003 get result string wrong");
|
||||
return null;
|
||||
}
|
||||
|
||||
Iterator it = reStrings.iterator();
|
||||
String mountPoint = (String) it.next();
|
||||
mountPoint=mountPoint.replaceAll(" ", "");
|
||||
return mountPoint;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
PropertyConfigurator.configure("log4j.properties");
|
||||
|
||||
System.out.println(new VolumeInfo().showAllVolumeName());
|
||||
System.out.println(new VolumeInfo().getVolumeType("v1"));
|
||||
|
||||
System.out.println(new VolumeInfo().getVolumeStatus("v1"));
|
||||
System.out.println(new VolumeInfo().getVolumeMountPoint("v1"));
|
||||
|
||||
System.out.println(new VolumeInfo().getVolumeAllSize("v1"));
|
||||
System.out.println(new VolumeInfo().getVolumeUseSize("v1"));
|
||||
|
||||
}
|
||||
}
|
||||
package com.platform.glusterfs;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.PropertyConfigurator;
|
||||
import org.junit.Test;
|
||||
import org.omg.CosNaming.NamingContextExtPackage.StringNameHelper;
|
||||
|
||||
import com.platform.utils.Constant;
|
||||
import com.platform.utils.GanymedSSH;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class VolumeInfo {
|
||||
public static Logger log = Logger.getLogger(VolumeInfo.class);
|
||||
|
||||
/**
|
||||
* 显示所有volume名称
|
||||
* <功能详细描述>
|
||||
* @return
|
||||
* @see [类、类#方法、类#成员]
|
||||
*/
|
||||
public List<String> showAllVolumeName() {
|
||||
log.info("get volume name");
|
||||
List<String> volNames = new ArrayList<String>();
|
||||
|
||||
/*
|
||||
* String command = "echo \"" + Constant.rootPasswd +
|
||||
* "\" |sudo -S gluster volume info|grep ^Volume.Name"; RunCommand
|
||||
* runCommand = new RunCommand(); List<String> reStrings =
|
||||
* runCommand.runCommandWait(command);
|
||||
*/
|
||||
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser,
|
||||
Constant.rootPasswd, Constant.port, Constant.glusterVolumeInfo + "|grep ^Volume.Name");
|
||||
// System.out.println(reStrings);
|
||||
if (reStrings == null) {
|
||||
log.error("1401 get result is null");
|
||||
return null;
|
||||
}
|
||||
if (reStrings.size() == 0) {
|
||||
log.error("1402 get result is nothing");
|
||||
return null;
|
||||
}
|
||||
if (reStrings.get(0).contains(Constant.noVolume)) {
|
||||
reStrings.clear();
|
||||
return reStrings;
|
||||
}
|
||||
if (!(reStrings.get(0).split(":")[0].contains("Volume Name"))) {
|
||||
log.error("1403 get result string wrong");
|
||||
return null;
|
||||
}
|
||||
|
||||
String nameInfo = "";
|
||||
for (Iterator it = reStrings.iterator(); it.hasNext();) {
|
||||
String line = (String) it.next();
|
||||
String str[] = line.split(":");
|
||||
volNames.add(str[1].replaceAll(" ", ""));
|
||||
}
|
||||
return volNames;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 给定参数volume的名称获得volume的类型
|
||||
* <功能详细描述>
|
||||
* @param volumeName
|
||||
* @return
|
||||
* @see [类、类#方法、类#成员]
|
||||
*/
|
||||
public String getVolumeType(String volumeName) {
|
||||
log.info("get volume type");
|
||||
String volType = "";
|
||||
|
||||
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser,
|
||||
Constant.rootPasswd, Constant.port, Constant.glusterVolumeInfo + volumeName + "|grep ^Type");
|
||||
// System.out.println(reStrings);
|
||||
if (reStrings == null) {
|
||||
log.error("1501 get result is null");
|
||||
return null;
|
||||
}
|
||||
if (reStrings.size() == 0) {
|
||||
log.error("1502 get result is nothing");
|
||||
return null;
|
||||
}
|
||||
if (!(reStrings.get(0).split(":")[0].contains("Type"))) {
|
||||
log.error("1503 get result string wrong");
|
||||
return null;
|
||||
}
|
||||
|
||||
// System.out.println(reStrings);
|
||||
|
||||
for (Iterator it = reStrings.iterator(); it.hasNext();) {
|
||||
String line = (String) it.next();
|
||||
String str[] = line.split(":");
|
||||
volType = str[1];
|
||||
}
|
||||
volType = volType.replaceAll(" ", "");
|
||||
return volType;
|
||||
}
|
||||
|
||||
public String getVolumeStatus(String volumeName) {
|
||||
log.info("get volume status");
|
||||
String volStatus = "";
|
||||
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser,
|
||||
Constant.rootPasswd, Constant.port, Constant.glusterVolumeInfo + "|grep ^Status");
|
||||
// System.out.println(reStrings);
|
||||
if (reStrings == null) {
|
||||
log.error("1701 get result is null");
|
||||
return null;
|
||||
}
|
||||
if (reStrings.size() == 0) {
|
||||
log.error("1702 get result is nothing");
|
||||
return null;
|
||||
}
|
||||
if (!(reStrings.get(0).split(":")[0].contains("Status"))) {
|
||||
log.error("1703 get result string wrong");
|
||||
return null;
|
||||
}
|
||||
|
||||
for (Iterator it = reStrings.iterator(); it.hasNext();) {
|
||||
String line = (String) it.next();
|
||||
String str[] = line.split(":");
|
||||
volStatus = str[1].replaceAll(" ", "");
|
||||
}
|
||||
return volStatus;
|
||||
}
|
||||
|
||||
public Double getVolumeAllSize(String volumeName) {
|
||||
log.info("get volume allSize");
|
||||
Double allSize = null;
|
||||
/*
|
||||
* ======= // waiting for testing... public Double
|
||||
* getVolumeAllSize(String volumeName) { log.info("get volume allSize");
|
||||
* Double allSize = null;
|
||||
*
|
||||
* >>>>>>> origin/AlexKie String command = "echo \"" +
|
||||
* Constant.rootPasswd + "\" |sudo -S df -h|grep " + volumeName +
|
||||
* "|awk '{print $2}'"; RunCommand runCommand = new RunCommand();
|
||||
* List<String> reStrings = runCommand.runCommandWait(command); <<<<<<<
|
||||
* HEAD
|
||||
*/
|
||||
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd,
|
||||
Constant.port, Constant.df + "|grep " + volumeName + "|awk '{print $2}'");
|
||||
// System.out.println(reStrings);
|
||||
if(reStrings==null){
|
||||
log.error("1801 get result is null");
|
||||
return null;
|
||||
}
|
||||
if(reStrings.size()==0){
|
||||
log.error("1802 get result is nothing");
|
||||
return null;
|
||||
}
|
||||
char flag = reStrings.get(0).trim().toCharArray()[0];
|
||||
if (flag < 48 || flag > 57) {
|
||||
log.error("1803 get result string wrong");
|
||||
return null;
|
||||
}
|
||||
|
||||
for (Iterator it = reStrings.iterator(); it.hasNext();) {
|
||||
String line = (String) it.next();
|
||||
String str[] = line.split("[^0-9]");
|
||||
allSize = Double.parseDouble(str[0]);
|
||||
}
|
||||
|
||||
return allSize;
|
||||
}
|
||||
|
||||
public Double getVolumeUseSize(String volumeName) {
|
||||
log.info("get volume used size");
|
||||
Double usedSize = 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);
|
||||
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;
|
||||
}
|
||||
char flag = reStrings.get(0).trim().toCharArray()[0];
|
||||
if (flag < 48 || flag > 57) {
|
||||
log.error("1903 get result string wrong");
|
||||
return null;
|
||||
}
|
||||
|
||||
for (Iterator it = reStrings.iterator(); it.hasNext();) {
|
||||
String line = (String) it.next();
|
||||
String str[] = line.split("[^0-9]");
|
||||
|
||||
usedSize = Double.parseDouble(str[0]);
|
||||
}
|
||||
|
||||
return usedSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param volumeName
|
||||
* @return String ipAndpath[] = brick.split(":");
|
||||
String ip = ipAndpath[0];
|
||||
String path = ipAndpath[1];
|
||||
*/
|
||||
public List<String> getVolumeBricks(String volumeName) {
|
||||
log.info("get volume bricks");
|
||||
|
||||
String cmd = "gluster volume info " + volumeName + " |grep ^Brick'[0-9]\\+' |awk '{print $2}'";
|
||||
List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
|
||||
// System.out.println(reStrings);
|
||||
if (reStrings == null) {
|
||||
log.error("1601 get volume bricks wrong");
|
||||
return null;
|
||||
}
|
||||
|
||||
return reStrings;
|
||||
}
|
||||
|
||||
public List<String> getVolumeMountPoint(String volumeName) {
|
||||
log.info("get volume MountPoint");
|
||||
|
||||
List<String> reStrings = Constant.ganymedSSH.execCmdWait(Constant.hostIp, Constant.rootUser, Constant.rootPasswd,
|
||||
Constant.port, Constant.df + "|grep " + volumeName + "|awk '{print $6}'");
|
||||
// System.out.println(reStrings);
|
||||
if(reStrings==null){
|
||||
log.error("11001 get result string wrong");
|
||||
return null;
|
||||
}
|
||||
if(reStrings.size()==0){
|
||||
log.error("11002 "+volumeName+" is no mountpoint");
|
||||
return null;
|
||||
}
|
||||
|
||||
char flag = reStrings.get(0).trim().toCharArray()[0];
|
||||
if (flag != '/') {
|
||||
log.error("11003 get result string wrong");
|
||||
return null;
|
||||
}
|
||||
List<String> mountPoints = new ArrayList<>();
|
||||
for(String mountPoint:reStrings){
|
||||
mountPoint=mountPoint.replaceAll(" ", "");
|
||||
mountPoints.add(mountPoint);
|
||||
}
|
||||
return mountPoints;
|
||||
}
|
||||
|
||||
public Map<String, Double> getVolumebricksDataSize(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 = "du -d 0 " + path + "|awk '{print $1}'";
|
||||
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(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;
|
||||
|
||||
import com.platform.entities.FolderNode;
|
||||
|
||||
public class CacheTreeData {
|
||||
|
||||
private static FolderNode folders = null;
|
||||
|
||||
public static FolderNode getFolders() {
|
||||
return folders;
|
||||
}
|
||||
|
||||
public static void setFolders(FolderNode folders) {
|
||||
CacheTreeData.folders = folders;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
package com.platform.utils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.platform.entities.FolderNode;
|
||||
|
||||
public class CacheTreeData {
|
||||
|
||||
private static List<FolderNode> folders = null;
|
||||
|
||||
public static List<FolderNode> getFolders() {
|
||||
return folders;
|
||||
}
|
||||
|
||||
public static void setFolders(List<FolderNode> folders) {
|
||||
CacheTreeData.folders = folders;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,74 +1,74 @@
|
||||
package com.platform.utils;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import javax.servlet.ServletContextListener;
|
||||
|
||||
public class ConfigsLoader implements ServletContextListener {
|
||||
private static ConfigPropertyReader cReader = null;
|
||||
|
||||
@Override
|
||||
public void contextDestroyed(ServletContextEvent sEvent) {
|
||||
// TODO Auto-generated method stub
|
||||
Configs.CONSOLE_LOGGER.info("系统停止..");
|
||||
}
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
@Override
|
||||
public void contextInitialized(ServletContextEvent sEvent) {
|
||||
// TODO Auto-generated method stub
|
||||
Configs.CONSOLE_LOGGER.info("系统初始化..");
|
||||
String contextPath = sEvent.getServletContext().getRealPath("/")
|
||||
+ "WEB-INF/config/config.properties";
|
||||
this.cReader = ConfigPropertyReader.Builder(contextPath);
|
||||
init();
|
||||
new VolumeThread("").start();
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
Properties properties = cReader.getProperties();
|
||||
|
||||
Configs.KUBE_MASTER_URL = properties.getProperty("kubeMasterUrl");
|
||||
|
||||
Configs.COLLECT_USER_NAME = properties.getProperty("collect-user-name");
|
||||
|
||||
Configs.COLLECT_PASSWORD = properties.getProperty("collect-password");
|
||||
|
||||
Configs.COLLECT_SERVICE_NAME = properties
|
||||
.getProperty("collect-service-name");
|
||||
|
||||
Configs.GATHER_USER_NAME = properties.getProperty("gather-user-name");
|
||||
|
||||
Configs.GATHER_USER_PASSWORD = properties
|
||||
.getProperty("gather-user-password");
|
||||
|
||||
Configs.GATHER_PORT = properties.getProperty("gather-port");
|
||||
|
||||
Configs.GATHER_SERVICE_NAME = properties
|
||||
.getProperty("gather-service-name");
|
||||
|
||||
Configs.TABLE_SUFFIX = properties.getProperty("table-suffix");
|
||||
|
||||
Configs.EXTRACT_LOG_LOCALTION = properties
|
||||
.getProperty("extract-log-localtion");
|
||||
|
||||
Configs.GATHER_TABLESPACE_NAME = properties
|
||||
.getProperty("gather-tablespace-name");
|
||||
|
||||
Configs.GATHER_TABLESPACE_PATH = properties
|
||||
.getProperty("gather-tablespace-path");
|
||||
|
||||
Configs.GATHER_TABLE_PASSWORD=properties.getProperty("gather-table-user-password");
|
||||
}
|
||||
|
||||
public ConfigPropertyReader getcReader() {
|
||||
return cReader;
|
||||
}
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
public void setcReader(ConfigPropertyReader cReader) {
|
||||
this.cReader = cReader;
|
||||
}
|
||||
|
||||
}
|
||||
package com.platform.utils;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import javax.servlet.ServletContextListener;
|
||||
|
||||
public class ConfigsLoader implements ServletContextListener {
|
||||
private static ConfigPropertyReader cReader = null;
|
||||
|
||||
@Override
|
||||
public void contextDestroyed(ServletContextEvent sEvent) {
|
||||
// TODO Auto-generated method stub
|
||||
Configs.CONSOLE_LOGGER.info("系统停止..");
|
||||
}
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
@Override
|
||||
public void contextInitialized(ServletContextEvent sEvent) {
|
||||
// TODO Auto-generated method stub
|
||||
Configs.CONSOLE_LOGGER.info("系统初始化..");
|
||||
String contextPath = sEvent.getServletContext().getRealPath("/")
|
||||
+ "WEB-INF/config/config.properties";
|
||||
this.cReader = ConfigPropertyReader.Builder(contextPath);
|
||||
init();
|
||||
new ThreadVolume("").start();
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
Properties properties = cReader.getProperties();
|
||||
|
||||
Configs.KUBE_MASTER_URL = properties.getProperty("kubeMasterUrl");
|
||||
|
||||
Configs.COLLECT_USER_NAME = properties.getProperty("collect-user-name");
|
||||
|
||||
Configs.COLLECT_PASSWORD = properties.getProperty("collect-password");
|
||||
|
||||
Configs.COLLECT_SERVICE_NAME = properties
|
||||
.getProperty("collect-service-name");
|
||||
|
||||
Configs.GATHER_USER_NAME = properties.getProperty("gather-user-name");
|
||||
|
||||
Configs.GATHER_USER_PASSWORD = properties
|
||||
.getProperty("gather-user-password");
|
||||
|
||||
Configs.GATHER_PORT = properties.getProperty("gather-port");
|
||||
|
||||
Configs.GATHER_SERVICE_NAME = properties
|
||||
.getProperty("gather-service-name");
|
||||
|
||||
Configs.TABLE_SUFFIX = properties.getProperty("table-suffix");
|
||||
|
||||
Configs.EXTRACT_LOG_LOCALTION = properties
|
||||
.getProperty("extract-log-localtion");
|
||||
|
||||
Configs.GATHER_TABLESPACE_NAME = properties
|
||||
.getProperty("gather-tablespace-name");
|
||||
|
||||
Configs.GATHER_TABLESPACE_PATH = properties
|
||||
.getProperty("gather-tablespace-path");
|
||||
|
||||
Configs.GATHER_TABLE_PASSWORD=properties.getProperty("gather-table-user-password");
|
||||
}
|
||||
|
||||
public ConfigPropertyReader getcReader() {
|
||||
return cReader;
|
||||
}
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
public void setcReader(ConfigPropertyReader cReader) {
|
||||
this.cReader = cReader;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,24 +1,32 @@
|
||||
package com.platform.utils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Constant {
|
||||
public static String rootUser = "root";
|
||||
public static String rootPasswd = "root";
|
||||
public static String hostIp = "192.168.0.116";
|
||||
public static int port = 22;
|
||||
public static String glusterPeerStatus = "gluster peer status";
|
||||
public static String glusterVolumeInfo = "gluster volume info ";
|
||||
public static String df = "df -k ";
|
||||
public static String peerincluster_connected="PeerinCluster(Connected)";
|
||||
public static String distributed="distributed";
|
||||
public static String replica="replica";
|
||||
public static String stripe="stripe";
|
||||
public static String noVolume="No volumes present";
|
||||
public static GanymedSSH ganymedSSH=new GanymedSSH(hostIp, rootUser, rootPasswd, port);
|
||||
|
||||
/**
|
||||
* volume 获取的线程休眠时间
|
||||
*/
|
||||
public final static int get_volume_sleep_time = 300000;
|
||||
}
|
||||
package com.platform.utils;
|
||||
|
||||
|
||||
public class Constant {
|
||||
public static String rootUser = "root";
|
||||
public static String rootPasswd = "root";
|
||||
public static String hostIp = "192.168.0.110";
|
||||
// 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 ";
|
||||
public static String df = "df -k ";
|
||||
public static String peerincluster_connected="PeerinCluster(Connected)";
|
||||
public static String peerincluster_disconnected="PeerinCluster(Disconnected)";
|
||||
public static String distributed="distributed";
|
||||
public static String replica="replica";
|
||||
public static String stripe="stripe";
|
||||
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 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