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"
|
||||||
}
|
}
|
|
@ -6,7 +6,7 @@ import java.io.IOException;
|
||||||
|
|
||||||
public class Central {
|
public class Central {
|
||||||
public static void main(String[] args) throws IOException, InterruptedException {
|
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("Port args");
|
||||||
System.out.println("first parameter is Port Number");
|
System.out.println("first parameter is Port Number");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class GenerateKey {
|
||||||
String[] uuids = generator.generate().toString().split("-");
|
String[] uuids = generator.generate().toString().split("-");
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
|
|
||||||
for ( int idx = 0; idx < uuids.length; idx++ ) {
|
for (int idx = 0; idx < uuids.length; idx++) {
|
||||||
sb.append(uuids[idx]);
|
sb.append(uuids[idx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,15 +10,17 @@ import org.springframework.data.domain.Sort;
|
||||||
*/
|
*/
|
||||||
public class PageUtil {
|
public class PageUtil {
|
||||||
private static Sort.Direction getSortDirection(String sortDirection) {
|
private static Sort.Direction getSortDirection(String sortDirection) {
|
||||||
if(sortDirection.equalsIgnoreCase("ascending")) {
|
if (sortDirection.equalsIgnoreCase("ascending")) {
|
||||||
return Sort.Direction.ASC;
|
return Sort.Direction.ASC;
|
||||||
}
|
}
|
||||||
return Sort.Direction.DESC;
|
return Sort.Direction.DESC;
|
||||||
}
|
}
|
||||||
|
|
||||||
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,14 +33,13 @@ 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];
|
||||||
for (int i = 0; i < MAC_ADDRESS_LENGTH; i++) {
|
for (int i = 0; i < MAC_ADDRESS_LENGTH; i++) {
|
||||||
String element = elements[i];
|
String element = elements[i];
|
||||||
addressInBytes[i] = (byte)Integer.parseInt(element, 16);
|
addressInBytes[i] = (byte) Integer.parseInt(element, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
long mac = 0;
|
long mac = 0;
|
||||||
|
@ -55,7 +49,7 @@ public class StringConvertor {
|
||||||
}
|
}
|
||||||
return mac;
|
return mac;
|
||||||
|
|
||||||
// return new MACAddress(addressInBytes);
|
// return new MACAddress(addressInBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
|
@ -34,14 +30,14 @@ public class CentralApiKeyService implements ApiKeyService {
|
||||||
|
|
||||||
ApiKey retApiKey = this.apiKeyDAO.findByApiKey(apiKey);
|
ApiKey retApiKey = this.apiKeyDAO.findByApiKey(apiKey);
|
||||||
|
|
||||||
if(retApiKey == null) {
|
if (retApiKey == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApiKey readByApiKey(String apiKey) throws OverflowException{
|
public ApiKey readByApiKey(String apiKey) throws OverflowException {
|
||||||
return this.apiKeyDAO.findByApiKey(apiKey);
|
return this.apiKeyDAO.findByApiKey(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,19 +26,17 @@ 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 {
|
||||||
|
|
||||||
if(this.mappingMap == null) {
|
if (this.mappingMap == null) {
|
||||||
this.mappingMap = new HashMap<>();
|
this.mappingMap = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<Integer, MetaSensorItemKey> resultMap = this.mappingMap.get(metaCrawler.getId());
|
Map<Integer, MetaSensorItemKey> resultMap = this.mappingMap.get(metaCrawler.getId());
|
||||||
|
|
||||||
if(resultMap != null) {
|
if (resultMap != null) {
|
||||||
return resultMap;
|
return resultMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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();
|
||||||
|
@ -57,7 +53,7 @@ public class GenerateUtil {
|
||||||
|
|
||||||
String container = "";
|
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.CASSANDRA_CRAWLER.getValue()
|
||||||
|| metaCrawler.getId() == MetaCrawlerEnum.MONGODB_CRAWLER.getValue()
|
|| metaCrawler.getId() == MetaCrawlerEnum.MONGODB_CRAWLER.getValue()
|
||||||
|| metaCrawler.getId() == MetaCrawlerEnum.MSSQL_CRAWLER.getValue()
|
|| metaCrawler.getId() == MetaCrawlerEnum.MSSQL_CRAWLER.getValue()
|
||||||
|
@ -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,18 +70,16 @@ 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<>();
|
||||||
|
|
||||||
MetaSensorItemKey itemKey = null;
|
MetaSensorItemKey itemKey = null;
|
||||||
|
|
||||||
for(SensorItem sItem : sensorItems) {
|
for (SensorItem sItem : sensorItems) {
|
||||||
itemKey = keyMap.get(sItem.getMetaSensorDisplayItem().getId());
|
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.put(itemKey.getFroms(), new ArrayList<>());
|
||||||
}
|
}
|
||||||
metricMap.get(itemKey.getFroms()).add(itemKey);
|
metricMap.get(itemKey.getFroms()).add(itemKey);
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -47,18 +46,17 @@ public class InfraServiceGenerator {
|
||||||
private ObjectMapper objectMapper;
|
private ObjectMapper objectMapper;
|
||||||
|
|
||||||
public String process(Sensor dbSensor, List<SensorItem> sensorItems, Infra infra) throws Exception {
|
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 sensorConfig = new SensorConfig();
|
||||||
sensorConfig.setConfigID(String.valueOf(dbSensor.getId()));
|
sensorConfig.setConfigID(String.valueOf(dbSensor.getId()));
|
||||||
|
|
||||||
Target target = this.createTarget(infraService, dbSensor);
|
Target target = this.createTarget(infraService, dbSensor);
|
||||||
|
|
||||||
if(target == null) {
|
if (target == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sensorConfig.setTarget(target);
|
sensorConfig.setTarget(target);
|
||||||
|
|
||||||
// FIXME: Interval
|
// FIXME: Interval
|
||||||
|
@ -71,7 +69,7 @@ public class InfraServiceGenerator {
|
||||||
|
|
||||||
Map<Integer, MetaSensorItemKey> keyMap = this.generateUtil.initMappingMap(dbSensor.getMetaCrawler());
|
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);
|
this.infraServiceMysqlGenerator.process(sensorItems, keyMap, dbSensor, sensorConfig);
|
||||||
} else if (dbSensor.getMetaCrawler().getId() == MetaCrawlerEnum.JMX_CRAWLER.getValue()) {
|
} else if (dbSensor.getMetaCrawler().getId() == MetaCrawlerEnum.JMX_CRAWLER.getValue()) {
|
||||||
this.infraServiceJMXGenerator.process(sensorItems, keyMap, dbSensor, sensorConfig);
|
this.infraServiceJMXGenerator.process(sensorItems, keyMap, dbSensor, sensorConfig);
|
||||||
|
@ -82,9 +80,10 @@ 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,12 +96,14 @@ 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<>();
|
||||||
|
|
||||||
if(sensor.getMetaCrawler().getId() == MetaCrawlerEnum.MYSQL_CRAWLER.getValue()) {
|
if (sensor.getMetaCrawler().getId() == MetaCrawlerEnum.MYSQL_CRAWLER.getValue()) {
|
||||||
auth.put("url", "jdbc:mysql://"+ infraService.getInfraHost().getIpv4() +":" + infraService.getPort());
|
auth.put("url", "jdbc:mysql://" + infraService.getInfraHost().getIpv4() + ":" + infraService.getPort());
|
||||||
auth.put("id", optionMap.get("ID")); // FIXME: Auth Info
|
auth.put("id", optionMap.get("ID")); // FIXME: Auth Info
|
||||||
auth.put("pw", optionMap.get("PassWord")); // FIXME: Auth Info
|
auth.put("pw", optionMap.get("PassWord")); // FIXME: Auth Info
|
||||||
} else if (sensor.getMetaCrawler().getId() == MetaCrawlerEnum.JMX_CRAWLER.getValue()) {
|
} else if (sensor.getMetaCrawler().getId() == MetaCrawlerEnum.JMX_CRAWLER.getValue()) {
|
||||||
|
|
|
@ -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);
|
||||||
|
@ -42,7 +41,7 @@ public class SensorConfigGenerator {
|
||||||
|
|
||||||
List<SensorItem> sensorItems = dbItemList.getContent();
|
List<SensorItem> sensorItems = dbItemList.getContent();
|
||||||
|
|
||||||
if(sensorItems.size() <= 0) {
|
if (sensorItems.size() <= 0) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
Sensor dbSensor = sensorItems.get(0).getSensor();
|
Sensor dbSensor = sensorItems.get(0).getSensor();
|
||||||
|
@ -50,16 +49,14 @@ public class SensorConfigGenerator {
|
||||||
Infra infra = this.infraService.readByTargetID(dbSensor.getTarget().getId());
|
Infra infra = this.infraService.readByTargetID(dbSensor.getTarget().getId());
|
||||||
|
|
||||||
// 7 = Infra OS Service
|
// 7 = Infra OS Service
|
||||||
if(infra.getMetaInfraType().getId() == 7) {
|
if (infra.getMetaInfraType().getId() == 7) {
|
||||||
return this.infraServiceGenerator.process(dbSensor, sensorItems, infra);
|
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 this.infraHostGenerator.process(dbSensor, sensorItems, infra);
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
|
|
@ -52,20 +52,20 @@ public class CentralMemberService implements MemberService {
|
||||||
public DomainMember signin(String signinId, String signinPw) throws OverflowException {
|
public DomainMember signin(String signinId, String signinPw) throws OverflowException {
|
||||||
Member m = this.memberDAO.findByEmail(signinId);
|
Member m = this.memberDAO.findByEmail(signinId);
|
||||||
|
|
||||||
if ( null == m ) {
|
if (null == m) {
|
||||||
throw new OverflowException("SignInIdNotExistException()", new Throwable());
|
throw new OverflowException("SignInIdNotExistException()", new Throwable());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m.getMetaMemberStatus().getId() == 1 ) {
|
if (m.getMetaMemberStatus().getId() == 1) {
|
||||||
throw new OverflowException("EmailNotConfirmedException()", new Throwable());
|
throw new OverflowException("EmailNotConfirmedException()", new Throwable());
|
||||||
}
|
}
|
||||||
|
|
||||||
Boolean match = passwordEncoder.matches(signinPw, m.getPw());
|
Boolean match = passwordEncoder.matches(signinPw, m.getPw());
|
||||||
if(!match) {
|
if (!match) {
|
||||||
if (m.getSigninFailCount() > 10) {
|
if (m.getSigninFailCount() > 10) {
|
||||||
throw new OverflowException("SigninOverFailedException()", new Throwable());
|
throw new OverflowException("SigninOverFailedException()", new Throwable());
|
||||||
}
|
}
|
||||||
m.setSigninFailCount(m.getSigninFailCount()+1);
|
m.setSigninFailCount(m.getSigninFailCount() + 1);
|
||||||
this.modify(m);
|
this.modify(m);
|
||||||
throw new OverflowException("SignInPwNotMatchException()", new Throwable());
|
throw new OverflowException("SignInPwNotMatchException()", new Throwable());
|
||||||
}
|
}
|
||||||
|
@ -91,10 +91,10 @@ public class CentralMemberService implements MemberService {
|
||||||
|
|
||||||
if (!checkPass) {
|
if (!checkPass) {
|
||||||
throw new OverflowException("PasswordNotStrongException()", new Throwable());
|
throw new OverflowException("PasswordNotStrongException()", new Throwable());
|
||||||
// (
|
// (
|
||||||
// "Passwords must contain at least one uppercase letter, " +
|
// "Passwords must contain at least one uppercase letter, " +
|
||||||
// "special character, lowercase letter, and number, " +
|
// "special character, lowercase letter, and number, " +
|
||||||
// "and must be at least 6 characters long.");
|
// "and must be at least 6 characters long.");
|
||||||
}
|
}
|
||||||
member.setPw(passwordEncoder.encode(pw));
|
member.setPw(passwordEncoder.encode(pw));
|
||||||
|
|
||||||
|
@ -138,11 +138,11 @@ public class CentralMemberService implements MemberService {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
deStr = URLDecoder.decode(token, "UTF-8");
|
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);
|
EmailAuth auth = this.emailAuthService.readByToken(deStr);
|
||||||
|
|
||||||
if (auth == null) {
|
if (auth == null) {
|
||||||
|
@ -159,9 +159,9 @@ public class CentralMemberService implements MemberService {
|
||||||
|
|
||||||
if (!checkPass) {
|
if (!checkPass) {
|
||||||
throw new OverflowException("PasswordNotStrongException()", new Throwable());
|
throw new OverflowException("PasswordNotStrongException()", new Throwable());
|
||||||
// "Passwords must contain at least one uppercase letter, " +
|
// "Passwords must contain at least one uppercase letter, " +
|
||||||
// "special character, lowercase letter, and number, " +
|
// "special character, lowercase letter, and number, " +
|
||||||
// "and must be at least 6 characters long.");
|
// "and must be at least 6 characters long.");
|
||||||
}
|
}
|
||||||
member.setPw(passwordEncoder.encode(pw));
|
member.setPw(passwordEncoder.encode(pw));
|
||||||
|
|
||||||
|
@ -186,13 +186,13 @@ public class CentralMemberService implements MemberService {
|
||||||
|
|
||||||
if (!checkPass) {
|
if (!checkPass) {
|
||||||
throw new OverflowException("PasswordNotStrongException()", new Throwable());
|
throw new OverflowException("PasswordNotStrongException()", new Throwable());
|
||||||
// "Passwords must contain at least one uppercase letter, " +
|
// "Passwords must contain at least one uppercase letter, " +
|
||||||
// "special character, lowercase letter, and number, " +
|
// "special character, lowercase letter, and number, " +
|
||||||
// "and must be at least 6 characters long.");
|
// "and must be at least 6 characters long.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Boolean match = passwordEncoder.matches(member.getPw(), preMember.getPw());
|
Boolean match = passwordEncoder.matches(member.getPw(), preMember.getPw());
|
||||||
if(!match) {
|
if (!match) {
|
||||||
member.setPw(passwordEncoder.encode(pw));
|
member.setPw(passwordEncoder.encode(pw));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -255,7 +255,7 @@ public class CentralMemberService implements MemberService {
|
||||||
|
|
||||||
Probe probe = this.probeService.readByProbeKey(probeKey);
|
Probe probe = this.probeService.readByProbeKey(probeKey);
|
||||||
|
|
||||||
if(probe == null) {
|
if (probe == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,7 +266,7 @@ public class CentralMemberService implements MemberService {
|
||||||
|
|
||||||
ApiKey apiKey = this.apiKeyService.readByApiKey(apikey);
|
ApiKey apiKey = this.apiKeyService.readByApiKey(apikey);
|
||||||
|
|
||||||
if(apiKey == null) {
|
if (apiKey == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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> {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,5 +8,5 @@ import org.springframework.stereotype.Repository;
|
||||||
* Created by insanity on 17. 6. 23.
|
* Created by insanity on 17. 6. 23.
|
||||||
*/
|
*/
|
||||||
@Repository
|
@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.
|
* Created by insanity on 17. 6. 23.
|
||||||
*/
|
*/
|
||||||
@Repository
|
@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> {
|
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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,5 +8,5 @@ import org.springframework.stereotype.Repository;
|
||||||
* Created by insanity on 17. 6. 23.
|
* Created by insanity on 17. 6. 23.
|
||||||
*/
|
*/
|
||||||
@Repository
|
@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.
|
* Created by insanity on 17. 6. 23.
|
||||||
*/
|
*/
|
||||||
@Repository
|
@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.
|
* Created by insanity on 17. 6. 23.
|
||||||
*/
|
*/
|
||||||
@Repository
|
@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.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;
|
||||||
|
|
|
@ -28,6 +28,6 @@ public class CentralMetaHistoryTypeService implements MetaHistoryTypeService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MetaHistoryType> registAll(List<MetaHistoryType> metaHistoryTypes) throws OverflowException {
|
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.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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,6 @@ public class CentralMetaSensorItemTypeService implements MetaSensorItemTypeServi
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MetaSensorItemType> registAll(List<MetaSensorItemType> list) throws OverflowException {
|
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.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;
|
||||||
|
|
|
@ -17,12 +17,15 @@ public interface NoAuthProbeDAO extends JpaRepository<NoAuthProbe, Long> {
|
||||||
|
|
||||||
List<NoAuthProbe> findAllByDomainIdAndMetaNoAuthProbeStatusId(Long domainID, Short metaNoAuthProbeStatusId);
|
List<NoAuthProbe> findAllByDomainIdAndMetaNoAuthProbeStatusId(Long domainID, Short metaNoAuthProbeStatusId);
|
||||||
|
|
||||||
// NoAuthProbeDeprecate findByTempKey(NoAuthProbeDeprecate noAuthAgent);
|
// NoAuthProbeDeprecate findByTempKey(NoAuthProbeDeprecate noAuthAgent);
|
||||||
// List<NoAuthProbeDeprecate> findAllByNoAuth(NoAuthProbeDeprecate noAuthAgent);
|
// List<NoAuthProbeDeprecate> findAllByNoAuth(NoAuthProbeDeprecate noAuthAgent);
|
||||||
// @Query("SELECT n FROM NoAuthProbe n WHERE n.tempProbeKey = :tempProbeKey")
|
// @Query("SELECT n FROM NoAuthProbe n WHERE n.tempProbeKey = :tempProbeKey")
|
||||||
// @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);
|
||||||
}
|
}
|
|
@ -28,7 +28,7 @@ public class CentralProbeService implements ProbeService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Probe> regist(List<Probe> probes) throws OverflowException {
|
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 {
|
public List<Probe> readAllByDomainID(Long domainID) throws OverflowException {
|
||||||
|
|
|
@ -14,7 +14,7 @@ import java.util.List;
|
||||||
* Created by snoop on 17. 6. 28.
|
* Created by snoop on 17. 6. 28.
|
||||||
*/
|
*/
|
||||||
@Service("ProbeTaskService")
|
@Service("ProbeTaskService")
|
||||||
public class CentralProbeTaskService implements ProbeTaskService{
|
public class CentralProbeTaskService implements ProbeTaskService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProbeTaskDAO probeTaskDAO;
|
private ProbeTaskDAO probeTaskDAO;
|
||||||
|
|
|
@ -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));
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,9 @@ import org.springframework.stereotype.Repository;
|
||||||
public interface TargetDAO extends JpaRepository<Target, Long> {
|
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) {
|
||||||
|
|
|
@ -102,8 +102,9 @@ public class CentralTargetService implements TargetService {
|
||||||
|
|
||||||
public Page<Target> readAllByProbeID(Long probeID, PageParams pageParams) throws OverflowException {
|
public Page<Target> readAllByProbeID(Long probeID, PageParams pageParams) throws OverflowException {
|
||||||
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 {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class CacheConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public CacheManager cacheManager() {
|
public CacheManager cacheManager() {
|
||||||
//A EhCache based Cache manager
|
// A EhCache based Cache manager
|
||||||
CaffeineCacheManager cacheManager = new CaffeineCacheManager(cacheNames);
|
CaffeineCacheManager cacheManager = new CaffeineCacheManager(cacheNames);
|
||||||
cacheManager.setAllowNullValues(false);
|
cacheManager.setAllowNullValues(false);
|
||||||
cacheManager.setCacheSpecification(spec);
|
cacheManager.setCacheSpecification(spec);
|
||||||
|
|
|
@ -21,13 +21,12 @@ 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.
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
@EnableJpaRepositories(basePackages = {"com.loafle.overflow"})
|
@EnableJpaRepositories(basePackages = { "com.loafle.overflow" })
|
||||||
public class JdbcConfiguration implements TransactionManagementConfigurer {
|
public class JdbcConfiguration implements TransactionManagementConfigurer {
|
||||||
@Value("${datasource.driver-class-name}")
|
@Value("${datasource.driver-class-name}")
|
||||||
private String driver;
|
private String driver;
|
||||||
|
@ -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);
|
||||||
|
@ -64,7 +63,7 @@ public class RedisConfiguration {
|
||||||
@Bean
|
@Bean
|
||||||
Map<String, ChannelTopic> topics() {
|
Map<String, ChannelTopic> topics() {
|
||||||
Map<String, ChannelTopic> topicMap = new HashMap<>(this.channels.size());
|
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));
|
topicMap.put(channel, new ChannelTopic(channel));
|
||||||
}
|
}
|
||||||
return topicMap;
|
return topicMap;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user