Merge branch 'web_backend_develope' of https://git.trustie.net/fhx569287825/aggregation-platform into develope

web_backend_develope
wu ming 10 years ago
commit 591512730f

@ -3,8 +3,17 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<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"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0"/>
<classpathentry kind="con" path="com.genuitec.runtime.library/com.genuitec.generic_6.0">
<attributes>
<attribute name="owner.project.facets" value="jst.web"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="build/classes"/>
</classpath>

@ -37,5 +37,6 @@
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
<nature>com.sysdeo.eclipse.tomcat.tomcatnature</nature>
</natures>
</projectDescription>

@ -41,11 +41,16 @@ jdbc.minEvictableIdleTimeMillis=300000
#
#==============================================================================================================
table-suffix=_20152016
extract-log-localtion=/home/log/
extract-log-localtion=/home/web_manage/log/
gather-tablespace-name=TS_TTSSS
gather-tablespace-path=1
gather-table-user-password=1
gather-tablespace-path=
gather-table-user-password=
kubeMasterUrl=http://192.168.0.110:8080/
collect-user-name=system
collect-password=oracle
collect-service-name=orcl
gfs_control_ip=192.168.0.110
gfs_control_rootPassWd=root

@ -8,17 +8,25 @@
<layout class="org.apache.log4j.TTCCLayout">
<param name="ConversionPattern" value="TTCCLayout"></param>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="DEBUG" />
<param name="LevelMax" value="ERROR" />
</filter>
</appender>
<!-- 输出日志到文件 每天一个文件 -->
<appender name="dailyRollingFile" class="org.apache.log4j.DailyRollingFileAppender">
<param name="Threshold" value="info"></param>
<param name="ImmediateFlush" value="true"></param>
<param name="File" value="D:\\logs/dailyRollingFile.log"></param>
<param name="File" value="/home/web_manage/logs/dailyRollingFile.log"></param>
<param name="DatePattern" value="'.'yyyy-MM-dd'.log'"></param>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss\} %-5p] [%t] {%c:%L}-%m%n"></param>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="DEBUG" />
<param name="LevelMax" value="ERROR" />
</filter>
</appender>
<!-- 输出日志到文件 文件大小到达指定尺寸的时候产生一个新的文件 -->

@ -11,6 +11,7 @@
<typeAlias alias="DataInfoEntityMoveTmp" type="com.platform.entities.DataInfoEntityMoveTmp"/>
<typeAlias alias="SystemEntity" type="com.platform.entities.SystemEntity"/>
<typeAlias alias="RegionalismEntity" type="com.platform.entities.RegionalismEntity"/>
<typeAlias alias="oracleForm" type="com.platform.entities.oracleForm"/>
</typeAliases>
<mappers>
<mapper resource="com/dao/mapper/data-details-mapper.xml" />
@ -18,5 +19,6 @@
<mapper resource="com/dao/mapper/dataInfoMoveTmpmapper.xml"/>
<mapper resource="com/dao/mapper/RegionalismMapper.xml"/>
<mapper resource="com/dao/mapper/SystemCodeMapper.xml"/>
<mapper resource="com/dao/mapper/VolumeMapper.xml"/>
</mappers>
</configuration>

@ -60,7 +60,7 @@
</listener>
<!-- 防止Spring内存溢出监听器 -->
<!-- <listener>
<listener>
<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
</listener> -->
</listener>
</web-app>

@ -30,7 +30,7 @@ import com.platform.utils.Configs;
public class BaseController {
/** log4j */
public static Logger log = Logger.getRootLogger();
public static Logger log = Configs.DAILY_ROLLING_LOGGER;
/**
* <> @ExceptionHandler----

@ -29,9 +29,12 @@ public class Custom4exception {
/**
* ---
*/
public final static String threadVolume_Oracle_Except = "3002001002";
public final static String threadVolume_Oracle_Except = "3002001001";
/** * SQL执行错误 */
public final static String OracleSQL_Except = "3002001002";
/** * MySQL错误 */
public final static String MySQL_Except = "3002002003";
}

