ing
This commit is contained in:
parent
c3ca0ea93b
commit
07e9f73e48
13
.editorconfig
Normal file
13
.editorconfig
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Editor configuration, see http://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -1,3 +1,6 @@
|
|||
{
|
||||
"editor.tabSize": 2,
|
||||
"editor.insertSpaces": true,
|
||||
|
||||
"java.configuration.updateBuildConfiguration": "automatic"
|
||||
}
|
|
@ -6,7 +6,7 @@ import java.io.IOException;
|
|||
|
||||
public class Central {
|
||||
public static void main(String[] args) throws IOException, InterruptedException {
|
||||
if(args.length <= 0) {
|
||||
if (args.length <= 0) {
|
||||
System.out.println("Port args");
|
||||
System.out.println("first parameter is Port Number");
|
||||
return;
|
||||
|
|
|
@ -15,7 +15,7 @@ public class GenerateKey {
|
|||
String[] uuids = generator.generate().toString().split("-");
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
for ( int idx = 0; idx < uuids.length; idx++ ) {
|
||||
for (int idx = 0; idx < uuids.length; idx++) {
|
||||
sb.append(uuids[idx]);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,15 +10,17 @@ import org.springframework.data.domain.Sort;
|
|||
*/
|
||||
public class PageUtil {
|
||||
private static Sort.Direction getSortDirection(String sortDirection) {
|
||||
if(sortDirection.equalsIgnoreCase("ascending")) {
|
||||
if (sortDirection.equalsIgnoreCase("ascending")) {
|
||||
return Sort.Direction.ASC;
|
||||
}
|
||||
return Sort.Direction.DESC;
|
||||
}
|
||||
|
||||
public static PageRequest getPageRequest(PageParams pageParams) {
|
||||
if(pageParams.getSortCol().isEmpty()) pageParams.setSortCol("id");
|
||||
if(pageParams.getSortDirection().isEmpty()) pageParams.setSortDirection("descending");
|
||||
if (pageParams.getSortCol().isEmpty())
|
||||
pageParams.setSortCol("id");
|
||||
if (pageParams.getSortDirection().isEmpty())
|
||||
pageParams.setSortDirection("descending");
|
||||
|
||||
return new PageRequest(pageParams.getPageNo(), pageParams.getCountPerPage(),
|
||||
new Sort(PageUtil.getSortDirection(pageParams.getSortDirection()), pageParams.getSortCol()));
|
||||
|
|
|
@ -7,10 +7,8 @@ import static io.grpc.Metadata.ASCII_STRING_MARSHALLER;
|
|||
|
||||
public class SessionMetadata {
|
||||
/*
|
||||
digits: 0-9
|
||||
uppercase letters: A-Z (normalized to lower)
|
||||
lowercase letters: a-z
|
||||
special characters: -_.
|
||||
* digits: 0-9 uppercase letters: A-Z (normalized to lower) lowercase letters:
|
||||
* a-z special characters: -_.
|
||||
*/
|
||||
|
||||
public static final String CLIENT_TYPE_KEY = "OVERFLOW_GRPC_CLIENT_TYPE";
|
||||
|
@ -21,29 +19,34 @@ public class SessionMetadata {
|
|||
public static final Context.Key<String> CTX_SESSION_ID_KEY = Context.key(SESSION_ID_KEY);
|
||||
public static final Context.Key<String> CTX_TARGET_ID_KEY = Context.key(TARGET_ID_KEY);
|
||||
|
||||
public static final Metadata.Key<String> METADATA_CLIENT_TYPE_KEY = Metadata.Key.of(CLIENT_TYPE_KEY, ASCII_STRING_MARSHALLER);
|
||||
public static final Metadata.Key<String> METADATA_SESSION_ID_KEY = Metadata.Key.of(SESSION_ID_KEY, ASCII_STRING_MARSHALLER);
|
||||
public static final Metadata.Key<String> METADATA_TARGET_ID_KEY = Metadata.Key.of(TARGET_ID_KEY, ASCII_STRING_MARSHALLER);
|
||||
public static final Metadata.Key<String> METADATA_CLIENT_TYPE_KEY = Metadata.Key.of(CLIENT_TYPE_KEY,
|
||||
ASCII_STRING_MARSHALLER);
|
||||
public static final Metadata.Key<String> METADATA_SESSION_ID_KEY = Metadata.Key.of(SESSION_ID_KEY,
|
||||
ASCII_STRING_MARSHALLER);
|
||||
public static final Metadata.Key<String> METADATA_TARGET_ID_KEY = Metadata.Key.of(TARGET_ID_KEY,
|
||||
ASCII_STRING_MARSHALLER);
|
||||
|
||||
public static ClientType getClientType() {
|
||||
return ClientType.valueOf(CTX_CLIENT_TYPE_KEY.get());
|
||||
}
|
||||
|
||||
public static String getSessionID() {
|
||||
return CTX_SESSION_ID_KEY.get();
|
||||
}
|
||||
|
||||
public static String getTargetID() {
|
||||
return CTX_TARGET_ID_KEY.get();
|
||||
}
|
||||
|
||||
public static enum ClientType {
|
||||
MEMBER("MEMBER"),
|
||||
PROBE("PROBE");
|
||||
MEMBER("MEMBER"), PROBE("PROBE");
|
||||
|
||||
final private String name;
|
||||
|
||||
private ClientType(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
|
|
|
@ -6,13 +6,9 @@ package com.loafle.overflow.central.commons.utils;
|
|||
public class StringConvertor {
|
||||
|
||||
public static String intToIp(long i) {
|
||||
return ((i >> 24 ) & 0xFF) + "." +
|
||||
((i >> 16 ) & 0xFF) + "." +
|
||||
((i >> 8 ) & 0xFF) + "." +
|
||||
( i & 0xFF);
|
||||
return ((i >> 24) & 0xFF) + "." + ((i >> 16) & 0xFF) + "." + ((i >> 8) & 0xFF) + "." + (i & 0xFF);
|
||||
}
|
||||
|
||||
|
||||
public static long ipToLong(String ipAddress) {
|
||||
|
||||
String[] ipAddressInArray = ipAddress.split("\\.");
|
||||
|
@ -29,7 +25,6 @@ public class StringConvertor {
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
// https://github.com/Sovietaced/floodlight/blob/master/src/main/java/net/floodlightcontroller/util/MACAddress.java
|
||||
|
||||
public static final int MAC_ADDRESS_LENGTH = 6;
|
||||
|
@ -38,14 +33,13 @@ public class StringConvertor {
|
|||
String[] elements = address.split(":");
|
||||
if (elements.length != MAC_ADDRESS_LENGTH) {
|
||||
throw new IllegalArgumentException(
|
||||
"Specified MAC Address must contain 12 hex digits" +
|
||||
" separated pairwise by :'s.");
|
||||
"Specified MAC Address must contain 12 hex digits" + " separated pairwise by :'s.");
|
||||
}
|
||||
|
||||
byte[] addressInBytes = new byte[MAC_ADDRESS_LENGTH];
|
||||
for (int i = 0; i < MAC_ADDRESS_LENGTH; i++) {
|
||||
String element = elements[i];
|
||||
addressInBytes[i] = (byte)Integer.parseInt(element, 16);
|
||||
addressInBytes[i] = (byte) Integer.parseInt(element, 16);
|
||||
}
|
||||
|
||||
long mac = 0;
|
||||
|
@ -55,7 +49,7 @@ public class StringConvertor {
|
|||
}
|
||||
return mac;
|
||||
|
||||
// return new MACAddress(addressInBytes);
|
||||
// return new MACAddress(addressInBytes);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
package com.loafle.overflow.central.module.apikey.dao;
|
||||
|
||||
|
||||
|
||||
import com.loafle.overflow.model.apikey.ApiKey;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
||||
/**
|
||||
* Created by root on 17. 6. 1.
|
||||
*/
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package com.loafle.overflow.central.module.apikey.service;
|
||||
|
||||
|
||||
import com.loafle.overflow.central.module.apikey.dao.ApiKeyDAO;
|
||||
|
||||
|
||||
import com.loafle.overflow.core.exception.OverflowException;
|
||||
import com.loafle.overflow.model.apikey.ApiKey;
|
||||
import com.loafle.overflow.service.central.apikey.ApiKeyService;
|
||||
|
@ -16,11 +14,9 @@ import org.springframework.stereotype.Service;
|
|||
@Service("ApiKeyService")
|
||||
public class CentralApiKeyService implements ApiKeyService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ApiKeyDAO apiKeyDAO;
|
||||
|
||||
|
||||
public ApiKey regist(ApiKey apiKey) throws OverflowException {
|
||||
|
||||
return this.apiKeyDAO.save(apiKey);
|
||||
|
@ -34,14 +30,14 @@ public class CentralApiKeyService implements ApiKeyService {
|
|||
|
||||
ApiKey retApiKey = this.apiKeyDAO.findByApiKey(apiKey);
|
||||
|
||||
if(retApiKey == null) {
|
||||
if (retApiKey == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public ApiKey readByApiKey(String apiKey) throws OverflowException{
|
||||
public ApiKey readByApiKey(String apiKey) throws OverflowException {
|
||||
return this.apiKeyDAO.findByApiKey(apiKey);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.loafle.overflow.central.module.domain.dao;
|
||||
|
||||
|
||||
import com.loafle.overflow.model.domain.Domain;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
|
|
@ -26,19 +26,17 @@ public class GenerateUtil {
|
|||
@Autowired
|
||||
private MetaSensorItemKeyService metaSensorItemKeyService;
|
||||
|
||||
|
||||
|
||||
private Map<Short, Map<Integer, MetaSensorItemKey>> mappingMap = null;
|
||||
|
||||
public Map<Integer, MetaSensorItemKey> initMappingMap(MetaCrawler metaCrawler) throws OverflowException {
|
||||
|
||||
if(this.mappingMap == null) {
|
||||
if (this.mappingMap == null) {
|
||||
this.mappingMap = new HashMap<>();
|
||||
}
|
||||
|
||||
Map<Integer, MetaSensorItemKey> resultMap = this.mappingMap.get(metaCrawler.getId());
|
||||
|
||||
if(resultMap != null) {
|
||||
if (resultMap != null) {
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
|
@ -48,8 +46,6 @@ public class GenerateUtil {
|
|||
return resultMap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Crawler getCrawler(MetaCrawler metaCrawler) throws OverflowException {
|
||||
|
||||
Crawler crawler = new Crawler();
|
||||
|
@ -57,7 +53,7 @@ public class GenerateUtil {
|
|||
|
||||
String container = "";
|
||||
|
||||
if(metaCrawler.getId() == MetaCrawlerEnum.CASSANDRA_CRAWLER.getValue()
|
||||
if (metaCrawler.getId() == MetaCrawlerEnum.CASSANDRA_CRAWLER.getValue()
|
||||
|| metaCrawler.getId() == MetaCrawlerEnum.CASSANDRA_CRAWLER.getValue()
|
||||
|| metaCrawler.getId() == MetaCrawlerEnum.MONGODB_CRAWLER.getValue()
|
||||
|| metaCrawler.getId() == MetaCrawlerEnum.MSSQL_CRAWLER.getValue()
|
||||
|
@ -65,8 +61,7 @@ public class GenerateUtil {
|
|||
|| metaCrawler.getId() == MetaCrawlerEnum.POSTGRESQL_CRAWLER.getValue()
|
||||
|| metaCrawler.getId() == MetaCrawlerEnum.JMX_CRAWLER.getValue()) {
|
||||
container = "java_proxy";
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
container = "network_proxy";
|
||||
}
|
||||
|
||||
|
@ -75,18 +70,16 @@ public class GenerateUtil {
|
|||
return crawler;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public Map<String, List<MetaSensorItemKey>> sortItems(List<SensorItem> sensorItems, Map<Integer, MetaSensorItemKey> keyMap) throws OverflowException {
|
||||
public Map<String, List<MetaSensorItemKey>> sortItems(List<SensorItem> sensorItems,
|
||||
Map<Integer, MetaSensorItemKey> keyMap) throws OverflowException {
|
||||
|
||||
Map<String, List<MetaSensorItemKey>> metricMap = new HashMap<>();
|
||||
|
||||
MetaSensorItemKey itemKey = null;
|
||||
|
||||
for(SensorItem sItem : sensorItems) {
|
||||
for (SensorItem sItem : sensorItems) {
|
||||
itemKey = keyMap.get(sItem.getMetaSensorDisplayItem().getId());
|
||||
if(metricMap.containsKey(itemKey.getFroms()) == false) {
|
||||
if (metricMap.containsKey(itemKey.getFroms()) == false) {
|
||||
metricMap.put(itemKey.getFroms(), new ArrayList<>());
|
||||
}
|
||||
metricMap.get(itemKey.getFroms()).add(itemKey);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.loafle.overflow.central.module.generator.service;
|
||||
|
||||
import com.loafle.overflow.central.commons.utils.StringConvertor;
|
||||
import com.loafle.overflow.core.type.PortType;
|
||||
import com.loafle.overflow.model.auth.AuthCrawler;
|
||||
import com.loafle.overflow.model.infra.Infra;
|
||||
|
@ -77,7 +76,8 @@ public class InfraHostGenerator {
|
|||
|
||||
private Target createTarget(InfraHost infraHost, Sensor dbSensor) throws Exception {
|
||||
|
||||
AuthCrawler authCrawler = this.authCrawlerService.readByMetaCrawlerIDAndTargetID(dbSensor.getMetaCrawler().getId(), dbSensor.getTarget().getId());
|
||||
AuthCrawler authCrawler = this.authCrawlerService.readByMetaCrawlerIDAndTargetID(dbSensor.getMetaCrawler().getId(),
|
||||
dbSensor.getTarget().getId());
|
||||
|
||||
if (authCrawler == null) {
|
||||
return null;
|
||||
|
@ -87,7 +87,9 @@ public class InfraHostGenerator {
|
|||
Connection connection = new Connection();
|
||||
connection.setIp(infraHost.getIpv4());
|
||||
|
||||
HashMap<String, String> optionMap = this.objectMapper.readValue(authCrawler.getAuthJson(), new TypeReference<Map<String, String>>(){});
|
||||
HashMap<String, String> optionMap = this.objectMapper.readValue(authCrawler.getAuthJson(),
|
||||
new TypeReference<Map<String, String>>() {
|
||||
});
|
||||
|
||||
if (dbSensor.getMetaCrawler().getId() == MetaCrawlerEnum.WMI_CRAWLER.getValue()) {
|
||||
connection.setPort(135);
|
||||
|
|
|
@ -86,7 +86,8 @@ public class InfraHostWMIGenerator {
|
|||
|
||||
String json = tempItemKey.getOption();
|
||||
if (json != null && json.length() > 0) {
|
||||
HashMap<String, String> optionMap = this.objectMapper.readValue(json, new TypeReference<Map<String, String>>(){});
|
||||
HashMap<String, String> optionMap = this.objectMapper.readValue(json, new TypeReference<Map<String, String>>() {
|
||||
});
|
||||
|
||||
Object obj = null;
|
||||
obj = optionMap.get("appends");
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.loafle.overflow.central.module.generator.service;
|
||||
|
||||
import com.loafle.overflow.central.commons.utils.StringConvertor;
|
||||
import com.loafle.overflow.core.type.PortType;
|
||||
import com.loafle.overflow.model.auth.AuthCrawler;
|
||||
import com.loafle.overflow.model.infra.Infra;
|
||||
|
@ -47,18 +46,17 @@ public class InfraServiceGenerator {
|
|||
private ObjectMapper objectMapper;
|
||||
|
||||
public String process(Sensor dbSensor, List<SensorItem> sensorItems, Infra infra) throws Exception {
|
||||
com.loafle.overflow.model.infra.InfraService infraService = (com.loafle.overflow.model.infra.InfraService)infra;
|
||||
com.loafle.overflow.model.infra.InfraService infraService = (com.loafle.overflow.model.infra.InfraService) infra;
|
||||
|
||||
SensorConfig sensorConfig = new SensorConfig();
|
||||
sensorConfig.setConfigID(String.valueOf(dbSensor.getId()));
|
||||
|
||||
Target target = this.createTarget(infraService, dbSensor);
|
||||
|
||||
if(target == null) {
|
||||
if (target == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
sensorConfig.setTarget(target);
|
||||
|
||||
// FIXME: Interval
|
||||
|
@ -71,7 +69,7 @@ public class InfraServiceGenerator {
|
|||
|
||||
Map<Integer, MetaSensorItemKey> keyMap = this.generateUtil.initMappingMap(dbSensor.getMetaCrawler());
|
||||
|
||||
if(dbSensor.getMetaCrawler().getId() == MetaCrawlerEnum.MYSQL_CRAWLER.getValue()) {
|
||||
if (dbSensor.getMetaCrawler().getId() == MetaCrawlerEnum.MYSQL_CRAWLER.getValue()) {
|
||||
this.infraServiceMysqlGenerator.process(sensorItems, keyMap, dbSensor, sensorConfig);
|
||||
} else if (dbSensor.getMetaCrawler().getId() == MetaCrawlerEnum.JMX_CRAWLER.getValue()) {
|
||||
this.infraServiceJMXGenerator.process(sensorItems, keyMap, dbSensor, sensorConfig);
|
||||
|
@ -82,9 +80,10 @@ public class InfraServiceGenerator {
|
|||
|
||||
private Target createTarget(InfraService infraService, Sensor sensor) throws Exception {
|
||||
|
||||
AuthCrawler authCrawler = this.authCrawlerService.readByMetaCrawlerIDAndTargetID(sensor.getMetaCrawler().getId(), sensor.getTarget().getId());
|
||||
AuthCrawler authCrawler = this.authCrawlerService.readByMetaCrawlerIDAndTargetID(sensor.getMetaCrawler().getId(),
|
||||
sensor.getTarget().getId());
|
||||
|
||||
if(authCrawler == null) {
|
||||
if (authCrawler == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -97,12 +96,14 @@ public class InfraServiceGenerator {
|
|||
|
||||
target.setConnection(connection);
|
||||
|
||||
HashMap<String, String> optionMap = this.objectMapper.readValue(authCrawler.getAuthJson(), new TypeReference<Map<String, String>>(){});
|
||||
HashMap<String, String> optionMap = this.objectMapper.readValue(authCrawler.getAuthJson(),
|
||||
new TypeReference<Map<String, String>>() {
|
||||
});
|
||||
|
||||
Map<String, Object> auth = new HashMap<>();
|
||||
|
||||
if(sensor.getMetaCrawler().getId() == MetaCrawlerEnum.MYSQL_CRAWLER.getValue()) {
|
||||
auth.put("url", "jdbc:mysql://"+ infraService.getInfraHost().getIpv4() +":" + infraService.getPort());
|
||||
if (sensor.getMetaCrawler().getId() == MetaCrawlerEnum.MYSQL_CRAWLER.getValue()) {
|
||||
auth.put("url", "jdbc:mysql://" + infraService.getInfraHost().getIpv4() + ":" + infraService.getPort());
|
||||
auth.put("id", optionMap.get("ID")); // FIXME: Auth Info
|
||||
auth.put("pw", optionMap.get("PassWord")); // FIXME: Auth Info
|
||||
} else if (sensor.getMetaCrawler().getId() == MetaCrawlerEnum.JMX_CRAWLER.getValue()) {
|
||||
|
|
|
@ -73,7 +73,8 @@ public class InfraServiceJMXGenerator {
|
|||
List<String> arrayCol = null;
|
||||
|
||||
if (json != null && json.length() > 0) {
|
||||
HashMap<String, String> optionMap = this.objectMapper.readValue(json, new TypeReference<Map<String, String>>(){});
|
||||
HashMap<String, String> optionMap = this.objectMapper.readValue(json, new TypeReference<Map<String, String>>() {
|
||||
});
|
||||
|
||||
Object obj = null;
|
||||
obj = optionMap.get("aliases");
|
||||
|
|
|
@ -81,7 +81,8 @@ public class InfraServiceMysqlGenerator {
|
|||
|
||||
String json = tempItemKey.getOption();
|
||||
if (json != null && json.length() > 0) {
|
||||
HashMap<String, String> optionMap = this.objectMapper.readValue(json, new TypeReference<Map<String, String>>(){});
|
||||
HashMap<String, String> optionMap = this.objectMapper.readValue(json, new TypeReference<Map<String, String>>() {
|
||||
});
|
||||
|
||||
Object obj = null;
|
||||
obj = optionMap.get("valueColumn");
|
||||
|
@ -118,7 +119,8 @@ public class InfraServiceMysqlGenerator {
|
|||
// return objectMapper.writeValueAsString(config);
|
||||
}
|
||||
|
||||
// public void setQueryAndMapping(MetaCrawler metaCrawler, List<Keys> keysList, QueryInfo queryInfo, MappingInfo mappingInfo) {
|
||||
// public void setQueryAndMapping(MetaCrawler metaCrawler, List<Keys> keysList,
|
||||
// QueryInfo queryInfo, MappingInfo mappingInfo) {
|
||||
//
|
||||
// switch (metaCrawler.getId()) {
|
||||
// case 11: // mysql
|
||||
|
|
|
@ -31,7 +31,6 @@ public class SensorConfigGenerator {
|
|||
@Autowired
|
||||
private InfraServiceGenerator infraServiceGenerator;
|
||||
|
||||
|
||||
public String generate(Sensor sensor) throws Exception {
|
||||
PageParams pageParams = new PageParams();
|
||||
pageParams.setPageNo(0);
|
||||
|
@ -42,7 +41,7 @@ public class SensorConfigGenerator {
|
|||
|
||||
List<SensorItem> sensorItems = dbItemList.getContent();
|
||||
|
||||
if(sensorItems.size() <= 0) {
|
||||
if (sensorItems.size() <= 0) {
|
||||
return "";
|
||||
}
|
||||
Sensor dbSensor = sensorItems.get(0).getSensor();
|
||||
|
@ -50,16 +49,14 @@ public class SensorConfigGenerator {
|
|||
Infra infra = this.infraService.readByTargetID(dbSensor.getTarget().getId());
|
||||
|
||||
// 7 = Infra OS Service
|
||||
if(infra.getMetaInfraType().getId() == 7) {
|
||||
if (infra.getMetaInfraType().getId() == 7) {
|
||||
return this.infraServiceGenerator.process(dbSensor, sensorItems, infra);
|
||||
}
|
||||
if(infra.getMetaInfraType().getId() == 2) {
|
||||
if (infra.getMetaInfraType().getId() == 2) {
|
||||
return this.infraHostGenerator.process(dbSensor, sensorItems, infra);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -4,10 +4,7 @@ import com.loafle.overflow.central.commons.utils.PageUtil;
|
|||
import com.loafle.overflow.central.module.history.dao.HistoryDAO;
|
||||
import com.loafle.overflow.core.exception.OverflowException;
|
||||
import com.loafle.overflow.core.model.PageParams;
|
||||
import com.loafle.overflow.model.domain.Domain;
|
||||
import com.loafle.overflow.model.history.History;
|
||||
import com.loafle.overflow.model.meta.MetaHistoryType;
|
||||
import com.loafle.overflow.model.probe.Probe;
|
||||
import com.loafle.overflow.service.central.history.HistoryService;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -23,9 +20,10 @@ public class CentralHistoryService implements HistoryService {
|
|||
return this.historyDAO.save(history);
|
||||
}
|
||||
|
||||
|
||||
public Page<History> readAllByProbeIDAndMetaHistoryTypeID(Long probeID, Integer metaHistoryTypeID, PageParams pageParams) throws OverflowException {
|
||||
return this.historyDAO.findAllByProbeIdAndMetaHistoryTypeId(probeID, metaHistoryTypeID, PageUtil.getPageRequest(pageParams));
|
||||
public Page<History> readAllByProbeIDAndMetaHistoryTypeID(Long probeID, Integer metaHistoryTypeID,
|
||||
PageParams pageParams) throws OverflowException {
|
||||
return this.historyDAO.findAllByProbeIdAndMetaHistoryTypeId(probeID, metaHistoryTypeID,
|
||||
PageUtil.getPageRequest(pageParams));
|
||||
}
|
||||
|
||||
public Page<History> readAllByProbeID(Long probeID, PageParams pageParams) throws OverflowException {
|
||||
|
@ -36,8 +34,10 @@ public class CentralHistoryService implements HistoryService {
|
|||
return this.historyDAO.findAllByDomainId(domainID, PageUtil.getPageRequest(pageParams));
|
||||
}
|
||||
|
||||
public Page<History> readAllByDomainIDAndMetaHistoryTypeID(Long domainID, Integer metaHistoryTypeID, PageParams pageParams) throws OverflowException {
|
||||
return this.historyDAO.findAllByDomainIdAndMetaHistoryTypeId(domainID, metaHistoryTypeID, PageUtil.getPageRequest(pageParams));
|
||||
public Page<History> readAllByDomainIDAndMetaHistoryTypeID(Long domainID, Integer metaHistoryTypeID,
|
||||
PageParams pageParams) throws OverflowException {
|
||||
return this.historyDAO.findAllByDomainIdAndMetaHistoryTypeId(domainID, metaHistoryTypeID,
|
||||
PageUtil.getPageRequest(pageParams));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.loafle.overflow.central.module.infra.service;
|
||||
|
||||
|
||||
import com.loafle.overflow.central.module.infra.dao.InfraHostDAO;
|
||||
import com.loafle.overflow.core.exception.OverflowException;
|
||||
import com.loafle.overflow.model.infra.InfraHost;
|
||||
|
|
|
@ -52,20 +52,20 @@ public class CentralMemberService implements MemberService {
|
|||
public DomainMember signin(String signinId, String signinPw) throws OverflowException {
|
||||
Member m = this.memberDAO.findByEmail(signinId);
|
||||
|
||||
if ( null == m ) {
|
||||
if (null == m) {
|
||||
throw new OverflowException("SignInIdNotExistException()", new Throwable());
|
||||
}
|
||||
|
||||
if ( m.getMetaMemberStatus().getId() == 1 ) {
|
||||
if (m.getMetaMemberStatus().getId() == 1) {
|
||||
throw new OverflowException("EmailNotConfirmedException()", new Throwable());
|
||||
}
|
||||
|
||||
Boolean match = passwordEncoder.matches(signinPw, m.getPw());
|
||||
if(!match) {
|
||||
if (!match) {
|
||||
if (m.getSigninFailCount() > 10) {
|
||||
throw new OverflowException("SigninOverFailedException()", new Throwable());
|
||||
}
|
||||
m.setSigninFailCount(m.getSigninFailCount()+1);
|
||||
m.setSigninFailCount(m.getSigninFailCount() + 1);
|
||||
this.modify(m);
|
||||
throw new OverflowException("SignInPwNotMatchException()", new Throwable());
|
||||
}
|
||||
|
@ -91,10 +91,10 @@ public class CentralMemberService implements MemberService {
|
|||
|
||||
if (!checkPass) {
|
||||
throw new OverflowException("PasswordNotStrongException()", new Throwable());
|
||||
// (
|
||||
// "Passwords must contain at least one uppercase letter, " +
|
||||
// "special character, lowercase letter, and number, " +
|
||||
// "and must be at least 6 characters long.");
|
||||
// (
|
||||
// "Passwords must contain at least one uppercase letter, " +
|
||||
// "special character, lowercase letter, and number, " +
|
||||
// "and must be at least 6 characters long.");
|
||||
}
|
||||
member.setPw(passwordEncoder.encode(pw));
|
||||
|
||||
|
@ -138,11 +138,11 @@ public class CentralMemberService implements MemberService {
|
|||
|
||||
try {
|
||||
deStr = URLDecoder.decode(token, "UTF-8");
|
||||
}catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
// String deEmail = this.emailSender.decrypt(deStr);
|
||||
// String deEmail = this.emailSender.decrypt(deStr);
|
||||
EmailAuth auth = this.emailAuthService.readByToken(deStr);
|
||||
|
||||
if (auth == null) {
|
||||
|
@ -159,9 +159,9 @@ public class CentralMemberService implements MemberService {
|
|||
|
||||
if (!checkPass) {
|
||||
throw new OverflowException("PasswordNotStrongException()", new Throwable());
|
||||
// "Passwords must contain at least one uppercase letter, " +
|
||||
// "special character, lowercase letter, and number, " +
|
||||
// "and must be at least 6 characters long.");
|
||||
// "Passwords must contain at least one uppercase letter, " +
|
||||
// "special character, lowercase letter, and number, " +
|
||||
// "and must be at least 6 characters long.");
|
||||
}
|
||||
member.setPw(passwordEncoder.encode(pw));
|
||||
|
||||
|
@ -186,13 +186,13 @@ public class CentralMemberService implements MemberService {
|
|||
|
||||
if (!checkPass) {
|
||||
throw new OverflowException("PasswordNotStrongException()", new Throwable());
|
||||
// "Passwords must contain at least one uppercase letter, " +
|
||||
// "special character, lowercase letter, and number, " +
|
||||
// "and must be at least 6 characters long.");
|
||||
// "Passwords must contain at least one uppercase letter, " +
|
||||
// "special character, lowercase letter, and number, " +
|
||||
// "and must be at least 6 characters long.");
|
||||
}
|
||||
|
||||
Boolean match = passwordEncoder.matches(member.getPw(), preMember.getPw());
|
||||
if(!match) {
|
||||
if (!match) {
|
||||
member.setPw(passwordEncoder.encode(pw));
|
||||
}
|
||||
} else {
|
||||
|
@ -255,7 +255,7 @@ public class CentralMemberService implements MemberService {
|
|||
|
||||
Probe probe = this.probeService.readByProbeKey(probeKey);
|
||||
|
||||
if(probe == null) {
|
||||
if (probe == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -266,7 +266,7 @@ public class CentralMemberService implements MemberService {
|
|||
|
||||
ApiKey apiKey = this.apiKeyService.readByApiKey(apikey);
|
||||
|
||||
if(apiKey == null) {
|
||||
if (apiKey == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -278,14 +278,8 @@ public class CentralMemberService implements MemberService {
|
|||
return this.domainMemberService.readAllMemberByDomainID(domainID);
|
||||
}
|
||||
|
||||
private static final String PASSWORD_REGEXP = "(" +
|
||||
"(?=.*[a-z])" +
|
||||
"(?=.*\\d)" +
|
||||
"(?=.*[A-Z])" +
|
||||
"(?=.*[!@#$%^&*()_+\\-=\\[\\]{};':\"\\\\|,.<>\\/?])" +
|
||||
"." +
|
||||
"{6,40}" +
|
||||
")";
|
||||
private static final String PASSWORD_REGEXP = "(" + "(?=.*[a-z])" + "(?=.*\\d)" + "(?=.*[A-Z])"
|
||||
+ "(?=.*[!@#$%^&*()_+\\-=\\[\\]{};':\"\\\\|,.<>\\/?])" + "." + "{6,40}" + ")";
|
||||
private Pattern pattern = Pattern.compile(PASSWORD_REGEXP);
|
||||
|
||||
protected boolean isPasswordStrong(String pass) {
|
||||
|
|
|
@ -86,7 +86,8 @@ public class CentralMemberTotpService implements MemberTotpService {
|
|||
|
||||
String secret = key.getKey();
|
||||
// List<Integer> scratchCodes = key.getScratchCodes();
|
||||
// String otpAuthURL = GoogleAuthenticatorQRGenerator.getOtpAuthURL("overFlow", member.getEmail(), key);
|
||||
// String otpAuthURL = GoogleAuthenticatorQRGenerator.getOtpAuthURL("overFlow",
|
||||
// member.getEmail(), key);
|
||||
URIBuilder uri = (new URIBuilder()).setScheme("otpauth").setHost("totp")
|
||||
.setPath("/" + formatLabel("overFlow", member.getEmail())).setParameter("secret", key.getKey());
|
||||
|
||||
|
|
|
@ -10,4 +10,3 @@ import org.springframework.stereotype.Repository;
|
|||
@Repository
|
||||
public interface MetaProbeStatusDAO extends JpaRepository<MetaProbeStatus, Short> {
|
||||
}
|
||||
|
||||
|
|
|
@ -8,5 +8,5 @@ import org.springframework.stereotype.Repository;
|
|||
* Created by insanity on 17. 6. 23.
|
||||
*/
|
||||
@Repository
|
||||
public interface MetaProbeTaskTypeDAO extends JpaRepository<MetaProbeTaskType, Short>{
|
||||
public interface MetaProbeTaskTypeDAO extends JpaRepository<MetaProbeTaskType, Short> {
|
||||
}
|
||||
|
|
|
@ -8,5 +8,5 @@ import org.springframework.stereotype.Repository;
|
|||
* Created by insanity on 17. 6. 23.
|
||||
*/
|
||||
@Repository
|
||||
public interface MetaProbeVersionDAO extends JpaRepository<MetaProbeVersion, Short>{
|
||||
public interface MetaProbeVersionDAO extends JpaRepository<MetaProbeVersion, Short> {
|
||||
}
|
||||
|
|
|
@ -16,5 +16,6 @@ import java.util.List;
|
|||
public interface MetaSensorDisplayMappingDAO extends JpaRepository<MetaSensorDisplayMapping, Short> {
|
||||
|
||||
@Query("SELECT m.metaSensorItemKey from MetaSensorDisplayMapping m where m.metaSensorDisplayItem.id = :metaSensorDisplayItemId")
|
||||
public List<MetaSensorItemKey> findAllMetaSensorItemKeyByMetaSensorDisplayItemId(@Param("metaSensorDisplayItemId") Long metaSensorDisplayItemId);
|
||||
public List<MetaSensorItemKey> findAllMetaSensorItemKeyByMetaSensorDisplayItemId(
|
||||
@Param("metaSensorDisplayItemId") Long metaSensorDisplayItemId);
|
||||
}
|
||||
|
|
|
@ -8,5 +8,5 @@ import org.springframework.stereotype.Repository;
|
|||
* Created by insanity on 17. 6. 23.
|
||||
*/
|
||||
@Repository
|
||||
public interface MetaSensorItemDAO extends JpaRepository<MetaSensorItem, Integer>{
|
||||
public interface MetaSensorItemDAO extends JpaRepository<MetaSensorItem, Integer> {
|
||||
}
|
||||
|
|
|
@ -8,5 +8,5 @@ import org.springframework.stereotype.Repository;
|
|||
* Created by insanity on 17. 6. 23.
|
||||
*/
|
||||
@Repository
|
||||
public interface MetaSensorItemTypeDAO extends JpaRepository<MetaSensorItemType, Short>{
|
||||
public interface MetaSensorItemTypeDAO extends JpaRepository<MetaSensorItemType, Short> {
|
||||
}
|
||||
|
|
|
@ -8,5 +8,5 @@ import org.springframework.stereotype.Repository;
|
|||
* Created by insanity on 17. 6. 23.
|
||||
*/
|
||||
@Repository
|
||||
public interface MetaVendorCrawlerSensorItemDAO extends JpaRepository<MetaVendorCrawlerSensorItem, Long>{
|
||||
public interface MetaVendorCrawlerSensorItemDAO extends JpaRepository<MetaVendorCrawlerSensorItem, Long> {
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.loafle.overflow.central.module.meta.service;
|
|||
|
||||
import com.loafle.overflow.central.module.meta.dao.MetaCrawlerInputItemDAO;
|
||||
import com.loafle.overflow.core.exception.OverflowException;
|
||||
import com.loafle.overflow.model.meta.MetaCrawler;
|
||||
import com.loafle.overflow.model.meta.MetaCrawlerInputItem;
|
||||
import com.loafle.overflow.service.central.meta.MetaCrawlerInputItemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
|
@ -28,6 +28,6 @@ public class CentralMetaHistoryTypeService implements MetaHistoryTypeService {
|
|||
}
|
||||
|
||||
public List<MetaHistoryType> registAll(List<MetaHistoryType> metaHistoryTypes) throws OverflowException {
|
||||
return (List<MetaHistoryType>)this.hisotyTypeDAO.saveAll(metaHistoryTypes);
|
||||
return (List<MetaHistoryType>) this.hisotyTypeDAO.saveAll(metaHistoryTypes);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.loafle.overflow.central.module.meta.service;
|
|||
|
||||
import com.loafle.overflow.central.module.meta.dao.MetaProbePackageDAO;
|
||||
import com.loafle.overflow.core.exception.OverflowException;
|
||||
import com.loafle.overflow.model.meta.MetaProbeOs;
|
||||
import com.loafle.overflow.model.meta.MetaProbePackage;
|
||||
import com.loafle.overflow.service.central.meta.MetaProbePackageService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.loafle.overflow.central.module.meta.service;
|
|||
|
||||
import com.loafle.overflow.central.module.meta.dao.MetaSensorDisplayItemDAO;
|
||||
import com.loafle.overflow.core.exception.OverflowException;
|
||||
import com.loafle.overflow.model.meta.MetaCrawler;
|
||||
import com.loafle.overflow.model.meta.MetaSensorDisplayItem;
|
||||
import com.loafle.overflow.service.central.meta.MetaSensorDisplayItemService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.loafle.overflow.central.module.meta.service;
|
|||
|
||||
import com.loafle.overflow.central.module.meta.dao.MetaSensorDisplayMappingDAO;
|
||||
import com.loafle.overflow.core.exception.OverflowException;
|
||||
import com.loafle.overflow.model.meta.MetaSensorDisplayItem;
|
||||
import com.loafle.overflow.model.meta.MetaSensorDisplayMapping;
|
||||
import com.loafle.overflow.model.meta.MetaSensorItemKey;
|
||||
import com.loafle.overflow.service.central.meta.MetaSensorDisplayMappingService;
|
||||
|
@ -23,7 +22,8 @@ public class CentralMetaSensorDisplayMappingService implements MetaSensorDisplay
|
|||
return this.mappingDAO.save(m);
|
||||
}
|
||||
|
||||
public List<MetaSensorItemKey> readAllMetaSensorItemKeyByDisplayItemID(Long metaSensorDisplayItemID) throws OverflowException {
|
||||
public List<MetaSensorItemKey> readAllMetaSensorItemKeyByDisplayItemID(Long metaSensorDisplayItemID)
|
||||
throws OverflowException {
|
||||
return this.mappingDAO.findAllMetaSensorItemKeyByMetaSensorDisplayItemId(metaSensorDisplayItemID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,6 @@ public class CentralMetaSensorItemTypeService implements MetaSensorItemTypeServi
|
|||
}
|
||||
|
||||
public List<MetaSensorItemType> registAll(List<MetaSensorItemType> list) throws OverflowException {
|
||||
return (List<MetaSensorItemType>)this.sensorItemTypeDAO.saveAll(list);
|
||||
return (List<MetaSensorItemType>) this.sensorItemTypeDAO.saveAll(list);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.loafle.overflow.central.module.meta.service;
|
|||
|
||||
import com.loafle.overflow.central.module.meta.dao.MetaVendorCrawlerDAO;
|
||||
import com.loafle.overflow.core.exception.OverflowException;
|
||||
import com.loafle.overflow.model.meta.MetaInfraVendor;
|
||||
import com.loafle.overflow.model.meta.MetaVendorCrawler;
|
||||
import com.loafle.overflow.service.central.meta.MetaVendorCrawlerService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
|
@ -17,12 +17,15 @@ public interface NoAuthProbeDAO extends JpaRepository<NoAuthProbe, Long> {
|
|||
|
||||
List<NoAuthProbe> findAllByDomainIdAndMetaNoAuthProbeStatusId(Long domainID, Short metaNoAuthProbeStatusId);
|
||||
|
||||
// NoAuthProbeDeprecate findByTempKey(NoAuthProbeDeprecate noAuthAgent);
|
||||
// List<NoAuthProbeDeprecate> findAllByNoAuth(NoAuthProbeDeprecate noAuthAgent);
|
||||
// @Query("SELECT n FROM NoAuthProbe n WHERE n.tempProbeKey = :tempProbeKey")
|
||||
// @Query("select m from Member m WHERE m.email = :#{#m2.email}")
|
||||
// NoAuthProbeDeprecate findByTempKey(NoAuthProbeDeprecate noAuthAgent);
|
||||
// List<NoAuthProbeDeprecate> findAllByNoAuth(NoAuthProbeDeprecate noAuthAgent);
|
||||
// @Query("SELECT n FROM NoAuthProbe n WHERE n.tempProbeKey = :tempProbeKey")
|
||||
// @Query("select m from Member m WHERE m.email = :#{#m2.email}")
|
||||
|
||||
// @Modifying(clearAutomatically = true)
|
||||
// @Query("UPDATE NoAuthProbe n set n.connectDate = :connectDate, n.connectAddress = :connectAddress where n.tempProbeKey = :tempProbeKey")
|
||||
// int saveConnect(@Param("tempProbeKey") String tempProbeKey, @Param("connectDate") Date connectDate, @Param("connectAddress") String connectAddress);
|
||||
// @Query("UPDATE NoAuthProbe n set n.connectDate = :connectDate,
|
||||
// n.connectAddress = :connectAddress where n.tempProbeKey = :tempProbeKey")
|
||||
// int saveConnect(@Param("tempProbeKey") String tempProbeKey,
|
||||
// @Param("connectDate") Date connectDate, @Param("connectAddress") String
|
||||
// connectAddress);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.loafle.overflow.central.commons.utils.PageUtil;
|
|||
import com.loafle.overflow.central.module.notification.dao.NotificationDAO;
|
||||
import com.loafle.overflow.core.exception.OverflowException;
|
||||
import com.loafle.overflow.core.model.PageParams;
|
||||
import com.loafle.overflow.model.member.Member;
|
||||
import com.loafle.overflow.model.notification.Notification;
|
||||
import com.loafle.overflow.service.central.notification.NotificationService;
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.springframework.stereotype.Repository;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* Created by insanity on 17. 5. 29.
|
||||
*/
|
||||
|
@ -15,9 +14,12 @@ import java.util.List;
|
|||
public interface ProbeDAO extends JpaRepository<Probe, Long> {
|
||||
|
||||
Probe findByProbeKey(String probeKey);
|
||||
|
||||
List<Probe> findAllByDomainIdOrderByIdDesc(Long domainID);
|
||||
|
||||
// @Modifying(clearAutomatically = true)
|
||||
// @Query("UPDATE Probe p set p.connectDate = :connectDate, p.connectAddress = :connectAddress where p.probeKey = :probeKey")
|
||||
// int saveConnect(@Param("probeKey") String probeKey, @Param("connectDate") Date connectDate, @Param("connectAddress") String connectAddress);
|
||||
// @Query("UPDATE Probe p set p.connectDate = :connectDate, p.connectAddress =
|
||||
// :connectAddress where p.probeKey = :probeKey")
|
||||
// int saveConnect(@Param("probeKey") String probeKey, @Param("connectDate")
|
||||
// Date connectDate, @Param("connectAddress") String connectAddress);
|
||||
}
|
|
@ -28,7 +28,7 @@ public class CentralProbeService implements ProbeService {
|
|||
}
|
||||
|
||||
public List<Probe> regist(List<Probe> probes) throws OverflowException {
|
||||
return (List<Probe>)this.probeDAO.saveAll(probes);
|
||||
return (List<Probe>) this.probeDAO.saveAll(probes);
|
||||
}
|
||||
|
||||
public List<Probe> readAllByDomainID(Long domainID) throws OverflowException {
|
||||
|
|
|
@ -14,7 +14,7 @@ import java.util.List;
|
|||
* Created by snoop on 17. 6. 28.
|
||||
*/
|
||||
@Service("ProbeTaskService")
|
||||
public class CentralProbeTaskService implements ProbeTaskService{
|
||||
public class CentralProbeTaskService implements ProbeTaskService {
|
||||
|
||||
@Autowired
|
||||
private ProbeTaskDAO probeTaskDAO;
|
||||
|
|
|
@ -17,5 +17,6 @@ import java.util.List;
|
|||
public interface SensorItemDependencyDAO extends JpaRepository<SensorItemDependency, Long> {
|
||||
|
||||
@Query("SELECT s.metaSensorItemKey from SensorItemDependency s where s.metaSensorDisplayItem.id = :metaSensorDisplayItemId")
|
||||
List<MetaSensorItemKey> findAllMetaSensorItemKeyByMetaSensorDisplayItemId(@Param("metaSensorDisplayItemId") Long metaSensorDisplayItemId);
|
||||
List<MetaSensorItemKey> findAllMetaSensorItemKeyByMetaSensorDisplayItemId(
|
||||
@Param("metaSensorDisplayItemId") Long metaSensorDisplayItemId);
|
||||
}
|
||||
|
|
|
@ -5,8 +5,6 @@ import com.loafle.overflow.central.module.generator.service.SensorConfigGenerato
|
|||
import com.loafle.overflow.central.module.sensor.dao.SensorDAO;
|
||||
import com.loafle.overflow.core.exception.OverflowException;
|
||||
import com.loafle.overflow.core.model.PageParams;
|
||||
import com.loafle.overflow.model.domain.Domain;
|
||||
import com.loafle.overflow.model.infra.Infra;
|
||||
import com.loafle.overflow.model.meta.MetaSensorStatus;
|
||||
import com.loafle.overflow.model.probe.Probe;
|
||||
import com.loafle.overflow.model.sensor.Sensor;
|
||||
|
@ -77,7 +75,8 @@ public class CentralSensorService implements SensorService {
|
|||
// if (dbInfra == null) {
|
||||
// throw new OverflowException("", new Throwable());
|
||||
// }
|
||||
// return this.sensorDAO.findAllByTargetId(dbInfra.getTarget().getId(), PageUtil.getPageRequest(pageParams));
|
||||
// return this.sensorDAO.findAllByTargetId(dbInfra.getTarget().getId(),
|
||||
// PageUtil.getPageRequest(pageParams));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -111,7 +110,8 @@ public class CentralSensorService implements SensorService {
|
|||
}
|
||||
|
||||
@Transactional
|
||||
public Sensor registSensorConfig(Sensor sensor, List<SensorItem> sensorItemList, String etcJson) throws OverflowException {
|
||||
public Sensor registSensorConfig(Sensor sensor, List<SensorItem> sensorItemList, String etcJson)
|
||||
throws OverflowException {
|
||||
|
||||
this.targetService.increaseSensorCount(sensor.getTarget());
|
||||
this.sensorDAO.save(sensor);
|
||||
|
@ -134,6 +134,7 @@ public class CentralSensorService implements SensorService {
|
|||
}
|
||||
|
||||
// public List<Sensor> readAllByTarget(Target target, PageParams pageParams) {
|
||||
// return this.sensorDAO.findAllByTarget(target, PageUtil.getPageRequest(pageParams));
|
||||
// return this.sensorDAO.findAllByTarget(target,
|
||||
// PageUtil.getPageRequest(pageParams));
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -13,8 +13,9 @@ import org.springframework.stereotype.Repository;
|
|||
public interface TargetDAO extends JpaRepository<Target, Long> {
|
||||
Target findByInfraId(Long infraId);
|
||||
|
||||
// @Query("select t.infra from target t where t.infra.probe.id = :probeId")
|
||||
// Page<Target> findForProbeId(@Param("probeId") Long probeId, Pageable pageRequest);
|
||||
// @Query("select t.infra from target t where t.infra.probe.id = :probeId")
|
||||
// Page<Target> findForProbeId(@Param("probeId") Long probeId, Pageable
|
||||
// pageRequest);
|
||||
|
||||
Page<Target> findAllByInfraProbeId(Long probeId, Pageable pageRequest);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
// * Created by snoop on 17. 6. 28.
|
||||
// */
|
||||
// @Service("TargetDiscoveryService")
|
||||
// public class CentralTargetDiscoveryService implements TargetDiscoveryService {
|
||||
// public class CentralTargetDiscoveryService implements TargetDiscoveryService
|
||||
// {
|
||||
|
||||
// @Autowired
|
||||
// private TargetService targetService;
|
||||
|
@ -46,7 +47,8 @@
|
|||
// private CentralInfraServiceService infraServiceService;
|
||||
|
||||
// @Transactional
|
||||
// public boolean saveAllTarget(List<Host> hosts, Probe probe) throws OverflowException {
|
||||
// public boolean saveAllTarget(List<Host> hosts, Probe probe) throws
|
||||
// OverflowException {
|
||||
|
||||
// InfraHost infraHost = null;
|
||||
|
||||
|
@ -60,13 +62,15 @@
|
|||
// return true;
|
||||
// }
|
||||
|
||||
// private void createService(InfraHost infraHost, Port port, Probe probe) throws OverflowException {
|
||||
// private void createService(InfraHost infraHost, Port port, Probe probe)
|
||||
// throws OverflowException {
|
||||
|
||||
// MetaInfraType typeService = new MetaInfraType(7);
|
||||
|
||||
// String portType = "UDP";
|
||||
|
||||
// if (port.getPortType() == PortType.TLS || port.getPortType() == PortType.TCP || port.getPortType() == null) {
|
||||
// if (port.getPortType() == PortType.TLS || port.getPortType() == PortType.TCP
|
||||
// || port.getPortType() == null) {
|
||||
// portType = "TCP";
|
||||
// }
|
||||
|
||||
|
@ -75,13 +79,15 @@
|
|||
// }
|
||||
|
||||
// // for(String key : port.getServices().keySet()) {
|
||||
// for (com.loafle.overflow.model.discovery.Service service : port.getServiceList()) {
|
||||
// for (com.loafle.overflow.model.discovery.Service service :
|
||||
// port.getServiceList()) {
|
||||
|
||||
// // com.loafle.overflow.module.discovery.model.Service service =
|
||||
// // port.getServices().get(key);
|
||||
|
||||
// InfraService dbInfraService = this.infraServiceService
|
||||
// .readByInfraHostIDAndPortAndPortType(infraHost.getId(), port.getPortNumber(), portType);
|
||||
// .readByInfraHostIDAndPortAndPortType(infraHost.getId(), port.getPortNumber(),
|
||||
// portType);
|
||||
|
||||
// if (dbInfraService != null) {
|
||||
// if (service.isTarget() && dbInfraService.getTarget() == null) {
|
||||
|
@ -119,7 +125,8 @@
|
|||
|
||||
// }
|
||||
|
||||
// private void createPort(InfraHost infraHost, Host host, Probe probe) throws OverflowException {
|
||||
// private void createPort(InfraHost infraHost, Host host, Probe probe) throws
|
||||
// OverflowException {
|
||||
|
||||
// // if(host.getPorts() == null) {
|
||||
// // return;
|
||||
|
@ -140,11 +147,14 @@
|
|||
// for (Port port : host.getPortList()) {
|
||||
// // Port port = host.getPorts().get(key);
|
||||
|
||||
// if (port.getPortType() == PortType.TLS || port.getPortType() == PortType.TCP) {
|
||||
// if (port.getPortType() == PortType.TLS || port.getPortType() == PortType.TCP)
|
||||
// {
|
||||
// portType = "TCP";
|
||||
// }
|
||||
|
||||
// InfraOSPort dbInfraOSPort = this.infraOSPortService.readByInfraOSIDAndPortAndPortType(infraOS.getId(), port.getPortNumber(),
|
||||
// InfraOSPort dbInfraOSPort =
|
||||
// this.infraOSPortService.readByInfraOSIDAndPortAndPortType(infraOS.getId(),
|
||||
// port.getPortNumber(),
|
||||
// portType);
|
||||
// if (dbInfraOSPort == null) {
|
||||
// InfraOSPort infraOSPort = new InfraOSPort();
|
||||
|
@ -165,7 +175,8 @@
|
|||
// }
|
||||
// }
|
||||
|
||||
// private InfraHost createAndReadHost(Host host, Probe probe) throws OverflowException {
|
||||
// private InfraHost createAndReadHost(Host host, Probe probe) throws
|
||||
// OverflowException {
|
||||
|
||||
// InfraHost infraHost = this.infraHostService.readByIp(host.getIpv4());
|
||||
// if (infraHost != null) {
|
||||
|
|
|
@ -102,8 +102,9 @@ public class CentralTargetService implements TargetService {
|
|||
|
||||
public Page<Target> readAllByProbeID(Long probeID, PageParams pageParams) throws OverflowException {
|
||||
return this.targetDAO.findAllByInfraProbeId(probeID, PageUtil.getPageRequest(pageParams));
|
||||
// return null;
|
||||
// return null;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public List<Target> registDiscoveredTargets(Long probeId, List<Host> hosts, List<Service> services)
|
||||
throws OverflowException {
|
||||
|
@ -121,7 +122,8 @@ public class CentralTargetService implements TargetService {
|
|||
InfraHost infraHost = this.registInfraHostByDiscoveredHost(host, probeId);
|
||||
Target target = new Target();
|
||||
target.setInfra(infraHost);
|
||||
String displayName = (host.getIpv6() == null || host.getIpv6().trim().isEmpty()) ? host.getIpv6() : host.getIpv4();
|
||||
String displayName = (host.getIpv6() == null || host.getIpv6().trim().isEmpty()) ? host.getIpv6()
|
||||
: host.getIpv4();
|
||||
target.setDisplayName(displayName);
|
||||
targets.add(this.targetDAO.save(target));
|
||||
}
|
||||
|
|
|
@ -34,13 +34,13 @@ public class ServiceProxy {
|
|||
ServiceImpl serviceImpl = ctx.getBean(ServiceImpl.class);
|
||||
|
||||
server = NettyServerBuilder.forPort(port)
|
||||
.addService(ServerInterceptors.intercept(serviceImpl, proxyServerInterceptor))
|
||||
.build().start();
|
||||
.addService(ServerInterceptors.intercept(serviceImpl, proxyServerInterceptor)).build().start();
|
||||
logger.info("Server started, listening on " + port);
|
||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Use stderr here since the logger may have been reset by its JVM shutdown hook.
|
||||
// Use stderr here since the logger may have been reset by its JVM shutdown
|
||||
// hook.
|
||||
System.err.println("*** shutting down gRPC server since JVM is shutting down");
|
||||
ServiceProxy.this.stop();
|
||||
System.err.println("*** server shut down");
|
||||
|
@ -105,4 +105,3 @@ public class ServiceProxy {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ public class CacheConfiguration {
|
|||
|
||||
@Bean
|
||||
public CacheManager cacheManager() {
|
||||
//A EhCache based Cache manager
|
||||
// A EhCache based Cache manager
|
||||
CaffeineCacheManager cacheManager = new CaffeineCacheManager(cacheNames);
|
||||
cacheManager.setAllowNullValues(false);
|
||||
cacheManager.setCacheSpecification(spec);
|
||||
|
|
|
@ -21,13 +21,12 @@ import javax.persistence.EntityManager;
|
|||
import javax.sql.DataSource;
|
||||
import java.util.Properties;
|
||||
|
||||
|
||||
/**
|
||||
* Created by root on 17. 6. 13.
|
||||
*/
|
||||
@Configuration
|
||||
@EnableTransactionManagement
|
||||
@EnableJpaRepositories(basePackages = {"com.loafle.overflow"})
|
||||
@EnableJpaRepositories(basePackages = { "com.loafle.overflow" })
|
||||
public class JdbcConfiguration implements TransactionManagementConfigurer {
|
||||
@Value("${datasource.driver-class-name}")
|
||||
private String driver;
|
||||
|
@ -69,8 +68,6 @@ public class JdbcConfiguration implements TransactionManagementConfigurer {
|
|||
return entityManagerFactoryBean;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Bean
|
||||
@Qualifier(value = "transactionManager")
|
||||
public PlatformTransactionManager annotationDrivenTransactionManager() {
|
||||
|
|
|
@ -57,7 +57,6 @@ public class MailConfiguration {
|
|||
return javaMailProperties;
|
||||
}
|
||||
|
||||
|
||||
@Bean
|
||||
public VelocityEngine getVelocityEngine() throws VelocityException, IOException {
|
||||
Properties properties = new Properties();
|
||||
|
|
|
@ -41,7 +41,6 @@ public class RedisConfiguration {
|
|||
JedisConnectionFactory jedisConFactory = new JedisConnectionFactory(redisStandaloneConfiguration,
|
||||
jedisClientConfiguration.build());
|
||||
|
||||
|
||||
// JedisConnectionFactory jedisConFactory = new JedisConnectionFactory();
|
||||
// jedisConFactory.setHostName(host);
|
||||
// jedisConFactory.setPort(port);
|
||||
|
@ -64,7 +63,7 @@ public class RedisConfiguration {
|
|||
@Bean
|
||||
Map<String, ChannelTopic> topics() {
|
||||
Map<String, ChannelTopic> topicMap = new HashMap<>(this.channels.size());
|
||||
for (String channel: this.channels) {
|
||||
for (String channel : this.channels) {
|
||||
topicMap.put(channel, new ChannelTopic(channel));
|
||||
}
|
||||
return topicMap;
|
||||
|
|
Loading…
Reference in New Issue
Block a user