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"
|
"java.configuration.updateBuildConfiguration": "automatic"
|
||||||
}
|
}
|
|
@ -17,8 +17,10 @@ public class PageUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PageRequest getPageRequest(PageParams pageParams) {
|
public static PageRequest getPageRequest(PageParams pageParams) {
|
||||||
if(pageParams.getSortCol().isEmpty()) pageParams.setSortCol("id");
|
if (pageParams.getSortCol().isEmpty())
|
||||||
if(pageParams.getSortDirection().isEmpty()) pageParams.setSortDirection("descending");
|
pageParams.setSortCol("id");
|
||||||
|
if (pageParams.getSortDirection().isEmpty())
|
||||||
|
pageParams.setSortDirection("descending");
|
||||||
|
|
||||||
return new PageRequest(pageParams.getPageNo(), pageParams.getCountPerPage(),
|
return new PageRequest(pageParams.getPageNo(), pageParams.getCountPerPage(),
|
||||||
new Sort(PageUtil.getSortDirection(pageParams.getSortDirection()), pageParams.getSortCol()));
|
new Sort(PageUtil.getSortDirection(pageParams.getSortDirection()), pageParams.getSortCol()));
|
||||||
|
|
|
@ -7,10 +7,8 @@ import static io.grpc.Metadata.ASCII_STRING_MARSHALLER;
|
||||||
|
|
||||||
public class SessionMetadata {
|
public class SessionMetadata {
|
||||||
/*
|
/*
|
||||||
digits: 0-9
|
* digits: 0-9 uppercase letters: A-Z (normalized to lower) lowercase letters:
|
||||||
uppercase letters: A-Z (normalized to lower)
|
* a-z special characters: -_.
|
||||||
lowercase letters: a-z
|
|
||||||
special characters: -_.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static final String CLIENT_TYPE_KEY = "OVERFLOW_GRPC_CLIENT_TYPE";
|
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_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 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_CLIENT_TYPE_KEY = Metadata.Key.of(CLIENT_TYPE_KEY,
|
||||||
public static final Metadata.Key<String> METADATA_SESSION_ID_KEY = Metadata.Key.of(SESSION_ID_KEY, ASCII_STRING_MARSHALLER);
|
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_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() {
|
public static ClientType getClientType() {
|
||||||
return ClientType.valueOf(CTX_CLIENT_TYPE_KEY.get());
|
return ClientType.valueOf(CTX_CLIENT_TYPE_KEY.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getSessionID() {
|
public static String getSessionID() {
|
||||||
return CTX_SESSION_ID_KEY.get();
|
return CTX_SESSION_ID_KEY.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getTargetID() {
|
public static String getTargetID() {
|
||||||
return CTX_TARGET_ID_KEY.get();
|
return CTX_TARGET_ID_KEY.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static enum ClientType {
|
public static enum ClientType {
|
||||||
MEMBER("MEMBER"),
|
MEMBER("MEMBER"), PROBE("PROBE");
|
||||||
PROBE("PROBE");
|
|
||||||
|
|
||||||
final private String name;
|
final private String name;
|
||||||
|
|
||||||
private ClientType(String name) {
|
private ClientType(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,13 +6,9 @@ package com.loafle.overflow.central.commons.utils;
|
||||||
public class StringConvertor {
|
public class StringConvertor {
|
||||||
|
|
||||||
public static String intToIp(long i) {
|
public static String intToIp(long i) {
|
||||||
return ((i >> 24 ) & 0xFF) + "." +
|
return ((i >> 24) & 0xFF) + "." + ((i >> 16) & 0xFF) + "." + ((i >> 8) & 0xFF) + "." + (i & 0xFF);
|
||||||
((i >> 16 ) & 0xFF) + "." +
|
|
||||||
((i >> 8 ) & 0xFF) + "." +
|
|
||||||
( i & 0xFF);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static long ipToLong(String ipAddress) {
|
public static long ipToLong(String ipAddress) {
|
||||||
|
|
||||||
String[] ipAddressInArray = ipAddress.split("\\.");
|
String[] ipAddressInArray = ipAddress.split("\\.");
|
||||||
|
@ -29,7 +25,6 @@ public class StringConvertor {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// https://github.com/Sovietaced/floodlight/blob/master/src/main/java/net/floodlightcontroller/util/MACAddress.java
|
// https://github.com/Sovietaced/floodlight/blob/master/src/main/java/net/floodlightcontroller/util/MACAddress.java
|
||||||
|
|
||||||
public static final int MAC_ADDRESS_LENGTH = 6;
|
public static final int MAC_ADDRESS_LENGTH = 6;
|
||||||
|
@ -38,8 +33,7 @@ public class StringConvertor {
|
||||||
String[] elements = address.split(":");
|
String[] elements = address.split(":");
|
||||||
if (elements.length != MAC_ADDRESS_LENGTH) {
|
if (elements.length != MAC_ADDRESS_LENGTH) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Specified MAC Address must contain 12 hex digits" +
|
"Specified MAC Address must contain 12 hex digits" + " separated pairwise by :'s.");
|
||||||
" separated pairwise by :'s.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[] addressInBytes = new byte[MAC_ADDRESS_LENGTH];
|
byte[] addressInBytes = new byte[MAC_ADDRESS_LENGTH];
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
package com.loafle.overflow.central.module.apikey.dao;
|
package com.loafle.overflow.central.module.apikey.dao;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import com.loafle.overflow.model.apikey.ApiKey;
|
import com.loafle.overflow.model.apikey.ApiKey;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by root on 17. 6. 1.
|
* Created by root on 17. 6. 1.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
package com.loafle.overflow.central.module.apikey.service;
|
package com.loafle.overflow.central.module.apikey.service;
|
||||||
|
|
||||||
|
|
||||||
import com.loafle.overflow.central.module.apikey.dao.ApiKeyDAO;
|
import com.loafle.overflow.central.module.apikey.dao.ApiKeyDAO;
|
||||||
|
|
||||||
|
|
||||||
import com.loafle.overflow.core.exception.OverflowException;
|
import com.loafle.overflow.core.exception.OverflowException;
|
||||||
import com.loafle.overflow.model.apikey.ApiKey;
|
import com.loafle.overflow.model.apikey.ApiKey;
|
||||||
import com.loafle.overflow.service.central.apikey.ApiKeyService;
|
import com.loafle.overflow.service.central.apikey.ApiKeyService;
|
||||||
|
@ -16,11 +14,9 @@ import org.springframework.stereotype.Service;
|
||||||
@Service("ApiKeyService")
|
@Service("ApiKeyService")
|
||||||
public class CentralApiKeyService implements ApiKeyService {
|
public class CentralApiKeyService implements ApiKeyService {
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ApiKeyDAO apiKeyDAO;
|
private ApiKeyDAO apiKeyDAO;
|
||||||
|
|
||||||
|
|
||||||
public ApiKey regist(ApiKey apiKey) throws OverflowException {
|
public ApiKey regist(ApiKey apiKey) throws OverflowException {
|
||||||
|
|
||||||
return this.apiKeyDAO.save(apiKey);
|
return this.apiKeyDAO.save(apiKey);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.loafle.overflow.central.module.domain.dao;
|
package com.loafle.overflow.central.module.domain.dao;
|
||||||
|
|
||||||
|
|
||||||
import com.loafle.overflow.model.domain.Domain;
|
import com.loafle.overflow.model.domain.Domain;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
|
@ -26,8 +26,6 @@ public class GenerateUtil {
|
||||||
@Autowired
|
@Autowired
|
||||||
private MetaSensorItemKeyService metaSensorItemKeyService;
|
private MetaSensorItemKeyService metaSensorItemKeyService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private Map<Short, Map<Integer, MetaSensorItemKey>> mappingMap = null;
|
private Map<Short, Map<Integer, MetaSensorItemKey>> mappingMap = null;
|
||||||
|
|
||||||
public Map<Integer, MetaSensorItemKey> initMappingMap(MetaCrawler metaCrawler) throws OverflowException {
|
public Map<Integer, MetaSensorItemKey> initMappingMap(MetaCrawler metaCrawler) throws OverflowException {
|
||||||
|
@ -48,8 +46,6 @@ public class GenerateUtil {
|
||||||
return resultMap;
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Crawler getCrawler(MetaCrawler metaCrawler) throws OverflowException {
|
public Crawler getCrawler(MetaCrawler metaCrawler) throws OverflowException {
|
||||||
|
|
||||||
Crawler crawler = new Crawler();
|
Crawler crawler = new Crawler();
|
||||||
|
@ -65,8 +61,7 @@ public class GenerateUtil {
|
||||||
|| metaCrawler.getId() == MetaCrawlerEnum.POSTGRESQL_CRAWLER.getValue()
|
|| metaCrawler.getId() == MetaCrawlerEnum.POSTGRESQL_CRAWLER.getValue()
|
||||||
|| metaCrawler.getId() == MetaCrawlerEnum.JMX_CRAWLER.getValue()) {
|
|| metaCrawler.getId() == MetaCrawlerEnum.JMX_CRAWLER.getValue()) {
|
||||||
container = "java_proxy";
|
container = "java_proxy";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
container = "network_proxy";
|
container = "network_proxy";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,10 +70,8 @@ public class GenerateUtil {
|
||||||
return crawler;
|
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<>();
|
Map<String, List<MetaSensorItemKey>> metricMap = new HashMap<>();
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.loafle.overflow.central.module.generator.service;
|
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.core.type.PortType;
|
||||||
import com.loafle.overflow.model.auth.AuthCrawler;
|
import com.loafle.overflow.model.auth.AuthCrawler;
|
||||||
import com.loafle.overflow.model.infra.Infra;
|
import com.loafle.overflow.model.infra.Infra;
|
||||||
|
@ -77,7 +76,8 @@ public class InfraHostGenerator {
|
||||||
|
|
||||||
private Target createTarget(InfraHost infraHost, Sensor dbSensor) throws Exception {
|
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) {
|
if (authCrawler == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -87,7 +87,9 @@ public class InfraHostGenerator {
|
||||||
Connection connection = new Connection();
|
Connection connection = new Connection();
|
||||||
connection.setIp(infraHost.getIpv4());
|
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()) {
|
if (dbSensor.getMetaCrawler().getId() == MetaCrawlerEnum.WMI_CRAWLER.getValue()) {
|
||||||
connection.setPort(135);
|
connection.setPort(135);
|
||||||
|
|
|
@ -86,7 +86,8 @@ public class InfraHostWMIGenerator {
|
||||||
|
|
||||||
String json = tempItemKey.getOption();
|
String json = tempItemKey.getOption();
|
||||||
if (json != null && json.length() > 0) {
|
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;
|
Object obj = null;
|
||||||
obj = optionMap.get("appends");
|
obj = optionMap.get("appends");
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.loafle.overflow.central.module.generator.service;
|
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.core.type.PortType;
|
||||||
import com.loafle.overflow.model.auth.AuthCrawler;
|
import com.loafle.overflow.model.auth.AuthCrawler;
|
||||||
import com.loafle.overflow.model.infra.Infra;
|
import com.loafle.overflow.model.infra.Infra;
|
||||||
|
@ -58,7 +57,6 @@ public class InfraServiceGenerator {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sensorConfig.setTarget(target);
|
sensorConfig.setTarget(target);
|
||||||
|
|
||||||
// FIXME: Interval
|
// FIXME: Interval
|
||||||
|
@ -82,7 +80,8 @@ public class InfraServiceGenerator {
|
||||||
|
|
||||||
private Target createTarget(InfraService infraService, Sensor sensor) throws Exception {
|
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;
|
return null;
|
||||||
|
@ -97,7 +96,9 @@ public class InfraServiceGenerator {
|
||||||
|
|
||||||
target.setConnection(connection);
|
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<>();
|
Map<String, Object> auth = new HashMap<>();
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,8 @@ public class InfraServiceJMXGenerator {
|
||||||
List<String> arrayCol = null;
|
List<String> arrayCol = null;
|
||||||
|
|
||||||
if (json != null && json.length() > 0) {
|
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;
|
Object obj = null;
|
||||||
obj = optionMap.get("aliases");
|
obj = optionMap.get("aliases");
|
||||||
|
|
|
@ -81,7 +81,8 @@ public class InfraServiceMysqlGenerator {
|
||||||
|
|
||||||
String json = tempItemKey.getOption();
|
String json = tempItemKey.getOption();
|
||||||
if (json != null && json.length() > 0) {
|
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;
|
Object obj = null;
|
||||||
obj = optionMap.get("valueColumn");
|
obj = optionMap.get("valueColumn");
|
||||||
|
@ -118,7 +119,8 @@ public class InfraServiceMysqlGenerator {
|
||||||
// return objectMapper.writeValueAsString(config);
|
// 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()) {
|
// switch (metaCrawler.getId()) {
|
||||||
// case 11: // mysql
|
// case 11: // mysql
|
||||||
|
|
|
@ -31,7 +31,6 @@ public class SensorConfigGenerator {
|
||||||
@Autowired
|
@Autowired
|
||||||
private InfraServiceGenerator infraServiceGenerator;
|
private InfraServiceGenerator infraServiceGenerator;
|
||||||
|
|
||||||
|
|
||||||
public String generate(Sensor sensor) throws Exception {
|
public String generate(Sensor sensor) throws Exception {
|
||||||
PageParams pageParams = new PageParams();
|
PageParams pageParams = new PageParams();
|
||||||
pageParams.setPageNo(0);
|
pageParams.setPageNo(0);
|
||||||
|
@ -60,6 +59,4 @@ public class SensorConfigGenerator {
|
||||||
return null;
|
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.central.module.history.dao.HistoryDAO;
|
||||||
import com.loafle.overflow.core.exception.OverflowException;
|
import com.loafle.overflow.core.exception.OverflowException;
|
||||||
import com.loafle.overflow.core.model.PageParams;
|
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.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 com.loafle.overflow.service.central.history.HistoryService;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -23,9 +20,10 @@ public class CentralHistoryService implements HistoryService {
|
||||||
return this.historyDAO.save(history);
|
return this.historyDAO.save(history);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Page<History> readAllByProbeIDAndMetaHistoryTypeID(Long probeID, Integer metaHistoryTypeID,
|
||||||
public Page<History> readAllByProbeIDAndMetaHistoryTypeID(Long probeID, Integer metaHistoryTypeID, PageParams pageParams) throws OverflowException {
|
PageParams pageParams) throws OverflowException {
|
||||||
return this.historyDAO.findAllByProbeIdAndMetaHistoryTypeId(probeID, metaHistoryTypeID, PageUtil.getPageRequest(pageParams));
|
return this.historyDAO.findAllByProbeIdAndMetaHistoryTypeId(probeID, metaHistoryTypeID,
|
||||||
|
PageUtil.getPageRequest(pageParams));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<History> readAllByProbeID(Long probeID, PageParams pageParams) throws OverflowException {
|
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));
|
return this.historyDAO.findAllByDomainId(domainID, PageUtil.getPageRequest(pageParams));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<History> readAllByDomainIDAndMetaHistoryTypeID(Long domainID, Integer metaHistoryTypeID, PageParams pageParams) throws OverflowException {
|
public Page<History> readAllByDomainIDAndMetaHistoryTypeID(Long domainID, Integer metaHistoryTypeID,
|
||||||
return this.historyDAO.findAllByDomainIdAndMetaHistoryTypeId(domainID, metaHistoryTypeID, PageUtil.getPageRequest(pageParams));
|
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;
|
package com.loafle.overflow.central.module.infra.service;
|
||||||
|
|
||||||
|
|
||||||
import com.loafle.overflow.central.module.infra.dao.InfraHostDAO;
|
import com.loafle.overflow.central.module.infra.dao.InfraHostDAO;
|
||||||
import com.loafle.overflow.core.exception.OverflowException;
|
import com.loafle.overflow.core.exception.OverflowException;
|
||||||
import com.loafle.overflow.model.infra.InfraHost;
|
import com.loafle.overflow.model.infra.InfraHost;
|
||||||
|
|
|
@ -278,14 +278,8 @@ public class CentralMemberService implements MemberService {
|
||||||
return this.domainMemberService.readAllMemberByDomainID(domainID);
|
return this.domainMemberService.readAllMemberByDomainID(domainID);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String PASSWORD_REGEXP = "(" +
|
private static final String PASSWORD_REGEXP = "(" + "(?=.*[a-z])" + "(?=.*\\d)" + "(?=.*[A-Z])"
|
||||||
"(?=.*[a-z])" +
|
+ "(?=.*[!@#$%^&*()_+\\-=\\[\\]{};':\"\\\\|,.<>\\/?])" + "." + "{6,40}" + ")";
|
||||||
"(?=.*\\d)" +
|
|
||||||
"(?=.*[A-Z])" +
|
|
||||||
"(?=.*[!@#$%^&*()_+\\-=\\[\\]{};':\"\\\\|,.<>\\/?])" +
|
|
||||||
"." +
|
|
||||||
"{6,40}" +
|
|
||||||
")";
|
|
||||||
private Pattern pattern = Pattern.compile(PASSWORD_REGEXP);
|
private Pattern pattern = Pattern.compile(PASSWORD_REGEXP);
|
||||||
|
|
||||||
protected boolean isPasswordStrong(String pass) {
|
protected boolean isPasswordStrong(String pass) {
|
||||||
|
|
|
@ -86,7 +86,8 @@ public class CentralMemberTotpService implements MemberTotpService {
|
||||||
|
|
||||||
String secret = key.getKey();
|
String secret = key.getKey();
|
||||||
// List<Integer> scratchCodes = key.getScratchCodes();
|
// 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")
|
URIBuilder uri = (new URIBuilder()).setScheme("otpauth").setHost("totp")
|
||||||
.setPath("/" + formatLabel("overFlow", member.getEmail())).setParameter("secret", key.getKey());
|
.setPath("/" + formatLabel("overFlow", member.getEmail())).setParameter("secret", key.getKey());
|
||||||
|
|
||||||
|
|
|
@ -10,4 +10,3 @@ import org.springframework.stereotype.Repository;
|
||||||
@Repository
|
@Repository
|
||||||
public interface MetaProbeStatusDAO extends JpaRepository<MetaProbeStatus, Short> {
|
public interface MetaProbeStatusDAO extends JpaRepository<MetaProbeStatus, Short> {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,5 +16,6 @@ import java.util.List;
|
||||||
public interface MetaSensorDisplayMappingDAO extends JpaRepository<MetaSensorDisplayMapping, Short> {
|
public interface MetaSensorDisplayMappingDAO extends JpaRepository<MetaSensorDisplayMapping, Short> {
|
||||||
|
|
||||||
@Query("SELECT m.metaSensorItemKey from MetaSensorDisplayMapping m where m.metaSensorDisplayItem.id = :metaSensorDisplayItemId")
|
@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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.central.module.meta.dao.MetaCrawlerInputItemDAO;
|
||||||
import com.loafle.overflow.core.exception.OverflowException;
|
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.model.meta.MetaCrawlerInputItem;
|
||||||
import com.loafle.overflow.service.central.meta.MetaCrawlerInputItemService;
|
import com.loafle.overflow.service.central.meta.MetaCrawlerInputItemService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
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.MetaProbePackageDAO;
|
import com.loafle.overflow.central.module.meta.dao.MetaProbePackageDAO;
|
||||||
import com.loafle.overflow.core.exception.OverflowException;
|
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.model.meta.MetaProbePackage;
|
||||||
import com.loafle.overflow.service.central.meta.MetaProbePackageService;
|
import com.loafle.overflow.service.central.meta.MetaProbePackageService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
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.central.module.meta.dao.MetaSensorDisplayItemDAO;
|
||||||
import com.loafle.overflow.core.exception.OverflowException;
|
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.model.meta.MetaSensorDisplayItem;
|
||||||
import com.loafle.overflow.service.central.meta.MetaSensorDisplayItemService;
|
import com.loafle.overflow.service.central.meta.MetaSensorDisplayItemService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
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.central.module.meta.dao.MetaSensorDisplayMappingDAO;
|
||||||
import com.loafle.overflow.core.exception.OverflowException;
|
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.MetaSensorDisplayMapping;
|
||||||
import com.loafle.overflow.model.meta.MetaSensorItemKey;
|
import com.loafle.overflow.model.meta.MetaSensorItemKey;
|
||||||
import com.loafle.overflow.service.central.meta.MetaSensorDisplayMappingService;
|
import com.loafle.overflow.service.central.meta.MetaSensorDisplayMappingService;
|
||||||
|
@ -23,7 +22,8 @@ public class CentralMetaSensorDisplayMappingService implements MetaSensorDisplay
|
||||||
return this.mappingDAO.save(m);
|
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);
|
return this.mappingDAO.findAllMetaSensorItemKeyByMetaSensorDisplayItemId(metaSensorDisplayItemID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.central.module.meta.dao.MetaVendorCrawlerDAO;
|
||||||
import com.loafle.overflow.core.exception.OverflowException;
|
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.model.meta.MetaVendorCrawler;
|
||||||
import com.loafle.overflow.service.central.meta.MetaVendorCrawlerService;
|
import com.loafle.overflow.service.central.meta.MetaVendorCrawlerService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
|
@ -23,6 +23,9 @@ public interface NoAuthProbeDAO extends JpaRepository<NoAuthProbe, Long> {
|
||||||
// @Query("select m from Member m WHERE m.email = :#{#m2.email}")
|
// @Query("select m from Member m WHERE m.email = :#{#m2.email}")
|
||||||
|
|
||||||
// @Modifying(clearAutomatically = true)
|
// @Modifying(clearAutomatically = true)
|
||||||
// @Query("UPDATE NoAuthProbe n set n.connectDate = :connectDate, n.connectAddress = :connectAddress where n.tempProbeKey = :tempProbeKey")
|
// @Query("UPDATE NoAuthProbe n set n.connectDate = :connectDate,
|
||||||
// int saveConnect(@Param("tempProbeKey") String tempProbeKey, @Param("connectDate") Date connectDate, @Param("connectAddress") String connectAddress);
|
// 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.central.module.notification.dao.NotificationDAO;
|
||||||
import com.loafle.overflow.core.exception.OverflowException;
|
import com.loafle.overflow.core.exception.OverflowException;
|
||||||
import com.loafle.overflow.core.model.PageParams;
|
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.model.notification.Notification;
|
||||||
import com.loafle.overflow.service.central.notification.NotificationService;
|
import com.loafle.overflow.service.central.notification.NotificationService;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by insanity on 17. 5. 29.
|
* Created by insanity on 17. 5. 29.
|
||||||
*/
|
*/
|
||||||
|
@ -15,9 +14,12 @@ import java.util.List;
|
||||||
public interface ProbeDAO extends JpaRepository<Probe, Long> {
|
public interface ProbeDAO extends JpaRepository<Probe, Long> {
|
||||||
|
|
||||||
Probe findByProbeKey(String probeKey);
|
Probe findByProbeKey(String probeKey);
|
||||||
|
|
||||||
List<Probe> findAllByDomainIdOrderByIdDesc(Long domainID);
|
List<Probe> findAllByDomainIdOrderByIdDesc(Long domainID);
|
||||||
|
|
||||||
// @Modifying(clearAutomatically = true)
|
// @Modifying(clearAutomatically = true)
|
||||||
// @Query("UPDATE Probe p set p.connectDate = :connectDate, p.connectAddress = :connectAddress where p.probeKey = :probeKey")
|
// @Query("UPDATE Probe p set p.connectDate = :connectDate, p.connectAddress =
|
||||||
// int saveConnect(@Param("probeKey") String probeKey, @Param("connectDate") Date connectDate, @Param("connectAddress") String connectAddress);
|
// :connectAddress where p.probeKey = :probeKey")
|
||||||
|
// int saveConnect(@Param("probeKey") String probeKey, @Param("connectDate")
|
||||||
|
// Date connectDate, @Param("connectAddress") String connectAddress);
|
||||||
}
|
}
|
|
@ -17,5 +17,6 @@ import java.util.List;
|
||||||
public interface SensorItemDependencyDAO extends JpaRepository<SensorItemDependency, Long> {
|
public interface SensorItemDependencyDAO extends JpaRepository<SensorItemDependency, Long> {
|
||||||
|
|
||||||
@Query("SELECT s.metaSensorItemKey from SensorItemDependency s where s.metaSensorDisplayItem.id = :metaSensorDisplayItemId")
|
@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.central.module.sensor.dao.SensorDAO;
|
||||||
import com.loafle.overflow.core.exception.OverflowException;
|
import com.loafle.overflow.core.exception.OverflowException;
|
||||||
import com.loafle.overflow.core.model.PageParams;
|
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.meta.MetaSensorStatus;
|
||||||
import com.loafle.overflow.model.probe.Probe;
|
import com.loafle.overflow.model.probe.Probe;
|
||||||
import com.loafle.overflow.model.sensor.Sensor;
|
import com.loafle.overflow.model.sensor.Sensor;
|
||||||
|
@ -77,7 +75,8 @@ public class CentralSensorService implements SensorService {
|
||||||
// if (dbInfra == null) {
|
// if (dbInfra == null) {
|
||||||
// throw new OverflowException("", new Throwable());
|
// 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;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,7 +110,8 @@ public class CentralSensorService implements SensorService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@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.targetService.increaseSensorCount(sensor.getTarget());
|
||||||
this.sensorDAO.save(sensor);
|
this.sensorDAO.save(sensor);
|
||||||
|
@ -134,6 +134,7 @@ public class CentralSensorService implements SensorService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// public List<Sensor> readAllByTarget(Target target, PageParams pageParams) {
|
// public List<Sensor> readAllByTarget(Target target, PageParams pageParams) {
|
||||||
// return this.sensorDAO.findAllByTarget(target, PageUtil.getPageRequest(pageParams));
|
// return this.sensorDAO.findAllByTarget(target,
|
||||||
|
// PageUtil.getPageRequest(pageParams));
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,8 @@ public interface TargetDAO extends JpaRepository<Target, Long> {
|
||||||
Target findByInfraId(Long infraId);
|
Target findByInfraId(Long infraId);
|
||||||
|
|
||||||
// @Query("select t.infra from target t where t.infra.probe.id = :probeId")
|
// @Query("select t.infra from target t where t.infra.probe.id = :probeId")
|
||||||
// Page<Target> findForProbeId(@Param("probeId") Long probeId, Pageable pageRequest);
|
// Page<Target> findForProbeId(@Param("probeId") Long probeId, Pageable
|
||||||
|
// pageRequest);
|
||||||
|
|
||||||
Page<Target> findAllByInfraProbeId(Long probeId, Pageable pageRequest);
|
Page<Target> findAllByInfraProbeId(Long probeId, Pageable pageRequest);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
// * Created by snoop on 17. 6. 28.
|
// * Created by snoop on 17. 6. 28.
|
||||||
// */
|
// */
|
||||||
// @Service("TargetDiscoveryService")
|
// @Service("TargetDiscoveryService")
|
||||||
// public class CentralTargetDiscoveryService implements TargetDiscoveryService {
|
// public class CentralTargetDiscoveryService implements TargetDiscoveryService
|
||||||
|
// {
|
||||||
|
|
||||||
// @Autowired
|
// @Autowired
|
||||||
// private TargetService targetService;
|
// private TargetService targetService;
|
||||||
|
@ -46,7 +47,8 @@
|
||||||
// private CentralInfraServiceService infraServiceService;
|
// private CentralInfraServiceService infraServiceService;
|
||||||
|
|
||||||
// @Transactional
|
// @Transactional
|
||||||
// public boolean saveAllTarget(List<Host> hosts, Probe probe) throws OverflowException {
|
// public boolean saveAllTarget(List<Host> hosts, Probe probe) throws
|
||||||
|
// OverflowException {
|
||||||
|
|
||||||
// InfraHost infraHost = null;
|
// InfraHost infraHost = null;
|
||||||
|
|
||||||
|
@ -60,13 +62,15 @@
|
||||||
// return true;
|
// 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);
|
// MetaInfraType typeService = new MetaInfraType(7);
|
||||||
|
|
||||||
// String portType = "UDP";
|
// 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";
|
// portType = "TCP";
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
@ -75,13 +79,15 @@
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// // for(String key : port.getServices().keySet()) {
|
// // 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 =
|
// // com.loafle.overflow.module.discovery.model.Service service =
|
||||||
// // port.getServices().get(key);
|
// // port.getServices().get(key);
|
||||||
|
|
||||||
// InfraService dbInfraService = this.infraServiceService
|
// InfraService dbInfraService = this.infraServiceService
|
||||||
// .readByInfraHostIDAndPortAndPortType(infraHost.getId(), port.getPortNumber(), portType);
|
// .readByInfraHostIDAndPortAndPortType(infraHost.getId(), port.getPortNumber(),
|
||||||
|
// portType);
|
||||||
|
|
||||||
// if (dbInfraService != null) {
|
// if (dbInfraService != null) {
|
||||||
// if (service.isTarget() && dbInfraService.getTarget() == 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) {
|
// // if(host.getPorts() == null) {
|
||||||
// // return;
|
// // return;
|
||||||
|
@ -140,11 +147,14 @@
|
||||||
// for (Port port : host.getPortList()) {
|
// for (Port port : host.getPortList()) {
|
||||||
// // Port port = host.getPorts().get(key);
|
// // 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";
|
// portType = "TCP";
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// InfraOSPort dbInfraOSPort = this.infraOSPortService.readByInfraOSIDAndPortAndPortType(infraOS.getId(), port.getPortNumber(),
|
// InfraOSPort dbInfraOSPort =
|
||||||
|
// this.infraOSPortService.readByInfraOSIDAndPortAndPortType(infraOS.getId(),
|
||||||
|
// port.getPortNumber(),
|
||||||
// portType);
|
// portType);
|
||||||
// if (dbInfraOSPort == null) {
|
// if (dbInfraOSPort == null) {
|
||||||
// InfraOSPort infraOSPort = new InfraOSPort();
|
// 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());
|
// InfraHost infraHost = this.infraHostService.readByIp(host.getIpv4());
|
||||||
// if (infraHost != null) {
|
// if (infraHost != null) {
|
||||||
|
|
|
@ -104,6 +104,7 @@ public class CentralTargetService implements TargetService {
|
||||||
return this.targetDAO.findAllByInfraProbeId(probeID, PageUtil.getPageRequest(pageParams));
|
return this.targetDAO.findAllByInfraProbeId(probeID, PageUtil.getPageRequest(pageParams));
|
||||||
// return null;
|
// return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public List<Target> registDiscoveredTargets(Long probeId, List<Host> hosts, List<Service> services)
|
public List<Target> registDiscoveredTargets(Long probeId, List<Host> hosts, List<Service> services)
|
||||||
throws OverflowException {
|
throws OverflowException {
|
||||||
|
@ -121,7 +122,8 @@ public class CentralTargetService implements TargetService {
|
||||||
InfraHost infraHost = this.registInfraHostByDiscoveredHost(host, probeId);
|
InfraHost infraHost = this.registInfraHostByDiscoveredHost(host, probeId);
|
||||||
Target target = new Target();
|
Target target = new Target();
|
||||||
target.setInfra(infraHost);
|
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);
|
target.setDisplayName(displayName);
|
||||||
targets.add(this.targetDAO.save(target));
|
targets.add(this.targetDAO.save(target));
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,13 +34,13 @@ public class ServiceProxy {
|
||||||
ServiceImpl serviceImpl = ctx.getBean(ServiceImpl.class);
|
ServiceImpl serviceImpl = ctx.getBean(ServiceImpl.class);
|
||||||
|
|
||||||
server = NettyServerBuilder.forPort(port)
|
server = NettyServerBuilder.forPort(port)
|
||||||
.addService(ServerInterceptors.intercept(serviceImpl, proxyServerInterceptor))
|
.addService(ServerInterceptors.intercept(serviceImpl, proxyServerInterceptor)).build().start();
|
||||||
.build().start();
|
|
||||||
logger.info("Server started, listening on " + port);
|
logger.info("Server started, listening on " + port);
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread() {
|
Runtime.getRuntime().addShutdownHook(new Thread() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
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");
|
System.err.println("*** shutting down gRPC server since JVM is shutting down");
|
||||||
ServiceProxy.this.stop();
|
ServiceProxy.this.stop();
|
||||||
System.err.println("*** server shut down");
|
System.err.println("*** server shut down");
|
||||||
|
@ -105,4 +105,3 @@ public class ServiceProxy {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ import javax.persistence.EntityManager;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by root on 17. 6. 13.
|
* Created by root on 17. 6. 13.
|
||||||
*/
|
*/
|
||||||
|
@ -69,8 +68,6 @@ public class JdbcConfiguration implements TransactionManagementConfigurer {
|
||||||
return entityManagerFactoryBean;
|
return entityManagerFactoryBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@Qualifier(value = "transactionManager")
|
@Qualifier(value = "transactionManager")
|
||||||
public PlatformTransactionManager annotationDrivenTransactionManager() {
|
public PlatformTransactionManager annotationDrivenTransactionManager() {
|
||||||
|
|
|
@ -57,7 +57,6 @@ public class MailConfiguration {
|
||||||
return javaMailProperties;
|
return javaMailProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public VelocityEngine getVelocityEngine() throws VelocityException, IOException {
|
public VelocityEngine getVelocityEngine() throws VelocityException, IOException {
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
|
|
|
@ -41,7 +41,6 @@ public class RedisConfiguration {
|
||||||
JedisConnectionFactory jedisConFactory = new JedisConnectionFactory(redisStandaloneConfiguration,
|
JedisConnectionFactory jedisConFactory = new JedisConnectionFactory(redisStandaloneConfiguration,
|
||||||
jedisClientConfiguration.build());
|
jedisClientConfiguration.build());
|
||||||
|
|
||||||
|
|
||||||
// JedisConnectionFactory jedisConFactory = new JedisConnectionFactory();
|
// JedisConnectionFactory jedisConFactory = new JedisConnectionFactory();
|
||||||
// jedisConFactory.setHostName(host);
|
// jedisConFactory.setHostName(host);
|
||||||
// jedisConFactory.setPort(port);
|
// jedisConFactory.setPort(port);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user