web_backend_develope
lily 10 years ago
commit b8f723d05d

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

@ -17,6 +17,7 @@ jdbc.mysql.password=root
gather-user-name=system
# 密码
gather-user-password=oracle
#
gather-port=1521
#
@ -40,11 +41,15 @@ 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=
gather-table-user-password=
kubeMasterUrl=http://192.168.191.23:8080/
collect-user-name=system
collect-password=oracle
collect-service-name=orcl
gfs_control_ip=192.168.191.23

@ -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="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="ERROR" />
<param name="LevelMax" value="ERROR" />
</filter>
</appender>
<!-- 输出日志到文件 文件大小到达指定尺寸的时候产生一个新的文件 -->

@ -18,5 +18,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>

@ -45,6 +45,7 @@ public class BaseController {
System.out.println("URI"+request.getRequestURI());
request.setAttribute("ex", ex);
System.err.println("BaseController --exp " + ex);
new CustomException("base_code_", ex);
// 根据不同错误转向不同页面
if(ex instanceof CustomException) {
CustomException cuse = (CustomException) ex;

@ -27,8 +27,11 @@ public class Custom4exception {
public final static String threadVolume_Thread_Except = "3001001002";
/**
*
* ---
*/
public final static String threadVolume_Oracle_Except = "3002001002";
/** * SQL执行错误 */
public final static String OracleSQL_Except = "3002001002";
}

@ -4,6 +4,9 @@ package com.base;
import org.apache.log4j.Logger;
import com.platform.controller.DataModelController;
import com.platform.utils.Configs;
/**
* <>
* <>
@ -16,7 +19,7 @@ import org.apache.log4j.Logger;
public class CustomException extends Exception {
/** log4j */
public static Logger log = Logger.getRootLogger();
public static Logger log = Configs.DAILY_ROLLING_LOGGER;
/** 自定义异常信息-错误信息 */
private String msg;
@ -44,7 +47,6 @@ public class CustomException extends Exception {
public CustomException(String code,Exception e,Object... obj) {
super(code);
StringBuffer sbuf= new StringBuffer();
sbuf.append(msg);
this.code = code;
sbuf.append(code);
sbuf.append("\r\n");
@ -56,6 +58,8 @@ public class CustomException extends Exception {
}
// 记录原始的异常
if (null != e) {
sbuf.append(e.getMessage());
sbuf.append("\r\n");
StackTraceElement[] array = e.getStackTrace();
cause = e.getCause();
for (StackTraceElement stackTraceElement : array) {
@ -68,6 +72,7 @@ public class CustomException extends Exception {
Object[] array = obj;
sbuf.append("Object[] size : ");
sbuf.append(array.length);
sbuf.append("\r\n");
int forSize = 0;
if (Constant.CustomException_log_object_size < array.length) {
forSize = Constant.CustomException_log_object_size;
@ -89,7 +94,7 @@ public class CustomException extends Exception {
sbuf.append("\r\n");
// 是否 写入 文件
log.error(sbuf.toString());
log.debug(sbuf.toString());
}
/**

@ -0,0 +1,4 @@
3001001001=ThreadVolume\u7C7B\u67E5\u8BE2 volume\u5F02\u5E38
3001001002=ThreadVolume\u7C7B\u7EBF\u7A0B\u4F11\u7720\u5F02\u5E38
3002001002= \u62BD\u53D6\u6C47\u603B--\u7684-\u83B7\u53D6\u62BD\u53D6\u52A8\u4F5C\u5F02\u5E38
3002001002=SQL\u6267\u884C\u9519\u8BEF

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

@ -44,11 +44,16 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
jdbcType="VARCHAR" />
<result property="volumePath" column="volume_path" javaType="string"
jdbcType="VARCHAR" />
<result property="mark" column="mark" javaType="string"
jdbcType="VARCHAR" />
</resultMap>
<sql id="conditionsFilters">
<if test="dataType!=null">
AND data_details.data_type=#{dataType}
</if>
<if test="mark!=null and mark != ''">
AND data_details.mark=#{mark}
</if>
<if test="submittedBatch!=null">
AND
data_details.submitted_batch=#{submittedBatch}
@ -80,7 +85,7 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
<select id="getLimitedDataInfoEntities" parameterType="com.platform.entities.PagerOptions"
resultMap="getEntityByText">
SELECT
id,regionalism_code,city_name,district_name,system_code,system_name,data_type,data_version,submitted_batch,data_path,data_charset,collection_time,collector_name,collector_contacts,extract_status,data_year,start_year,end_year,volume_ip,volume_path
id,regionalism_code,city_name,district_name,system_code,system_name,data_type,data_version,submitted_batch,data_path,data_charset,collection_time,collector_name,collector_contacts,extract_status,data_year,start_year,end_year,volume_ip,volume_path,mark
FROM data_details
<where>
<include refid="conditionsFilters" />
@ -99,6 +104,14 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
LIMIT #{limit}
</if>
</select>
<!-- 获取数据符合筛选条件的全部记录信息 -->
<select id="findAll" resultMap="getEntityByText">
SELECT
id,regionalism_code,city_name,district_name,system_code,system_name,data_type,data_version,submitted_batch,data_path,data_charset,collection_time,collector_name,collector_contacts,extract_status,data_year,start_year,end_year,volume_ip,volume_path,mark
FROM data_details
ORDER BY data_details.id
</select>
<!-- 获取数据符合筛选条件的总记录条数 -->
<select id="getLimitedDataCount" resultType="java.lang.Integer"
@ -207,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},
@ -245,5 +258,15 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN"
</foreach>
and remove ='0'
</update>
<update id="updateExtract" parameterType="com.platform.entities.DataInfoEntity">
UPDATE
data_info
set extract_status = #{extractStatus}
<where>
id = #{id}
AND remove ='0'
</where>
</update>
</mapper>

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

File diff suppressed because it is too large Load Diff

@ -0,0 +1,68 @@
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.VolumeInitEntity;
import com.platform.service.IVolumeService;
import com.platform.utils.Configs;
@Controller
public class VolumeController extends BaseController{
public static Logger log = Configs.DAILY_ROLLING_LOGGER;
@Resource(name = "volumeService")
private IVolumeService volumeService;
@RequestMapping(value = "/volume/insert", method = RequestMethod.POST)
@ResponseBody
public void volumeInsert(HttpServletRequest res, HttpServletResponse req,
@RequestBody VolumeInitEntity entity) throws Exception {
Configs.CONSOLE_LOGGER.error("/oracle/{name}/extract");
volumeService.save(entity);
req.setStatus(200);
}
@RequestMapping(value = "/volume/{name}/delete", method = RequestMethod.POST)
@ResponseBody
public void volumeDelete(HttpServletRequest res, HttpServletResponse req,
@RequestBody VolumeInitEntity entity) throws Exception {
Configs.CONSOLE_LOGGER.error("/oracle/{name}/extract");
volumeService.delete(entity);
req.setStatus(200);
}
@RequestMapping(value = "/volume/{name}/start", method = RequestMethod.POST)
@ResponseBody
public void volumeStart(HttpServletRequest res, HttpServletResponse req,
@RequestBody VolumeInitEntity entity) throws Exception {
Configs.CONSOLE_LOGGER.error("/oracle/{name}/extract");
res.setCharacterEncoding("UTF-8");
volumeService.start(entity);
req.setStatus(200);
}
@RequestMapping(value = "/volume/{name}/stop", method = RequestMethod.POST)
@ResponseBody
public void volumeStop(HttpServletRequest res, HttpServletResponse req,
@RequestBody VolumeInitEntity entity) throws Exception {
Configs.CONSOLE_LOGGER.error("/oracle/{name}/extract");
res.setCharacterEncoding("UTF-8");
volumeService.stop(entity);
req.setStatus(200);
}
}

@ -20,8 +20,12 @@ public interface DataInfoDao {
List<String> getIdIsExist(List<Integer> list)throws Exception;
List<DataInfoEntity> findAll()throws Exception;
int removes(List<Integer> list)throws Exception;
int save(DataInfoEntity data) throws Exception;
int updateExtract(DataInfoEntity data) throws Exception;
}

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

@ -35,6 +35,10 @@ public class DataInfoEntity {
/** volume的path */
private String volumePath;
private String volumeType;
private String mark;
public DataInfoEntity() {
}
@ -251,6 +255,34 @@ public class DataInfoEntity {
this.volumePath = volumePath;
}
/**
* @return the volumeType
*/
public String getVolumeType() {
return volumeType;
}
/**
* @param volumeType the volumeType to set
*/
public void setVolumeType(String volumeType) {
this.volumeType = volumeType;
}
/**
* @return the mark
*/
public String getMark() {
return mark;
}
/**
* @param mark the mark to set
*/
public void setMark(String mark) {
this.mark = mark;
}
@Override
public String toString() {
return "id=" + this.id + " ,regionalismCode=" + this.regionalismCode

@ -6,6 +6,8 @@ import com.platform.utils.ConfigPropertyReader;
import com.platform.utils.Configs;
public class OracleConnectorParams {
private String dataId;
private String port;
private String ip;
private String name;
@ -43,6 +45,20 @@ public class OracleConnectorParams {
this.databaseName = properties.getProperty("collect-service-name");
}
/**
* @return the dataId
*/
public String getDataId() {
return dataId;
}
/**
* @param dataId the dataId to set
*/
public void setDataId(String dataId) {
this.dataId = dataId;
}
public String getPort() {
return port;
}

@ -1,9 +1,8 @@
package com.platform.entities;
import java.util.List;
public class PagerOptions {
private Integer currentPageNum; //当前页码
private Integer currentPageNum = 1; //当前页码
private String dataType; //数据类型
@ -28,9 +27,13 @@ public class PagerOptions {
private Integer priorTableSize; //前一次操作一页显示的数据条数
private String keyQuery;
//模糊查询字段
private String[] array;
private String volumeType;
//冷热区字段
private String mark;
public Integer getCurrentPageNum() {
return currentPageNum;
}
@ -154,5 +157,33 @@ public class PagerOptions {
public void setArray(String[] array) {
this.array = array;
}
/**
* @return the volumeType
*/
public String getVolumeType() {
return volumeType;
}
/**
* @param volumeType the volumeType to set
*/
public void setVolumeType(String volumeType) {
this.volumeType = volumeType;
}
/**
* @return the mark
*/
public String getMark() {
return mark;
}
/**
* @param mark the mark to set
*/
public void setMark(String mark) {
this.mark = mark;
}
}

@ -0,0 +1,120 @@
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;
private String mountPoint;
/**
* @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;
}
/**
* @return the mountPoint
*/
public String getMountPoint() {
return mountPoint;
}
/**
* @param mountPoint the mountPoint to set
*/
public void setMountPoint(String mountPoint) {
this.mountPoint = mountPoint;
}
}

@ -0,0 +1,55 @@
package com.platform.entities;
import java.util.List;
public class oracleForm {
private GatherOracleInfo target;
private List<OracleConnectorParams> inneed;
private String name;
/**
* @return the totalOracle
*/
public GatherOracleInfo getTarget() {
return target;
}
/**
* @param totalOracle the totalOracle to set
*/
public void setTarget(GatherOracleInfo target) {
this.target = target;
}
/**
* @return the collOracle
*/
public List<OracleConnectorParams> getInneed() {
return inneed;
}
/**
* @param collOracle the collOracle to set
*/
public void setInneed(List<OracleConnectorParams> inneed) {
this.inneed = inneed;
}
/**
* @return the totalOracleName
*/
public String getName() {
return name;
}
/**
* @param totalOracleName the totalOracleName to set
*/
public void setName(String name) {
this.name = name;
}
}

@ -26,7 +26,7 @@ public class ShowData {
* @see [##]
*/
public Map<String,String> showVolumeFiles(String volumeName){
log.info("start show the data");
// log.info("start show the data");
Map<String,String> data_type=new HashMap<String, String>();
/**
* get mount point of volumeName
@ -45,14 +45,13 @@ public class ShowData {
* @return
*/
public Map<String,String> showFolderData(String folderName){
log.info(" start get "+folderName+" data");
// log.info(" start get "+folderName+" data");
Map<String,String> data_type=new HashMap<String, String>();
String command="ls -l "+folderName;
/*
<<<<<<< HEAD
* RunCommand runCommand=new RunCommand(); List<String>
* reStrings=runCommand.runCommandWait(command);
*/
@ -86,7 +85,7 @@ public class ShowData {
data_type.put(keyValue[8], keyValue[1]);
}
log.info(" get "+folderName+" data successed");
// log.info(" get "+folderName+" data successed");
return data_type;
}
@ -98,7 +97,7 @@ public class ShowData {
* @see [##]
*/
public long getFolderSize(String folderPath) {
log.info("get " + folderPath + " Size ");
// log.info("get " + folderPath + " Size ");
String command = "du -k -d 0 "+folderPath+" | grep " + folderPath + "|awk \'{print $1}\'";
List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(command);
@ -111,8 +110,6 @@ public class ShowData {
return -1;
}
long size = Long.valueOf(reStrings.get(0));
return size;
}

@ -37,7 +37,7 @@ public class VolumeInfo {
* @see [##]
*/
public List<String> showAllVolumeName() {
log.info("get volume name");
// log.info("get volume name");
List<String> volNames = new ArrayList<String>();
/*
@ -84,7 +84,7 @@ public class VolumeInfo {
* @see [##]
*/
public String getVolumeType(String volumeName) {
log.info("get volume type");
// log.info("get volume type");
String volType = "";
List<String> reStrings = Constant.ganymedSSH
@ -123,7 +123,7 @@ public class VolumeInfo {
* @see [##]
*/
public String getVolumeStatus(String volumeName) {
log.info("get volume status");
// log.info("get volume status");
String volStatus = "";
String cmd = Constant.glusterVolumeInfo + " " + volumeName + " |grep ^Status";
List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
@ -162,7 +162,7 @@ public class VolumeInfo {
* @see [##]
*/
public Long getVolumeAvailableSize(String volumeName) throws Exception{
log.info("get volume availableSize");
// log.info("get volume availableSize");
Long allSize = 0L;
String cmd = Constant.df + " | grep " + volumeName + "|awk '{print $4}'";
@ -188,7 +188,7 @@ public class VolumeInfo {
* @see [##]
*/
public Long getVolumeUseSize(String volumeName) throws Exception{
log.info("get volume used size");
// log.info("get volume used size");
Long usedSize = 0L;
if (volumeIsExists(volumeName) == false) {
log.error("1901 " + volumeName + " is not exists!");
@ -219,7 +219,7 @@ public class VolumeInfo {
* @see [##]
*/
public List<String> getVolumeBricks(String volumeName) {
log.info("get volume bricks");
// 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);
@ -243,7 +243,7 @@ public class VolumeInfo {
* @see [##]
*/
public List<String> getVolumeMountPoint(String volumeName) {
log.info("get volume MountPoint");
// log.info("get volume MountPoint");
List<String> mountPoints = new ArrayList<>();
String cmd=Constant.df + "|grep " + volumeName + "|awk '{print $6}'";
List<String> reStrings = Constant.ganymedSSH.execCmdWaitAcquiescent(cmd);
@ -265,7 +265,7 @@ public class VolumeInfo {
}
public String getOneVolumeMountPoint(String volumeName) {
log.info("get one volume MountPoint");
// log.info("get one volume MountPoint");
String mountPoint=null;

@ -4,6 +4,7 @@ import io.fabric8.kubernetes.api.model.Container;
import io.fabric8.kubernetes.api.model.ContainerPort;
import io.fabric8.kubernetes.api.model.Pod;
import io.fabric8.kubernetes.api.model.ReplicationController;
import io.fabric8.kubernetes.client.Client;
import io.fabric8.kubernetes.client.Config;
import io.fabric8.kubernetes.client.ConfigBuilder;
import io.fabric8.kubernetes.client.DefaultKubernetesClient;
@ -19,7 +20,7 @@ import com.platform.utils.UtilsHelper;
public class SimpleKubeClient {
private KubernetesClient client;
private final static String DEFAULT_NAMESPACE = "default";
private final static String DEFAULT_NAMESPACE = "default";
public SimpleKubeClient() {
this.client = new DefaultKubernetesClient(Configs.KUBE_MASTER_URL);
@ -32,18 +33,22 @@ public class SimpleKubeClient {
public SimpleKubeClient(Config config) {
Config cf = config;
if (null == config) {
cf = new ConfigBuilder().withMasterUrl(Configs.KUBE_MASTER_URL).build();
cf = new ConfigBuilder().withMasterUrl(Configs.KUBE_MASTER_URL)
.build();
}
this.client = new DefaultKubernetesClient(cf);
}
// RollingUpdatercline
public void updateOrAddReplicasLabelById(String namespace,
String resourceId, String key, String value) {
KubernetesClient kubeClient = client;
if (checkClientNull())
kubeClient = new DefaultKubernetesClient(Configs.KUBE_MASTER_URL);
kubeClient.replicationControllers().inNamespace(namespace)
.withName(resourceId).edit().editMetadata()
.withName(resourceId).rolling().edit().editMetadata()
.addToLabels(key, value).endMetadata().done();
}

@ -1,76 +1,112 @@
package com.platform.oracle;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import com.platform.utils.Configs;
public class OracleConnector {
static {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Configs.CONSOLE_LOGGER.info("Oracle驱动加载成功");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static Connection ConnectionBuilder(String url, String user,
String password) {
Connection conn=null;
try {
conn = DriverManager.getConnection(url, user, password);
} catch (SQLException e) {
Configs.CONSOLE_LOGGER.info("创建oracle连接失败: [" + e.getMessage() + "]");
}
return conn;
}
public static boolean canConnect(String url, String user, String password) {
return (null != ConnectionBuilder(url, user, password));
}
public ResultSet getSQLExecResultSet(Connection conn, String sql) {
ResultSet resultSet = null;
try {
Statement statement = conn
.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
resultSet = statement.executeQuery(sql);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return resultSet;
}
public ResultSet getSQLExecResultSet(String url, String user,
String password, String sql) {
return getSQLExecResultSet(ConnectionBuilder(url, user, password), sql);
}
/**
* oracle
* @param conn
* @param sql
* @return
*/
public boolean execOracleSQL(Connection conn, String sql) {
boolean flag = false;
try {
Statement statement = conn.createStatement();
if (statement.executeUpdate(sql) > 0)
flag = true;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return flag;
}
package com.platform.oracle;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import com.base.Custom4exception;
import com.base.CustomException;
import com.platform.utils.Configs;
import com.platform.utils.FileOperateHelper;
public class OracleConnector {
static {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Configs.CONSOLE_LOGGER.info("Oracle驱动加载成功");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
new CustomException(Custom4exception.OracleSQL_Except, e);
e.printStackTrace();
}
}
public synchronized static Connection ConnectionBuilder(String url, String user,
String password) {
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() + "]");
}
return conn;
}
public synchronized static boolean canConnect(String url, String user, String password) {
return (null != ConnectionBuilder(url, user, password));
}
public synchronized static ResultSet getSQLExecResultSet(Connection conn, String sql, String filePath) {
ResultSet resultSet = null;
try {
Statement statement = conn
.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
resultSet = statement.executeQuery(sql);
FileOperateHelper
.fileWrite(filePath, sql+ "\r\n"+"OK \r\n");
} catch (SQLException e) {
FileOperateHelper
.fileWrite(filePath, sql+ "\r\n"+e.getMessage()+"\r\n");
new CustomException(Custom4exception.OracleSQL_Except, e);
}
return resultSet;
}
public synchronized static ResultSet getSQLExecResultSet(String url, String user,
String password, String sql, String filePath) {
return getSQLExecResultSet(ConnectionBuilder(url, user, password), sql, filePath);
}
/**
* oracle
* @param conn
* @param sql
* @return true:sql
*/
public synchronized static boolean execOracleSQL(Connection conn, String sql, String filePath) {
boolean flag = false;
try {
Statement statement = conn.createStatement();
statement.execute(sql);
flag = true;
FileOperateHelper
.fileWrite(filePath, sql+ "\r\n"+"OK \r\n");
} catch (SQLException e) {
flag = false;
FileOperateHelper
.fileWrite(filePath, sql+ "\r\n"+e.getMessage()+"\r\n");
new CustomException(Custom4exception.OracleSQL_Except, e);
}
return flag;
}
/**
* oracle
* @param conn
* @param sql
* @return true:1
*/
public synchronized static boolean execUpdateOracleSQL(Connection conn, String sql, String filePath) {
boolean flag = false;
try {
Statement statement = conn.createStatement();
if(statement.executeUpdate(sql) > 0)
{
flag = true;
FileOperateHelper
.fileWrite(filePath, sql+ "\r\n"+"OK \r\n");
}
} catch (SQLException e) {
flag = false;
FileOperateHelper
.fileWrite(filePath, sql+ "\r\n"+e.getMessage()+"\r\n");
new CustomException(Custom4exception.OracleSQL_Except, e, sql);
}
return flag;
}
}

@ -46,6 +46,11 @@ public class DataInfoServiceImp implements DataInfoService {
pagerOptions.setOffset(offset + 1);
List<DataInfoEntity> result = dfdDao
.getLimitedDataInfoEntities(pagerOptions);
if (null != result) {
for (DataInfoEntity dataInfoEntity : result) {
dataInfoEntity.setVolumeType(dataInfoEntity.getMark());
}
}
modelMap.addAttribute("data", result);
modelMap.addAttribute("length", count);
} catch (Exception e) {

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

Loading…
Cancel
Save