@ -94,7 +94,7 @@ public class CustomException extends Exception {
sbuf.append("\r\n");
// 是否 写入 文件
log.debug(sbuf.toString());
log.error(sbuf.toString());
}
/**

@ -0,0 +1,95 @@
<?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.VolumeDao">
<resultMap id="getEntityByText" type="com.platform.entities.VolumeInitEntity">
<id property="id" column="id" javaType="int" jdbcType="INTEGER" />
<result property="name" column="name" javaType="string"
jdbcType="VARCHAR" />
<result property="ip" column="ip" javaType="string"
jdbcType="VARCHAR" />
<result property="path" column="path" javaType="string"
jdbcType="VARCHAR" />
<result property="mark" column="mark" javaType="string"
jdbcType="VARCHAR" />
</resultMap>
<!-- 获取数据全部记录信息 -->
<select id="findAll" resultType="com.platform.entities.VolumeInitEntity">
SELECT
id,name,ip,path,mark
FROM
volume_info
ORDER BY id
</select>
<update id="update" parameterType="com.platform.entities.VolumeInitEntity">
UPDATE
volume_info
<set >
<trim suffixOverrides=",">
<if test="name != null and name != ''">
name= #{name},
</if>
<if test="ip != null and ip != ''">
ip= #{ip},
</if>
<if test="path != null and path != ''">
path= #{path},
</if>
<if test="mark != null and mark != ''">
mark= #{mark},
</if>
</trim>
</set>
<where>
id = #{id}
</where>
</update>
<insert id="save" parameterType="com.platform.entities.VolumeInitEntity">
INSERT INTO
volume_info(
<trim suffixOverrides=",">
<if test="name != null and name != ''">
name,
</if>
<if test="ip != null and ip != ''">
ip,
</if>
<if test="path != null and path != ''">
path,
</if>
<if test="mark != null and mark != ''">
mark,
</if>
</trim>
)
VALUES(
<trim suffixOverrides=",">
<if test="name != null and name != ''">
#{name},
</if>
<if test="ip != null and ip != ''">
#{ip},
</if>
<if test="path != null and path != ''">
#{path},
</if>
<if test="mark != null and mark != ''">
#{mark},
</if>
</trim>
)
</insert>
<delete id="remove" parameterType="java.lang.String">
DELETE FROM
volume_info
WHERE
name = #{name}
</delete>
</mapper>

@ -76,7 +76,7 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
</if>
<if test="array !=null and array.length > 0">
<foreach collection="array" item="item" index="index">
AND CONCAT(regionalism_code,system_code,city_name,district_name,system_name) LIKE CONCAT('%',CONCAT(#{item},'%'))
AND CONCAT(regionalism_code,system_code,city_name,district_name,system_name,data_year) LIKE CONCAT('%',CONCAT(#{item},'%'))
</foreach>
</if>
</sql>
@ -220,10 +220,10 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
#{year},
</if>
<if test="startYear != null and startYear != ''">
#{start_year},
#{startYear},
</if>
<if test="endYear != null and endYear != ''">
#{end_year},
#{endYear},
</if>
<if test="volumeIp != null and volumeIp != ''">
#{volumeIp},

@ -49,7 +49,7 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="Base_Column_List">
regionalism_code,system_code,dst_path,lasttime,fkid
regionalism_code,system_code,dst_path,lasttime,fkid,dst_volume_ip,dst_volume_path
</sql>
<!-- 获取数据全部记录信息 -->
@ -120,6 +120,12 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
<if test="fkid > 0 ">
fkid,
</if>
<if test="dstVolumeIp != null and dstVolumeIp != ''">
dst_volume_ip,
</if>
<if test="dstVolumePath != null and dstVolumePath != ''">
dst_volume_path,
</if>
</trim>
)
VALUES(
@ -146,7 +152,13 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
#{lastTime},
</if>
<if test="fkid > 0 ">
#{fkid),
#{fkid},
</if>
<if test="dstVolumeIp != null and dstVolumeIp != ''">
#{dstVolumeIp},
</if>
<if test="dstVolumePath != null and dstVolumePath != ''">
#{dstVolumePath},
</if>
</trim>
)
@ -156,7 +168,7 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
INSERT INTO move_data_tmp ( <include refid="Base_Column_List" /> )
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{item.regionalismCode,jdbcType=VARCHAR},#{item.systemCode,jdbcType=INTEGER},#{item.dstPath,jdbcType=VARCHAR},#{item.lastTime,jdbcType=VARCHAR},#{item.fkid})
(#{item.regionalismCode,jdbcType=VARCHAR},#{item.systemCode,jdbcType=INTEGER},#{item.dstPath,jdbcType=VARCHAR},#{item.lastTime,jdbcType=VARCHAR},#{item.fkid},#{item.dstVolumeIp},#{item.dstVolumePath})
</foreach>
</select>

@ -94,7 +94,7 @@ public class DataModelController extends BaseController {
PagerOptions pagerOptions = (PagerOptions) UtilsHelper
.newObjAndSetAttrsByClass(PagerOptions.class, params);
//冷热区查询字段mark
pagerOptions.setMark(String.valueOf(pagerOptions.getVolumeType()));
pagerOptions.setMark(pagerOptions.getVolumeType());
return dfs.getPagerTableData(pagerOptions);
}

@ -0,0 +1,53 @@
package com.platform.controller;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.base.BaseController;
import com.platform.entities.VolumeEntity;
import com.platform.entities.VolumeForm;
import com.platform.entities.VolumeInitEntity;
import com.platform.service.IVolumeService;
import com.platform.utils.Configs;
import com.platform.utils.ThreadVolume;
import com.platform.utils.ThreadVolumeImm;
@Controller
public class VolumeController extends BaseController{
public static Logger log = Configs.DAILY_ROLLING_LOGGER;
@Resource(name = "volumeService")
private IVolumeService volumeService;
@RequestMapping(value = "/volume/update", method = RequestMethod.POST)
@ResponseBody
public void volumeUpdate(HttpServletRequest res, HttpServletResponse req,
@RequestBody VolumeEntity form) throws Exception {
Configs.CONSOLE_LOGGER.error("/oracle/update");
volumeService.save(form);
req.setStatus(200);
new ThreadVolumeImm("ThreadVolumeImm-in-VolumeController-update").start();
}
@RequestMapping(value = "/volume/delete", method = RequestMethod.POST)
@ResponseBody
public void volumeDelete(HttpServletRequest res, HttpServletResponse req,
@RequestBody VolumeEntity entity) throws Exception {
Configs.CONSOLE_LOGGER.error("/oracle/delete");
volumeService.delete(entity);
req.setStatus(200);
new ThreadVolumeImm("ThreadVolumeImm-in-VolumeController-delete").start();
}
}

@ -0,0 +1,27 @@
package com.platform.dao;
import java.util.List;
import org.springframework.stereotype.Repository;
import com.platform.entities.VolumeInitEntity;
/**
* @author chen
*
*/
@Repository(value = "volumeDao")
public interface VolumeDao {
/**
* @return
* @throws Exception
*/
List<VolumeInitEntity> findAll() throws Exception;
int update(VolumeInitEntity data) throws Exception;
int save(VolumeInitEntity data) throws Exception;
int remove(String name) throws Exception;
}

