1:按照ysp数据库文档修改各个业务类型对应的表名
2:修改maatConfig中域和分组map为list<map> 3:删除maat.xml中关于redisDBIndex的配置
This commit is contained in:
@@ -6,6 +6,7 @@ encoding//src/main/resources/log4j.properties=UTF-8
|
||||
encoding//src/main/resources/matt.properties=UTF-8
|
||||
encoding//src/main/resources/nis.properties=UTF-8
|
||||
encoding//src/main/resources/redis.properties=UTF-8
|
||||
encoding//src/main/resources/serviceTable.properties=UTF-8
|
||||
encoding//src/main/resources/table.properties=UTF-8
|
||||
encoding//src/main/webapp/WEB-INF/include/header.jsp=UTF-8
|
||||
encoding//src/main/webapp/WEB-INF/tlds/fns.tld=UTF-8
|
||||
|
||||
@@ -8,7 +8,7 @@ public class MaatXmlExpr implements Serializable {
|
||||
private String keyExpression;
|
||||
private String valueExpression;
|
||||
private Integer type;
|
||||
private Integer redisDB;
|
||||
//private Integer redisDB;
|
||||
|
||||
public String getKeyExpression() {
|
||||
return keyExpression;
|
||||
@@ -26,9 +26,6 @@ public class MaatXmlExpr implements Serializable {
|
||||
this.valueExpression = valueExpression;
|
||||
}
|
||||
|
||||
public Integer getRedisDB() {
|
||||
return redisDB;
|
||||
}
|
||||
|
||||
public Integer getType() {
|
||||
return type;
|
||||
@@ -38,8 +35,5 @@ public class MaatXmlExpr implements Serializable {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void setRedisDB(Integer redisDB) {
|
||||
this.redisDB = redisDB;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ public class MaatXmlSeq implements Serializable {
|
||||
|
||||
private String sequenceKey;
|
||||
private Integer operation;
|
||||
private Integer redisDB;
|
||||
// private Integer redisDB;
|
||||
|
||||
public String getSequenceKey() {
|
||||
return sequenceKey;
|
||||
@@ -26,12 +26,4 @@ public class MaatXmlSeq implements Serializable {
|
||||
this.operation = operation;
|
||||
}
|
||||
|
||||
public Integer getRedisDB() {
|
||||
return redisDB;
|
||||
}
|
||||
|
||||
public void setRedisDB(Integer redisDB) {
|
||||
this.redisDB = redisDB;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.nis.domain.restful;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -22,23 +23,31 @@ public class MaatConfig implements Serializable {
|
||||
/**
|
||||
* 分组配置
|
||||
*/
|
||||
private Map<String, String> groupMap;
|
||||
private List<Map<String, String>> groupMapList;
|
||||
/**
|
||||
* ip域配置
|
||||
*/
|
||||
private Map<String, String> ipRegionMap;
|
||||
private List<Map<String, String>> ipRegionMapList;
|
||||
/**
|
||||
* 数值域配置
|
||||
*/
|
||||
private Map<String, String> numRegionMap;
|
||||
private List<Map<String, String>> numRegionMapList;
|
||||
/**
|
||||
* 字符串域配置
|
||||
*/
|
||||
private Map<String, String> strRegionMap;
|
||||
private List<Map<String, String>> strRegionMapList;
|
||||
/**
|
||||
* 增强字符串域配置
|
||||
*/
|
||||
private Map<String, String> strStrRegionMap;
|
||||
private List<Map<String, String>> strStrRegionMapList;
|
||||
/**
|
||||
* 文件摘要类域配置
|
||||
*/
|
||||
private List<Map<String, String>> fileDigestRegionMapList;
|
||||
/**
|
||||
* 文本相似性域配置
|
||||
*/
|
||||
private List<Map<String, String>> fileLikeRegionMapList;
|
||||
|
||||
/**
|
||||
* 业务类型
|
||||
@@ -53,44 +62,60 @@ public class MaatConfig implements Serializable {
|
||||
this.compileMap = compileMap;
|
||||
}
|
||||
|
||||
public Map<String, String> getGroupMap() {
|
||||
return groupMap;
|
||||
public List<Map<String, String>> getGroupMapList() {
|
||||
return groupMapList;
|
||||
}
|
||||
|
||||
public void setGroupMap(Map<String, String> groupMap) {
|
||||
this.groupMap = groupMap;
|
||||
public void setGroupMapList(List<Map<String, String>> groupMapList) {
|
||||
this.groupMapList = groupMapList;
|
||||
}
|
||||
|
||||
public Map<String, String> getIpRegionMap() {
|
||||
return ipRegionMap;
|
||||
public List<Map<String, String>> getIpRegionMapList() {
|
||||
return ipRegionMapList;
|
||||
}
|
||||
|
||||
public void setIpRegionMap(Map<String, String> ipRegionMap) {
|
||||
this.ipRegionMap = ipRegionMap;
|
||||
public void setIpRegionMapList(List<Map<String, String>> ipRegionMapList) {
|
||||
this.ipRegionMapList = ipRegionMapList;
|
||||
}
|
||||
|
||||
public Map<String, String> getNumRegionMap() {
|
||||
return numRegionMap;
|
||||
public List<Map<String, String>> getNumRegionMapList() {
|
||||
return numRegionMapList;
|
||||
}
|
||||
|
||||
public void setNumRegionMap(Map<String, String> numRegionMap) {
|
||||
this.numRegionMap = numRegionMap;
|
||||
public void setNumRegionMapList(List<Map<String, String>> numRegionMapList) {
|
||||
this.numRegionMapList = numRegionMapList;
|
||||
}
|
||||
|
||||
public Map<String, String> getStrRegionMap() {
|
||||
return strRegionMap;
|
||||
public List<Map<String, String>> getStrRegionMapList() {
|
||||
return strRegionMapList;
|
||||
}
|
||||
|
||||
public void setStrRegionMap(Map<String, String> strRegionMap) {
|
||||
this.strRegionMap = strRegionMap;
|
||||
public void setStrRegionMapList(List<Map<String, String>> strRegionMapList) {
|
||||
this.strRegionMapList = strRegionMapList;
|
||||
}
|
||||
|
||||
public Map<String, String> getStrStrRegionMap() {
|
||||
return strStrRegionMap;
|
||||
public List<Map<String, String>> getStrStrRegionMapList() {
|
||||
return strStrRegionMapList;
|
||||
}
|
||||
|
||||
public void setStrStrRegionMap(Map<String, String> strStrRegionMap) {
|
||||
this.strStrRegionMap = strStrRegionMap;
|
||||
public void setStrStrRegionMapList(List<Map<String, String>> strStrRegionMapList) {
|
||||
this.strStrRegionMapList = strStrRegionMapList;
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getFileDigestRegionMapList() {
|
||||
return fileDigestRegionMapList;
|
||||
}
|
||||
|
||||
public void setFileDigestRegionMapList(List<Map<String, String>> fileDigestRegionMapList) {
|
||||
this.fileDigestRegionMapList = fileDigestRegionMapList;
|
||||
}
|
||||
|
||||
public List<Map<String, String>> getFileLikeRegionMapList() {
|
||||
return fileLikeRegionMapList;
|
||||
}
|
||||
|
||||
public void setFileLikeRegionMapList(List<Map<String, String>> fileLikeRegionMapList) {
|
||||
this.fileLikeRegionMapList = fileLikeRegionMapList;
|
||||
}
|
||||
|
||||
public Integer getService() {
|
||||
|
||||
154
src/main/java/com/nis/domain/restful/MaatRelation.java
Normal file
154
src/main/java/com/nis/domain/restful/MaatRelation.java
Normal file
@@ -0,0 +1,154 @@
|
||||
package com.nis.domain.restful;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class MaatRelation implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Map<Long, List<Long>> compileAndGroupMap;
|
||||
private Map<Long, List<Long>> groupAndCompileMap;
|
||||
// private Map<Long, List<Long>> regionAndGroupMap;
|
||||
private Map<Long, List<Long>> groupAndRegionMap;
|
||||
|
||||
public Map<Long, List<Long>> getCompileAndGroupMap() {
|
||||
return compileAndGroupMap;
|
||||
}
|
||||
|
||||
public void setCompileAndGroupMap(Map<Long, List<Long>> compileAndGroupMap) {
|
||||
this.compileAndGroupMap = compileAndGroupMap;
|
||||
}
|
||||
|
||||
public Map<Long, List<Long>> getGroupAndCompileMap() {
|
||||
return groupAndCompileMap;
|
||||
}
|
||||
|
||||
public void setGroupAndCompileMap(Map<Long, List<Long>> groupAndCompileMap) {
|
||||
this.groupAndCompileMap = groupAndCompileMap;
|
||||
}
|
||||
|
||||
public Map<Long, List<Long>> getGroupAndRegionMap() {
|
||||
return groupAndRegionMap;
|
||||
}
|
||||
|
||||
public void setGroupAndRegionMap(Map<Long, List<Long>> groupAndRegionMap) {
|
||||
this.groupAndRegionMap = groupAndRegionMap;
|
||||
}
|
||||
|
||||
public static void removKey(MaatRelation maatRelation, long compileId) {
|
||||
|
||||
if (maatRelation.getCompileAndGroupMap().containsKey(compileId)) {
|
||||
List<Long> list = maatRelation.getCompileAndGroupMap().get(compileId);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
Long groupId = list.get(i);
|
||||
// }
|
||||
// for (Long groupId: list.size()) {
|
||||
if (maatRelation.getGroupAndCompileMap().containsKey(groupId)) {
|
||||
// && maatRelation.getGroupAndCompileMap().get(groupId).size() == 1
|
||||
// && maatRelation.getGroupAndCompileMap().get(groupId).get(0).longValue() ==
|
||||
// compileId) {
|
||||
List<Long> compileIdList = maatRelation.getGroupAndCompileMap().get(groupId);
|
||||
if (compileIdList.size() == 1) {// 当前的groupid只属于当前的compileid,没有被分组复用,需要将编译配置,分组关系,域配置,置无效
|
||||
for (Long id : compileIdList) {
|
||||
if (id.longValue() == compileId) {
|
||||
// 这个group没有被分组复用,所以需要将这个组下面的域配置置为无效,组也要置为无效
|
||||
if (maatRelation.getGroupAndRegionMap().containsKey(groupId)) {
|
||||
// 把当前组置为无效,把当前组下的所有域置为无效
|
||||
maatRelation.getGroupAndRegionMap().remove(groupId);// 删除组对应的域
|
||||
maatRelation.getGroupAndCompileMap().remove(groupId);// 删除当前组所对应的编译
|
||||
// maatRelation.getCompileAndGroupMap().get(compileId).indexOf(groupId);
|
||||
// maatRelation.getCompileAndGroupMap().get(compileId)
|
||||
list.remove(maatRelation.getCompileAndGroupMap().get(compileId).indexOf(groupId));// 删除编译下面的组
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// 这个组对应了多个编译配置被分组复用了,这时将这个组和编译的关系置为无效,编译置为无效
|
||||
list.remove(maatRelation.getCompileAndGroupMap().get(compileId).indexOf(groupId));// 删除编译下面的这个组
|
||||
maatRelation.getGroupAndCompileMap().get(groupId)
|
||||
.remove(maatRelation.getGroupAndCompileMap().get(groupId).indexOf(compileId));// 删除分组关系中的组和编译关系
|
||||
}
|
||||
} else {
|
||||
// 当前的groupid属于多个组,被分组复用了,所以不对这个组进行操作,也不对这个组下面的域进行操作
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void syso(MaatRelation maatRelation) {
|
||||
Map<Long, List<Long>> getCompileAndGroupMap = maatRelation.getCompileAndGroupMap();
|
||||
for (Long compile : getCompileAndGroupMap.keySet()) {
|
||||
List<Long> groupList = getCompileAndGroupMap.get(compile);
|
||||
for (Long group : groupList) {
|
||||
System.out.println("编译:" + compile + "组:" + group);
|
||||
}
|
||||
}
|
||||
Map<Long, List<Long>> getGroupAndCompileMap = maatRelation.getGroupAndCompileMap();
|
||||
for (Long group : getGroupAndCompileMap.keySet()) {
|
||||
List<Long> compileList = getGroupAndCompileMap.get(group);
|
||||
for (Long compile : compileList) {
|
||||
System.out.println("组:" + group + "编译:" + compile);
|
||||
}
|
||||
}
|
||||
Map<Long, List<Long>> getGroupAndRegionMap = maatRelation.getGroupAndRegionMap();
|
||||
for (Long group : getGroupAndRegionMap.keySet()) {
|
||||
List<Long> regionList = getGroupAndRegionMap.get(group);
|
||||
for (Long region : regionList) {
|
||||
System.out.println("组:" + group + "域:" + region);
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println();
|
||||
System.out.println();
|
||||
System.out.println();
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
MaatRelation maatRelation = getMaat();
|
||||
syso(maatRelation);
|
||||
|
||||
long compileId = 11;
|
||||
removKey(maatRelation, compileId);
|
||||
syso(maatRelation);
|
||||
|
||||
compileId = 2;
|
||||
removKey(maatRelation, compileId);
|
||||
syso(maatRelation);
|
||||
}
|
||||
|
||||
public static MaatRelation getMaat() {
|
||||
MaatRelation maatRelation = new MaatRelation();
|
||||
Map<Long, List<Long>> compileAndGroupMap = new HashMap<Long, List<Long>>();
|
||||
List<Long> list = new ArrayList<Long>();
|
||||
list.add(1l);
|
||||
compileAndGroupMap.put(1l, list);
|
||||
list = new ArrayList<Long>();
|
||||
list.add(1l);
|
||||
compileAndGroupMap.put(2l, list);
|
||||
Map<Long, List<Long>> groupAndCompileMap = new HashMap<Long, List<Long>>();
|
||||
list = new ArrayList<Long>();
|
||||
list.add(1l);
|
||||
list.add(2l);
|
||||
groupAndCompileMap.put(1l, list);
|
||||
// Map<Long, List<Long>> regionAndGroupMap = new HashMap<Long, List<Long>>();
|
||||
list = new ArrayList<Long>();
|
||||
list.add(1l);
|
||||
// regionAndGroupMap.put(1l, list);
|
||||
Map<Long, List<Long>> groupAndRegionMap = new HashMap<Long, List<Long>>();
|
||||
groupAndRegionMap.put(1l, list);
|
||||
maatRelation.setCompileAndGroupMap(compileAndGroupMap);
|
||||
maatRelation.setGroupAndCompileMap(groupAndCompileMap);
|
||||
maatRelation.setGroupAndRegionMap(groupAndRegionMap);
|
||||
// maatRelation.setRegionAndGroupMap(regionAndGroupMap);
|
||||
|
||||
return maatRelation;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -57,12 +57,12 @@ public class ReadMaatXmlUtil {
|
||||
MaatXmlConfig maatXmlConfig = map.get(key);
|
||||
List<MaatXmlExpr> expressionList = maatXmlConfig.getExpressionList();
|
||||
for (MaatXmlExpr maatXmlExpr : expressionList) {
|
||||
System.out.println("service=" + key + " redisDB=" + maatXmlExpr.getRedisDB() + " key="
|
||||
System.out.println("service=" + key + " key="
|
||||
+ maatXmlExpr.getKeyExpression() + " value=" + maatXmlExpr.getValueExpression());
|
||||
}
|
||||
List<MaatXmlSeq> sequenceList = maatXmlConfig.getSequenceList();
|
||||
for (MaatXmlSeq maatXmlSeq : sequenceList) {
|
||||
System.out.println("service=" + key + " redisDB=" + maatXmlSeq.getRedisDB() + " key="
|
||||
System.out.println("service=" + key + " key="
|
||||
+ maatXmlSeq.getSequenceKey() + " operation=" + maatXmlSeq.getOperation());
|
||||
}
|
||||
}
|
||||
@@ -97,9 +97,9 @@ public class ReadMaatXmlUtil {
|
||||
if (ele.getName().toLowerCase().equals("operation")) {
|
||||
maatXmlSeq.setOperation(Integer.parseInt(ele.getTextTrim()));
|
||||
}
|
||||
if (ele.getName().toLowerCase().equals("redisdb")) {
|
||||
maatXmlSeq.setRedisDB(Integer.parseInt(ele.getTextTrim()));
|
||||
}
|
||||
// if (ele.getName().toLowerCase().equals("redisdb")) {
|
||||
// maatXmlSeq.setRedisDB(Integer.parseInt(ele.getTextTrim()));
|
||||
// }
|
||||
if (ele.getName().toLowerCase().equals("sequencekey")) {
|
||||
maatXmlSeq.setSequenceKey(ele.getTextTrim());
|
||||
}
|
||||
@@ -126,16 +126,20 @@ public class ReadMaatXmlUtil {
|
||||
maatXmlExpr.setType(14);
|
||||
} else if (ele.getTextTrim().contains("str_str_region_table_name")) {
|
||||
maatXmlExpr.setType(15);
|
||||
} else {
|
||||
} else if (ele.getTextTrim().contains("file_digest_table_name")) {
|
||||
maatXmlExpr.setType(16);
|
||||
} else if (ele.getTextTrim().contains("file_like_table_name")) {
|
||||
maatXmlExpr.setType(17);
|
||||
} else {
|
||||
maatXmlExpr.setType(0);
|
||||
}
|
||||
}
|
||||
if (ele.getName().toLowerCase().equals("valueexpression")) {
|
||||
maatXmlExpr.setValueExpression(ele.getTextTrim());
|
||||
}
|
||||
if (ele.getName().toLowerCase().equals("redisdb")) {
|
||||
maatXmlExpr.setRedisDB(Integer.parseInt(ele.getTextTrim()));
|
||||
}
|
||||
// if (ele.getName().toLowerCase().equals("redisdb")) {
|
||||
// maatXmlExpr.setRedisDB(Integer.parseInt(ele.getTextTrim()));
|
||||
// }
|
||||
|
||||
}
|
||||
exprList.add(maatXmlExpr);
|
||||
|
||||
@@ -29,7 +29,6 @@ import com.nis.web.controller.BaseRestController;
|
||||
import com.nis.web.service.SaveRequestLogThread;
|
||||
import com.nis.web.service.ServicesRequestLogService;
|
||||
import com.nis.web.service.restful.ConfigRedisService;
|
||||
import com.nis.web.service.restful.ConfigRedisServiceimpl;
|
||||
import com.nis.web.service.restful.ConfigSourcesService;
|
||||
import com.wordnik.swagger.annotations.Api;
|
||||
import com.wordnik.swagger.annotations.ApiOperation;
|
||||
@@ -120,7 +119,8 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
Map<String, String> configMap = new HashMap<String, String>();
|
||||
long seq_compileid = configRedisService.getIncrId("SEQ_COMPILEID");
|
||||
long seq_groupid = configRedisService.getIncrId("SEQ_GROUPID");
|
||||
long seq_regionid = configRedisService.getIncrId("SEQ_REGIONID");
|
||||
long seq_regionid1 = configRedisService.getIncrId("SEQ_REGIONID");
|
||||
long seq_regionid2 = configRedisService.getIncrId("SEQ_REGIONID");
|
||||
// int id=2;
|
||||
configMap.put("cfg_id", seq_compileid + "");
|
||||
configMap.put("service", service + "");
|
||||
@@ -133,16 +133,22 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
configMap.put("group_num", "1");
|
||||
configMap.put("father_cfg_id", "0");
|
||||
configMap.put("op_time", time);
|
||||
|
||||
List<Map<String, String>> groupMapList = new ArrayList<Map<String, String>>();
|
||||
Map<String, String> groupMap = new HashMap<String, String>();
|
||||
groupMap.put("group_id", seq_groupid + "");
|
||||
groupMap.put("cfg_id", seq_compileid + "");
|
||||
groupMap.put("is_valid", "1");
|
||||
groupMap.put("op_time", time);
|
||||
groupMap.put("service", service + "");
|
||||
Map<String, String> strMap = new HashMap<String, String>();
|
||||
|
||||
groupMapList.add(groupMap);
|
||||
|
||||
List<Map<String, String>> ipRegionMapList = new ArrayList<Map<String, String>>();
|
||||
|
||||
Map<String, String> strMap = new HashMap<String, String>();
|
||||
strMap.put("group_id", seq_groupid + "");
|
||||
strMap.put("region_id", seq_regionid + "");
|
||||
strMap.put("region_id", seq_regionid1 + "");
|
||||
strMap.put("addr_type", "4");
|
||||
strMap.put("src_ip", "0.0.0.0");
|
||||
strMap.put("mask_src_ip", "255.255.255.255");
|
||||
@@ -158,11 +164,32 @@ public class ConfigSourcesController extends BaseRestController {
|
||||
strMap.put("op_time", time);
|
||||
strMap.put("service", service + "");
|
||||
|
||||
ipRegionMapList.add(strMap);
|
||||
|
||||
strMap = new HashMap<String, String>();
|
||||
strMap.put("group_id", seq_groupid + "");
|
||||
strMap.put("region_id", seq_regionid2 + "");
|
||||
strMap.put("addr_type", "4");
|
||||
strMap.put("src_ip", "0.0.0.0");
|
||||
strMap.put("mask_src_ip", "255.255.255.255");
|
||||
strMap.put("src_port", "0");
|
||||
strMap.put("mask_src_port", "0");
|
||||
strMap.put("dst_ip", "0.0.0.0");
|
||||
strMap.put("mask_dst_ip", "255.255.255.255");
|
||||
strMap.put("dst_port", "0");
|
||||
strMap.put("mask_dst_port", "0");
|
||||
strMap.put("protocol", "0");
|
||||
strMap.put("direction", "0");
|
||||
strMap.put("is_valid", "1");
|
||||
strMap.put("op_time", time);
|
||||
strMap.put("service", service + "");
|
||||
ipRegionMapList.add(strMap);
|
||||
|
||||
MaatConfig maatConfig = new MaatConfig();
|
||||
maatConfig.setCompileMap(configMap);
|
||||
maatConfig.setGroupMap(groupMap);
|
||||
maatConfig.setGroupMapList(groupMapList);
|
||||
maatConfig.setService(service);
|
||||
maatConfig.setIpRegionMap(strMap);
|
||||
maatConfig.setIpRegionMapList(ipRegionMapList);
|
||||
return maatConfig;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,14 +68,13 @@ public class ConfigRedisServiceimpl extends BaseRedisDao<String, String> impleme
|
||||
@Transactional
|
||||
public void saveUnMaatConfig(List<Map<String, String>> listMap, int service) {
|
||||
if (listMap != null && listMap.size() > 0) {
|
||||
DynamicJedisDataBase.setRedisDataBase(getRedisDBByService(service), redisTemplate);
|
||||
String maatVersionStr = operRedisService.getMaatVersion(getRedisDBByService(service));
|
||||
if (maatVersionStr != null) {
|
||||
Long maatVersion = Long.valueOf(maatVersionStr) + 1;
|
||||
|
||||
for (Map<String, String> map : listMap) {
|
||||
// String serviceStr = map.get("service");
|
||||
// int service = Integer.parseInt(serviceStr);
|
||||
DynamicJedisDataBase.setRedisDataBase(getRedisDBByService(service), redisTemplate);
|
||||
MaatXmlConfig maatXmlConfig = ReadMaatXmlUtil.getMaatConfigByService(service);
|
||||
if (maatXmlConfig != null) {
|
||||
List<MaatXmlExpr> expressionList = maatXmlConfig.getExpressionList();
|
||||
@@ -170,7 +169,7 @@ public class ConfigRedisServiceimpl extends BaseRedisDao<String, String> impleme
|
||||
for (int i = 20; i < 30; i++) {
|
||||
redisTemplate.boundZSetOps("1").add("a" + i, i);
|
||||
if (i == 25) {
|
||||
int a = 1 / 0;
|
||||
// int a = 1 / 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -197,16 +196,48 @@ public class ConfigRedisServiceimpl extends BaseRedisDao<String, String> impleme
|
||||
public void setConfig(MaatConfig maatConfig, MaatXmlConfig maatXmlConfig, Long maatVersion, int service) {
|
||||
Map<String, String> compileMap = maatConfig.getCompileMap();
|
||||
setCommonConfig(maatXmlConfig, compileMap, 10, maatVersion.doubleValue(), service);// 10代表是编译配置
|
||||
Map<String, String> groupMap = maatConfig.getGroupMap();
|
||||
setCommonConfig(maatXmlConfig, groupMap, 11, maatVersion.doubleValue(), service);// 11代表是分组配置
|
||||
Map<String, String> ipRegionMap = maatConfig.getIpRegionMap();
|
||||
setCommonConfig(maatXmlConfig, ipRegionMap, 12, maatVersion.doubleValue(), service);// 12代表是ip类域配置
|
||||
Map<String, String> numRegionMap = maatConfig.getNumRegionMap();
|
||||
setCommonConfig(maatXmlConfig, numRegionMap, 13, maatVersion.doubleValue(), service);// 13代表是数值类配置
|
||||
Map<String, String> strRegionMap = maatConfig.getStrRegionMap();
|
||||
setCommonConfig(maatXmlConfig, strRegionMap, 14, maatVersion.doubleValue(), service);// 14代表是字符串类域配置
|
||||
Map<String, String> strStrRegionMap = maatConfig.getStrStrRegionMap();
|
||||
setCommonConfig(maatXmlConfig, strStrRegionMap, 15, maatVersion.doubleValue(), service);// 15代表是增强字符串类域配置
|
||||
List<Map<String, String>> groupMapList = maatConfig.getGroupMapList();
|
||||
if (groupMapList != null && groupMapList.size() > 0) {
|
||||
for (Map<String, String> map : groupMapList) {
|
||||
setCommonConfig(maatXmlConfig, map, 11, maatVersion.doubleValue(), service);// 11代表是分组配置
|
||||
}
|
||||
}
|
||||
List<Map<String, String>> ipRegionMapList = maatConfig.getIpRegionMapList();
|
||||
if (ipRegionMapList != null && ipRegionMapList.size() > 0) {
|
||||
for (Map<String, String> map : ipRegionMapList) {
|
||||
setCommonConfig(maatXmlConfig, map, 12, maatVersion.doubleValue(), service);// 12代表是ip类域配置
|
||||
}
|
||||
}
|
||||
List<Map<String, String>> numRegionMapList = maatConfig.getNumRegionMapList();
|
||||
if (numRegionMapList != null && numRegionMapList.size() > 0) {
|
||||
for (Map<String, String> map : numRegionMapList) {
|
||||
setCommonConfig(maatXmlConfig, map, 13, maatVersion.doubleValue(), service);// 13代表是数值类配置
|
||||
}
|
||||
}
|
||||
List<Map<String, String>> strRegionMapList = maatConfig.getStrRegionMapList();
|
||||
if (strRegionMapList != null && strRegionMapList.size() > 0) {
|
||||
for (Map<String, String> map : strRegionMapList) {
|
||||
setCommonConfig(maatXmlConfig, map, 14, maatVersion.doubleValue(), service);// 14代表是字符串类域配置
|
||||
}
|
||||
}
|
||||
List<Map<String, String>> strStrRegionMapList = maatConfig.getStrStrRegionMapList();
|
||||
if (strStrRegionMapList != null && strStrRegionMapList.size() > 0) {
|
||||
for (Map<String, String> map : strStrRegionMapList) {
|
||||
setCommonConfig(maatXmlConfig, map, 15, maatVersion.doubleValue(), service);// 15代表是增强字符串类域配置
|
||||
}
|
||||
}
|
||||
List<Map<String, String>> fileDigestRegionMapList = maatConfig.getFileDigestRegionMapList();
|
||||
if (fileDigestRegionMapList != null && fileDigestRegionMapList.size() > 0) {
|
||||
for (Map<String, String> map : fileDigestRegionMapList) {
|
||||
setCommonConfig(maatXmlConfig, map, 16, maatVersion.doubleValue(), service);// 16代表是文件摘要类域配置
|
||||
}
|
||||
}
|
||||
List<Map<String, String>> fileLikeRegionMapList = maatConfig.getFileLikeRegionMapList();
|
||||
if (fileLikeRegionMapList != null && fileLikeRegionMapList.size() > 0) {
|
||||
for (Map<String, String> map : fileLikeRegionMapList) {
|
||||
setCommonConfig(maatXmlConfig, map, 17, maatVersion.doubleValue(), service);// 17代表是文本相似性域配置
|
||||
}
|
||||
}
|
||||
updateCommonKey(maatXmlConfig);
|
||||
}
|
||||
|
||||
@@ -290,7 +321,7 @@ public class ConfigRedisServiceimpl extends BaseRedisDao<String, String> impleme
|
||||
}
|
||||
|
||||
public Long getIncrId(String key) {
|
||||
//DynamicJedisDataBase.setRedisDataBase(getRedisDBByService(service), redisTemplate);
|
||||
DynamicJedisDataBase.setRedisDataBase(2, redisTemplate);
|
||||
// RedisAtomicLong atomicLong = new RedisAtomicLong(key,
|
||||
// redisTemplate.getConnectionFactory());
|
||||
//
|
||||
|
||||
@@ -8,14 +8,10 @@
|
||||
<p:keyExpression>EFFECTIVE_RULE;:;FILE_INDEX_INFO;,;[cfg_id]</p:keyExpression>
|
||||
<p:valueExpression>[cfg_id];\t;[is_valid];\t;[dst_file];\t;[dst_file_md5];\t;[time_stamp];&nbsp;[level];\t;[file_id];\n</p:valueExpression>
|
||||
</p:expressions>
|
||||
<p:redisDB>2</p:redisDB>
|
||||
<p:sequences>
|
||||
<p:operation>1</p:operation>
|
||||
<p:sequenceKey>MAAT_VERSION</p:sequenceKey>
|
||||
</p:sequences>
|
||||
|
||||
|
||||
|
||||
<p:expressions>
|
||||
<p:keyExpression>MAAT_UPDATE_STATUS</p:keyExpression>
|
||||
</p:expressions>
|
||||
@@ -29,7 +25,6 @@
|
||||
</p:maatType>
|
||||
|
||||
<p:maatType service="100;101;164;165">
|
||||
<p:redisDB>2</p:redisDB>
|
||||
<p:expressions>
|
||||
<p:keyExpression>EFFECTIVE_RULE;:;mark_sample;,;[cfg_id]</p:keyExpression>
|
||||
<p:valueExpression>[cfg_id];\t;[service];\t;[level];\t;[description];\t;[is_valid]</p:valueExpression>
|
||||
@@ -49,8 +44,8 @@
|
||||
<p:keyExpression>MAAT_VERSION_TIMER</p:keyExpression>
|
||||
</p:expressions>
|
||||
</p:maatType>
|
||||
<p:maatType service="80;81;82;83;84;85;144;145;146;147;148;149">
|
||||
<p:redisDB>3</p:redisDB>
|
||||
|
||||
<p:maatType service="80;82;84;144;146;148">
|
||||
<p:expressions>
|
||||
<p:keyExpression>EFFECTIVE_RULE;:;{compile_table_name};,;[cfg_id]</p:keyExpression>
|
||||
<p:valueExpression>[cfg_id];\t;[service];\t;[action];\t;[do_blacklist];\t;[do_log];\t;[effective_range];\t;[user_region];\t;[is_valid];\t;[group_num];\t;[father_cfg_id];\t;[op_time]</p:valueExpression>
|
||||
@@ -64,9 +59,42 @@
|
||||
<p:valueExpression>[region_id];\t;[group_id];\t;[addr_type];\t;[src_ip];\t;[mask_src_ip];\t;[src_port];\t;[mask_src_port];\t;[dst_ip];\t;[mask_dst_ip];\t;[dst_port];\t;[mask_dst_port];\t;[protocol];\t;[direction];\t;[is_valid];\t;[op_time]</p:valueExpression>
|
||||
</p:expressions>
|
||||
<p:expressions>
|
||||
<p:keyExpression>EFFECTIVE_RULE;:;{num_region_table_name};,;[region_id]</p:keyExpression>
|
||||
<p:valueExpression>[region_id];\t;[group_id];\t;[low_boundary];\t;[up_boundary];\t;[is_valid];\t;[op_time]</p:valueExpression>
|
||||
<p:keyExpression>MAAT_UPDATE_STATUS</p:keyExpression>
|
||||
<!-- <p:valueExpression>add;{tableName};,;{id}</p:valueExpression> -->
|
||||
</p:expressions>
|
||||
|
||||
<p:expressions>
|
||||
<p:keyExpression>MAAT_RULE_TIMER</p:keyExpression>
|
||||
<!-- <p:valueExpression>[region_id];\t;[group_id];\t;[keywords];\t;[expr_type];\t;[match_method];\t;[is_hexbin];\t;[is_valid];\t;[op_time]</p:valueExpression> -->
|
||||
</p:expressions>
|
||||
<p:expressions>
|
||||
<p:keyExpression>MAAT_VERSION_TIMER</p:keyExpression>
|
||||
<!-- <p:valueExpression>{region_id};{maatVersion}</p:valueExpression> -->
|
||||
</p:expressions>
|
||||
|
||||
<p:sequences>
|
||||
<p:operation>1</p:operation>
|
||||
<p:sequenceKey>MAAT_VERSION</p:sequenceKey>
|
||||
</p:sequences>
|
||||
</p:maatType>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<p:maatType service="81;145">
|
||||
<p:expressions>
|
||||
<p:keyExpression>EFFECTIVE_RULE;:;{compile_table_name};,;[cfg_id]</p:keyExpression>
|
||||
<p:valueExpression>[cfg_id];\t;[service];\t;[action];\t;[do_blacklist];\t;[do_log];\t;[effective_range];\t;[user_region];\t;[is_valid];\t;[group_num];\t;[father_cfg_id];\t;[op_time]</p:valueExpression>
|
||||
</p:expressions>
|
||||
<p:expressions>
|
||||
<p:keyExpression>EFFECTIVE_RULE;:;{group_table_name};,;[group_id]</p:keyExpression>
|
||||
<p:valueExpression>[group_id];\t;[cfg_id];\t;[is_valid];\t;[op_time]</p:valueExpression>
|
||||
</p:expressions>
|
||||
|
||||
|
||||
<p:expressions>
|
||||
<p:keyExpression>EFFECTIVE_RULE;:;{str_region_table_name};,;[region_id]</p:keyExpression>
|
||||
<p:valueExpression>[region_id];\t;[group_id];\t;[keywords];\t;[expr_type];\t;[match_method];\t;[is_hexbin];\t;[is_valid];\t;[op_time]</p:valueExpression>
|
||||
@@ -93,6 +121,46 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<p:maatType service="83;85;147;149">
|
||||
<p:expressions>
|
||||
<p:keyExpression>EFFECTIVE_RULE;:;{compile_table_name};,;[cfg_id]</p:keyExpression>
|
||||
<p:valueExpression>[cfg_id];\t;[service];\t;[action];\t;[do_blacklist];\t;[do_log];\t;[effective_range];\t;[user_region];\t;[is_valid];\t;[group_num];\t;[father_cfg_id];\t;[op_time]</p:valueExpression>
|
||||
</p:expressions>
|
||||
<p:expressions>
|
||||
<p:keyExpression>EFFECTIVE_RULE;:;{group_table_name};,;[group_id]</p:keyExpression>
|
||||
<p:valueExpression>[group_id];\t;[cfg_id];\t;[is_valid];\t;[op_time]</p:valueExpression>
|
||||
</p:expressions>
|
||||
<p:expressions>
|
||||
<p:keyExpression>EFFECTIVE_RULE;:;{num_region_table_name};,;[region_id]</p:keyExpression>
|
||||
<p:valueExpression>[region_id];\t;[group_id];\t;[low_boundary];\t;[up_boundary];\t;[is_valid];\t;[op_time]</p:valueExpression>
|
||||
</p:expressions>
|
||||
<p:expressions>
|
||||
<p:keyExpression>MAAT_UPDATE_STATUS</p:keyExpression>
|
||||
<!-- <p:valueExpression>add;{tableName};,;{id}</p:valueExpression> -->
|
||||
</p:expressions>
|
||||
|
||||
<p:expressions>
|
||||
<p:keyExpression>MAAT_RULE_TIMER</p:keyExpression>
|
||||
<!-- <p:valueExpression>[region_id];\t;[group_id];\t;[keywords];\t;[expr_type];\t;[match_method];\t;[is_hexbin];\t;[is_valid];\t;[op_time]</p:valueExpression> -->
|
||||
</p:expressions>
|
||||
<p:expressions>
|
||||
<p:keyExpression>MAAT_VERSION_TIMER</p:keyExpression>
|
||||
<!-- <p:valueExpression>{region_id};{maatVersion}</p:valueExpression> -->
|
||||
</p:expressions>
|
||||
|
||||
<p:sequences>
|
||||
<p:operation>1</p:operation>
|
||||
<p:sequenceKey>MAAT_VERSION</p:sequenceKey>
|
||||
</p:sequences>
|
||||
</p:maatType>
|
||||
|
||||
|
||||
|
||||
</p:maat>
|
||||
|
||||
|
||||
|
||||
@@ -13,18 +13,18 @@
|
||||
</xs:annotation>
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="redisDB">
|
||||
<xs:annotation>
|
||||
<xs:documentation><![CDATA[使用哪个redis数据库,redis默认只有0-15,共16个数据库]]>
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:integer">
|
||||
<xs:minInclusive value="0" />
|
||||
<xs:maxInclusive value="16" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:element>
|
||||
<!-- <xs:element name="redisDB"> -->
|
||||
<!-- <xs:annotation> -->
|
||||
<!-- <xs:documentation><![CDATA[使用哪个redis数据库,redis默认只有0-15,共16个数据库]]> -->
|
||||
<!-- </xs:documentation> -->
|
||||
<!-- </xs:annotation> -->
|
||||
<!-- <xs:simpleType> -->
|
||||
<!-- <xs:restriction base="xs:integer"> -->
|
||||
<!-- <xs:minInclusive value="0" /> -->
|
||||
<!-- <xs:maxInclusive value="16" /> -->
|
||||
<!-- </xs:restriction> -->
|
||||
<!-- </xs:simpleType> -->
|
||||
<!-- </xs:element> -->
|
||||
|
||||
<xs:element name="sequences">
|
||||
<xs:annotation>
|
||||
@@ -70,7 +70,12 @@
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
<![CDATA[rediskey规则,以[]包围的代表可变项,
|
||||
需要从map中获取的值,直接写的代表是固定值,直接拼接即可,
|
||||
需要从map中获取的值。以{}包围的是代码中使用的变量,固定值不可随意写,
|
||||
编译表名:compile_table_name,分组表名:group_table_name,ip类域配置表名:ip_region_table_name,
|
||||
数值类域配置表名:num_region_table_name,字符串类域配置表名:str_region_table_name,
|
||||
增强字符串域配置表名:str_str_region_table_name,文件摘要类域配置表名:file_digest_table_name,
|
||||
文本相似性域配置表名:file_like_table_name。
|
||||
直接写的代表是固定值,直接拼接即可,
|
||||
每个属性间用分号分隔,空格用&nbsp表示]]>
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
|
||||
@@ -3,25 +3,26 @@
|
||||
####1:固定需要写service=业务类型1;业务类型2
|
||||
####2:然后每个业务类型:业务类型1=type1:表名1;type2:表名2;type3:表名3
|
||||
####3:例如:80=10:AV_CONFIG_COMPILE;11:AV_CONFIG_GROUP;12:AV_CONT_IP_PORT
|
||||
####4:type中10代表是编译配置,11代表是分组配置,12代表是ip类域配置,13代表是数值类配置,14代表是字符串类域配置,15代表是增强字符串类域配置
|
||||
####4:type中10代表是编译配置,11代表是分组配置,12代表是ip类域配置,13代表是数值类配置,14代表是字符串类域配置,15代表是增强字符串类域配置,16代表是文件摘要类域配置,17代表是文本相似性域配置
|
||||
#################################################################################
|
||||
service=80;81;82;83;84;85;144;145;146;147;148;149
|
||||
|
||||
|
||||
|
||||
80=10:AV_CONFIG_COMPILE;11:AV_CONFIG_GROUP;12:AV_CONT_IP_PORT
|
||||
81=10:AV_CONFIG_COMPILE;11:AV_CONFIG_GROUP;12:AV_CONT_IP_PORT
|
||||
82=10:AV_CONFIG_COMPILE;11:AV_CONFIG_GROUP;12:AV_CONT_IP_PORT
|
||||
83=10:AV_CONFIG_COMPILE;11:AV_CONFIG_GROUP;12:AV_CONT_IP_PORT
|
||||
84=10:AV_CONFIG_COMPILE;11:AV_CONFIG_GROUP;12:AV_CONT_IP_PORT
|
||||
85=10:AV_CONFIG_COMPILE;11:AV_CONFIG_GROUP;12:AV_CONT_IP_PORT
|
||||
144=10:AV_CONFIG_COMPILE;11:AV_CONFIG_GROUP;12:AV_CONT_IP_PORT
|
||||
145=10:AV_CONFIG_COMPILE;11:AV_CONFIG_GROUP;12:AV_CONT_IP_PORT
|
||||
146=10:AV_CONFIG_COMPILE;11:AV_CONFIG_GROUP;12:AV_CONT_IP_PORT
|
||||
147=10:AV_CONFIG_COMPILE;11:AV_CONFIG_GROUP;12:AV_CONT_IP_PORT
|
||||
148=10:AV_CONFIG_COMPILE;11:AV_CONFIG_GROUP;12:AV_CONT_IP_PORT
|
||||
149=10:AV_CONFIG_COMPILE;11:AV_CONFIG_GROUP;12:AV_CONT_IP_PORT
|
||||
|
||||
80=10:AV_CONFIG_COMPILE;11:AV_CONFIG_GROUP;12:AV_CONT_IP_PORT
|
||||
81=10:AV_CONFIG_COMPILE;11:AV_CONFIG_GROUP;14:AV_CONT_URL
|
||||
82=10:AV_CONFIG_COMPILE;11:AV_CONFIG_GROUP;12:AV_PIC_IP_PORT
|
||||
83=10:AV_CONFIG_COMPILE;11:AV_CONFIG_GROUP;13:AV_PIC_URL
|
||||
84=10:AV_CONFIG_COMPILE;11:AV_CONFIG_GROUP;12:AV_VOIP_IP_PORT
|
||||
85=10:AV_CONFIG_COMPILE;11:AV_CONFIG_GROUP;13:AV_VOIP_ACCOUNT
|
||||
|
||||
144=10:AV_CONFIG_COMPILE;11:AV_CONFIG_GROUP;12:AV_CONT_IP_PORT
|
||||
145=10:AV_CONFIG_COMPILE;11:AV_CONFIG_GROUP;14:AV_CONT_URL
|
||||
146=10:AV_CONFIG_COMPILE;11:AV_CONFIG_GROUP;12:AV_PIC_IP_PORT
|
||||
147=10:AV_CONFIG_COMPILE;11:AV_CONFIG_GROUP;13:AV_PIC_URL
|
||||
148=10:AV_CONFIG_COMPILE;11:AV_CONFIG_GROUP;12:AV_VOIP_IP_PORT
|
||||
149=10:AV_CONFIG_COMPILE;11:AV_CONFIG_GROUP;13:AV_VOIP_ACCOUNT
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user