@ -23,7 +23,7 @@ public class DataInfoEntity {
private String collectorName; // 采集人姓名
private String year; // 数据年度
/** 是否抽取 */
/** 是否抽取 0标示为未汇总1标示汇总中2标示汇总完成 */
private int extractStatus;
/** 数据年度起始 */
private String startYear;
@ -35,7 +35,7 @@ public class DataInfoEntity {
/** volume的path */
private String volumePath;
private int volumeType;
private String volumeType;
private String mark;
@ -258,14 +258,14 @@ public class DataInfoEntity {
/**
* @return the volumeType
*/
public int getVolumeType() {
public String getVolumeType() {
return volumeType;
}
/**
* @param volumeType the volumeType to set
*/
public void setVolumeType(int volumeType) {
public void setVolumeType(String volumeType) {
this.volumeType = volumeType;
}

@ -37,7 +37,7 @@ public class VolumeEntity {
private String path;
/** * exist正常返回状态Started,Stopped,Created */
private String status;
private boolean status;
private String type;
@ -103,17 +103,18 @@ public class VolumeEntity {
this.path = path;
}
/**
* @return the status
*/
public String getStatus() {
public boolean isStatus() {
return status;
}
/**
* @param status the status to set
*/
public void setStatus(String status) {
public void setStatus(boolean status) {
this.status = status;
}
@ -159,4 +160,5 @@ public class VolumeEntity {
this.brick = brick;
}
}

@ -0,0 +1,23 @@
package com.platform.entities;
import java.util.List;
public class VolumeForm {
List<VolumeEntity> volumes;
/**
* @return the volumes
*/
public List<VolumeEntity> getVolumes() {
return volumes;
}
/**
* @param volumes the volumes to set
*/
public void setVolumes(List<VolumeEntity> volumes) {
this.volumes = volumes;
}
}

@ -0,0 +1,104 @@
package com.platform.entities;
import java.util.List;
public class VolumeInitEntity {
private int id;
private String name;
private String ip;
/** 挂载点 */
private String path;
private String mark;
private List<String> bricks;
/**
* @return the id
*/
public int getId() {
return id;
}
/**
* @param id the id to set
*/
public void setId(int id) {
this.id = id;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the ip
*/
public String getIp() {
return ip;
}
/**
* @param ip the ip to set
*/
public void setIp(String ip) {
this.ip = ip;
}
/**
* @return the path
*/
public String getPath() {
return path;
}
/**
* @param path the path to set
*/
public void setPath(String path) {
this.path = path;
}
/**
* @return the mark
*/
public String getMark() {
return mark;
}
/**
* @param mark the mark to set
*/
public void setMark(String mark) {
this.mark = mark;
}
/**
* @return the bricks
*/
public List<String> getBricks() {
return bricks;
}
/**
* @param bricks the bricks to set
*/
public void setBricks(List<String> bricks) {
this.bricks = bricks;
}
}

@ -5,6 +5,7 @@ package com.platform.glusterfs;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@ -16,6 +17,8 @@ import org.apache.log4j.PropertyConfigurator;
import com.platform.utils.Constant;
import ch.ethz.ssh2.Connection;
/**
*
* @author liliy
@ -32,12 +35,13 @@ public class ClusterInfo {
* ipPeerinCluster(Connected)
* ipPeerinCluster(Disconnected)
* @return
* @throws IOException
* @see [##]
*/
public Map<String, String> showClusterInfo() {
log.info("get cluster info");
// log.info("get cluster info");
Map<String, String> peerIps = new HashMap<String, String>();
peerIps.put(Constant.hostIp, Constant.peerincluster_connected);
List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(Constant.glusterPeerStatus);
if (reStrings == null) {
log.error("1101 command get result is null");
@ -47,9 +51,12 @@ public class ClusterInfo {
log.error("1102 command get result is nothing");
return null;
}
if (reStrings.get(0).contains("No peers present")) {
return peerIps;
}
if (!(reStrings.get(0).split(":")[0].contains("Number of Peers"))) {
log.error("1103 get result string wrong");
return null;
}
@ -86,6 +93,28 @@ public class ClusterInfo {
}
}
// for (Map.Entry<String, String> entry:peerIps.entrySet()){
// String key=entry.getKey();
// if(key.equals(Constant.hostIp)){
// continue;
// }
// String value=entry.getValue();
// if(Constant.ganymedSSH.otherConns==null){
// Constant.ganymedSSH.otherConns=new HashMap<String,Connection>();
// }
// if(!Constant.ganymedSSH.otherConns.containsKey(key)){
// Connection connection=null;
// try {
// connection = Constant.ganymedSSH.getOpenedConnection(key, Constant.rootUser, Constant.rootPasswd, Constant.port);
// } catch (IOException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// Constant.ganymedSSH.otherConns.put(key,connection);
// }
// }
return peerIps;
}

@ -61,7 +61,7 @@ public class CopyData {
log.info("3202 "+sourceFolderName+" is not exists");
return -2;
}
String command = "cp -r " + sourceFolderName+" "+destFolderName;
String command = "cp -rp " + sourceFolderName+" "+destFolderName;
Constant.ganymedSSH.execCmdNoWaitAcquiescent(command);
@ -92,7 +92,7 @@ public class CopyData {
log.info("3202 "+sourceFolderName+"/"+fileName+" is not exists");
return -2;
}
String command = "cp -r " + sourceFolderName + "/" + fileName+" "+destFolderName;
String command = "cp -rp " + sourceFolderName + "/" + fileName+" "+destFolderName;
/*
* RunCommand runCommand = new RunCommand();

@ -280,7 +280,7 @@ public class SetVolume {
if (new VolumeInfo().getVolumeStatus(volumeName).equals("Stopped")) {
log.error("3502 the volume is already stoped");
System.out.println("3502 the volume is already stoped");
return -1;
return 0;
} else {
String command = "echo -e \"y\"| gluster volume stop " + volumeName;
List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(command);

@ -23,7 +23,7 @@ public class SizeInfo {
* @return
*/
public long showAllSize() {
log.info("get AllSize ");
// log.info("get AllSize ");
List<String> volumeNames = volumeInfo.showAllVolumeName();
if (volumeNames == null) {
log.error("1201 showAllVolumeName error");

@ -37,7 +37,7 @@ public class VolumeInfo {
* @see [##]
*/
public List<String> showAllVolumeName() {
// log.info("get volume name");
// log.info(Constant.ganymedSSH+"get volume name");
List<String> volNames = new ArrayList<String>();
/*
@ -46,6 +46,7 @@ public class VolumeInfo {
* runCommand = new RunCommand(); List<String> reStrings =
* runCommand.runCommandWait(command);
*/
List<String> reStrings = Constant.ganymedSSH
.execCmdWaitAcquiescent(Constant.glusterVolumeInfo + "|grep ^Volume.Name");
// System.out.println(reStrings);
@ -176,7 +177,12 @@ public class VolumeInfo {
log.error("1801 " + volumeName + " is not exists!");
return -1L;
}
allSize = Long.parseLong(reStrings.get(0));
Pattern pattern2 = Pattern.compile("^\\d+$");
Matcher matcher2 = pattern2.matcher(reStrings.get(0));
// 如果是数字
if (matcher2.find()) {
allSize = Long.parseLong(reStrings.get(0));
}
return allSize;
}
@ -207,7 +213,12 @@ public class VolumeInfo {
log.error("1902 " + volumeName + " is not exists!");
return -1L;
}
usedSize = Long.parseLong(reStrings.get(0));
Pattern pattern2 = Pattern.compile("^\\d+$");
Matcher matcher2 = pattern2.matcher(reStrings.get(0));
// 如果是数字
if (matcher2.find()) {
usedSize = Long.parseLong(reStrings.get(0));
}
return usedSize;
}

@ -8,6 +8,7 @@ import java.sql.Statement;
import com.base.Custom4exception;
import com.base.CustomException;
import com.platform.entities.OracleConnectorParams;
import com.platform.utils.Configs;
import com.platform.utils.FileOperateHelper;
@ -25,19 +26,23 @@ public class OracleConnector {
public synchronized static Connection ConnectionBuilder(String url, String user,
String password) {
String password, OracleConnectorParams oc) {
Connection conn=null;
try {
conn = DriverManager.getConnection(url, user, password);
} catch (SQLException e) {
new CustomException(Custom4exception.OracleSQL_Except, e);
Configs.CONSOLE_LOGGER.info("创建oracle连接失败: [" + e.getMessage() + "]");
if (null != oc) {
FileOperateHelper.fileWrite(Configs.EXTRACT_LOG_LOCALTION
+ oc.getName(), "创建oracle连接失败: [" + e.getMessage() + "]\r\n");
}
}
return conn;
}
public synchronized static boolean canConnect(String url, String user, String password) {
return (null != ConnectionBuilder(url, user, password));
return (null != ConnectionBuilder(url, user, password, null));
}
public synchronized static ResultSet getSQLExecResultSet(Connection conn, String sql, String filePath) {
@ -60,7 +65,7 @@ public class OracleConnector {
public synchronized static ResultSet getSQLExecResultSet(String url, String user,
String password, String sql, String filePath) {
return getSQLExecResultSet(ConnectionBuilder(url, user, password), sql, filePath);
return getSQLExecResultSet(ConnectionBuilder(url, user, password, null), sql, filePath);
}
/**

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save