fixed service
This commit is contained in:
parent
82cc1617ea
commit
afa93db77e
|
@ -1,7 +1,8 @@
|
|||
package com.loafle.overflow.central.module.apikey.dao;
|
||||
|
||||
import com.loafle.overflow.central.module.apikey.model.ApiKey;
|
||||
|
||||
import com.loafle.overflow.central.module.domain.model.Domain;
|
||||
import com.loafle.overflow.model.apikey.ApiKey;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
|
|
@ -1,81 +0,0 @@
|
|||
package com.loafle.overflow.central.module.apikey.model;
|
||||
|
||||
import com.loafle.overflow.central.module.domain.model.Domain;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by root on 17. 6. 22.
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "API_KEY", schema = "public")
|
||||
public class ApiKey {
|
||||
private long id;
|
||||
private String apiKey;
|
||||
private Date createDate;
|
||||
private Domain domain;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "API_KEY", nullable = false, unique = true,length = 50)
|
||||
public String getApiKey() {
|
||||
return apiKey;
|
||||
}
|
||||
|
||||
public void setApiKey(String apiKey) {
|
||||
this.apiKey = apiKey;
|
||||
}
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name="CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
|
||||
public Date getCreateDate() {
|
||||
return createDate;
|
||||
}
|
||||
|
||||
public void setCreateDate(Date createDate) {
|
||||
this.createDate = createDate;
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "DOMAIN_ID", nullable=false)
|
||||
public Domain getDomain() {
|
||||
return domain;
|
||||
}
|
||||
|
||||
public void setDomain(Domain domain) {
|
||||
this.domain = domain;
|
||||
}
|
||||
//
|
||||
// @Override
|
||||
// public boolean equals(Object o) {
|
||||
// if (this == o) return true;
|
||||
// if (o == null || getClass() != o.getClass()) return false;
|
||||
//
|
||||
// TblApiKey tblApiKey = (TblApiKey) o;
|
||||
//
|
||||
// if (id != tblApiKey.id) return false;
|
||||
// if (domainId != tblApiKey.domainId) return false;
|
||||
// if (apiKey != null ? !apiKey.equals(tblApiKey.apiKey) : tblApiKey.apiKey != null) return false;
|
||||
// if (createDate != null ? !createDate.equals(tblApiKey.createDate) : tblApiKey.createDate != null) return false;
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int hashCode() {
|
||||
// int result = (int) (id ^ (id >>> 32));
|
||||
// result = 31 * result + (apiKey != null ? apiKey.hashCode() : 0);
|
||||
// result = 31 * result + (createDate != null ? createDate.hashCode() : 0);
|
||||
// result = 31 * result + (int) (domainId ^ (domainId >>> 32));
|
||||
// return result;
|
||||
// }
|
||||
}
|
|
@ -1,8 +1,11 @@
|
|||
package com.loafle.overflow.central.module.apikey.service;
|
||||
|
||||
import com.loafle.overflow.central.commons.exception.OverflowException;
|
||||
import com.loafle.overflow.central.module.apikey.dao.ApiKeyDAO;
|
||||
import com.loafle.overflow.central.module.apikey.model.ApiKey;
|
||||
|
||||
import com.loafle.overflow.central.module.domain.model.Domain;
|
||||
import com.loafle.overflow.model.apikey.ApiKey;
|
||||
import com.loafle.overflow.service.central.apikey.ApiKeyService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -10,23 +13,23 @@ import org.springframework.stereotype.Service;
|
|||
* Created by snoop on 17. 6. 28.
|
||||
*/
|
||||
@Service("ApiKeyService")
|
||||
public class ApiKeyService {
|
||||
public class CentralApiKeyService implements ApiKeyService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private ApiKeyDAO apiKeyDAO;
|
||||
|
||||
|
||||
public ApiKey regist(ApiKey apiKey) {
|
||||
public ApiKey regist(ApiKey apiKey) throws OverflowException {
|
||||
|
||||
return this.apiKeyDAO.save(apiKey);
|
||||
}
|
||||
|
||||
public ApiKey readByDomain(Domain domain) {
|
||||
public ApiKey readByDomain(Domain domain) throws OverflowException {
|
||||
return this.apiKeyDAO.findByDomain(domain);
|
||||
}
|
||||
|
||||
public boolean check(String apiKey) {
|
||||
public boolean check(String apiKey) throws OverflowException {
|
||||
|
||||
ApiKey retApiKey = this.apiKeyDAO.findByApiKey(apiKey);
|
||||
|
||||
|
@ -37,7 +40,7 @@ public class ApiKeyService {
|
|||
return true;
|
||||
}
|
||||
|
||||
public ApiKey readByApiKey(String apiKey) {
|
||||
public ApiKey readByApiKey(String apiKey) throws OverflowException{
|
||||
return this.apiKeyDAO.findByApiKey(apiKey);
|
||||
}
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
package com.loafle.overflow.central.module.auth.dao;
|
||||
|
||||
import com.loafle.overflow.central.module.auth.model.AuthCrawler;
|
||||
|
||||
import com.loafle.overflow.central.module.meta.model.MetaCrawler;
|
||||
import com.loafle.overflow.central.module.target.model.Target;
|
||||
import com.loafle.overflow.model.auth.AuthCrawler;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
package com.loafle.overflow.central.module.auth.model;
|
||||
|
||||
import com.loafle.overflow.central.module.meta.model.MetaCrawler;
|
||||
import com.loafle.overflow.central.module.target.model.Target;
|
||||
import org.hibernate.annotations.OnDelete;
|
||||
import org.hibernate.annotations.OnDeleteAction;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by snoop on 17. 8. 30.
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "AUTH_CRAWLER", schema = "public")
|
||||
public class AuthCrawler {
|
||||
private long id;
|
||||
private MetaCrawler crawler;
|
||||
private Target target;
|
||||
private String authJson;
|
||||
private Date createDate;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "CRAWLER_ID", nullable = false)
|
||||
public MetaCrawler getCrawler() {
|
||||
return crawler;
|
||||
}
|
||||
|
||||
public void setCrawler(MetaCrawler crawler) {
|
||||
this.crawler = crawler;
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
@OnDelete(action = OnDeleteAction.CASCADE)
|
||||
@JoinColumn(name = "TARGET_ID", nullable = false)
|
||||
public Target getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
public void setTarget(Target target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@Column(name = "AUTH_JSON", nullable = false)
|
||||
public String getAuthJson() {
|
||||
return authJson;
|
||||
}
|
||||
|
||||
public void setAuthJson(String authJson) {
|
||||
this.authJson = authJson;
|
||||
}
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
|
||||
public Date getCreateDate() {
|
||||
return createDate;
|
||||
}
|
||||
|
||||
public void setCreateDate(Date createDate) {
|
||||
this.createDate = createDate;
|
||||
}
|
||||
}
|
|
@ -1,11 +1,14 @@
|
|||
package com.loafle.overflow.central.module.auth.service;
|
||||
|
||||
import com.loafle.overflow.central.commons.exception.OverflowException;
|
||||
import com.loafle.overflow.central.module.auth.dao.AuthCrawlerDAO;
|
||||
import com.loafle.overflow.central.module.auth.model.AuthCrawler;
|
||||
|
||||
import com.loafle.overflow.central.module.infra.model.Infra;
|
||||
import com.loafle.overflow.central.module.infra.service.InfraService;
|
||||
import com.loafle.overflow.central.module.meta.model.MetaCrawler;
|
||||
import com.loafle.overflow.central.module.target.model.Target;
|
||||
import com.loafle.overflow.model.auth.AuthCrawler;
|
||||
import com.loafle.overflow.service.central.auth.AuthCrawlerService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -13,7 +16,7 @@ import org.springframework.stereotype.Service;
|
|||
* Created by snoop on 17. 8. 30.
|
||||
*/
|
||||
@Service("AuthCrawlerService")
|
||||
public class AuthCrawlerService {
|
||||
public class CentralAuthCrawlerService implements AuthCrawlerService {
|
||||
|
||||
@Autowired
|
||||
private AuthCrawlerDAO authCrawlerDAO;
|
||||
|
@ -36,7 +39,7 @@ public class AuthCrawlerService {
|
|||
return this.authCrawlerDAO.save(dbAuthCrawler);
|
||||
}
|
||||
|
||||
public boolean checkAuthCrawler(long infraId, MetaCrawler crawler, String authJson) {
|
||||
public boolean checkAuthCrawler(long infraId, MetaCrawler crawler, String authJson) throws OverflowException {
|
||||
|
||||
Infra infra = this.infraService.read(infraId);
|
||||
|
||||
|
@ -45,7 +48,7 @@ public class AuthCrawlerService {
|
|||
return false;
|
||||
}
|
||||
|
||||
public AuthCrawler readAuth(MetaCrawler metaCrawler, Target target) {
|
||||
public AuthCrawler readAuth(MetaCrawler metaCrawler, Target target) throws OverflowException {
|
||||
|
||||
return this.authCrawlerDAO.findByCrawlerAndTarget(metaCrawler, target);
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
package com.loafle.overflow.central.module.discovery.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DiscoveryHost {
|
||||
private String firstScanRange;
|
||||
private String lastScanRange;
|
||||
private List<String> excludeHosts;
|
||||
private List<String> includeHosts;
|
||||
|
||||
private DiscoveryPort discoveryPort;
|
||||
|
||||
public String getFirstScanRange() {
|
||||
return firstScanRange;
|
||||
}
|
||||
|
||||
public void setFirstScanRange(String firstScanRange) {
|
||||
this.firstScanRange = firstScanRange;
|
||||
}
|
||||
|
||||
public String getLastScanRange() {
|
||||
return lastScanRange;
|
||||
}
|
||||
|
||||
public void setLastScanRange(String lastScanRange) {
|
||||
this.lastScanRange = lastScanRange;
|
||||
}
|
||||
|
||||
public List<String> getExcludeHosts() {
|
||||
return excludeHosts;
|
||||
}
|
||||
|
||||
public void setExcludeHosts(List<String> excludeHosts) {
|
||||
this.excludeHosts = excludeHosts;
|
||||
}
|
||||
|
||||
public List<String> getIncludeHosts() {
|
||||
return includeHosts;
|
||||
}
|
||||
|
||||
public void setIncludeHosts(List<String> includeHosts) {
|
||||
this.includeHosts = includeHosts;
|
||||
}
|
||||
|
||||
public DiscoveryPort getDiscoveryPort() {
|
||||
return discoveryPort;
|
||||
}
|
||||
|
||||
public void setDiscoveryPort(DiscoveryPort discoveryPort) {
|
||||
this.discoveryPort = discoveryPort;
|
||||
}
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
package com.loafle.overflow.central.module.discovery.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DiscoveryPort {
|
||||
private int firstScanRange;
|
||||
private int lastScanRange;
|
||||
private List<Integer> excludePorts;
|
||||
private boolean includeTCP;
|
||||
private boolean includeUDP;
|
||||
|
||||
private DiscoveryService discoveryService;
|
||||
|
||||
public int getFirstScanRange() {
|
||||
return firstScanRange;
|
||||
}
|
||||
|
||||
public void setFirstScanRange(int firstScanRange) {
|
||||
this.firstScanRange = firstScanRange;
|
||||
}
|
||||
|
||||
public int getLastScanRange() {
|
||||
return lastScanRange;
|
||||
}
|
||||
|
||||
public void setLastScanRange(int lastScanRange) {
|
||||
this.lastScanRange = lastScanRange;
|
||||
}
|
||||
|
||||
public List<Integer> getExcludePorts() {
|
||||
return excludePorts;
|
||||
}
|
||||
|
||||
public void setExcludePorts(List<Integer> excludePorts) {
|
||||
this.excludePorts = excludePorts;
|
||||
}
|
||||
|
||||
public boolean isIncludeTCP() {
|
||||
return includeTCP;
|
||||
}
|
||||
|
||||
public void setIncludeTCP(boolean includeTCP) {
|
||||
this.includeTCP = includeTCP;
|
||||
}
|
||||
|
||||
public boolean isIncludeUDP() {
|
||||
return includeUDP;
|
||||
}
|
||||
|
||||
public void setIncludeUDP(boolean includeUDP) {
|
||||
this.includeUDP = includeUDP;
|
||||
}
|
||||
|
||||
public DiscoveryService getDiscoveryService() {
|
||||
return discoveryService;
|
||||
}
|
||||
|
||||
public void setDiscoveryService(DiscoveryService discoveryService) {
|
||||
this.discoveryService = discoveryService;
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
package com.loafle.overflow.central.module.discovery.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DiscoveryService {
|
||||
private List<String> includeServices;
|
||||
|
||||
public List<String> getIncludeServices() {
|
||||
return includeServices;
|
||||
}
|
||||
|
||||
public void setIncludeServices(List<String> includeServices) {
|
||||
this.includeServices = includeServices;
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
package com.loafle.overflow.central.module.discovery.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DiscoveryZone {
|
||||
private List<String> excludePatterns;
|
||||
|
||||
private DiscoveryHost discoveryHost;
|
||||
|
||||
public List<String> getExcludePatterns() {
|
||||
return excludePatterns;
|
||||
}
|
||||
|
||||
public void setExcludePatterns(List<String> excludePatterns) {
|
||||
this.excludePatterns = excludePatterns;
|
||||
}
|
||||
|
||||
public DiscoveryHost getDiscoveryHost() {
|
||||
return discoveryHost;
|
||||
}
|
||||
|
||||
public void setDiscoveryHost(DiscoveryHost discoveryHost) {
|
||||
this.discoveryHost = discoveryHost;
|
||||
}
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
package com.loafle.overflow.central.module.discovery.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by root on 17. 6. 4.
|
||||
*/
|
||||
|
||||
public class Host {
|
||||
private long id;
|
||||
private String ip;
|
||||
private String mac;
|
||||
private String os;
|
||||
private Date discoveredDate;
|
||||
|
||||
private Zone zone;
|
||||
|
||||
public Host(){}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
public String getMac() {
|
||||
return mac;
|
||||
}
|
||||
|
||||
public void setMac(String mac) {
|
||||
this.mac = mac;
|
||||
}
|
||||
|
||||
public String getOs() {
|
||||
return os;
|
||||
}
|
||||
|
||||
public void setOs(String os) {
|
||||
this.os = os;
|
||||
}
|
||||
|
||||
public Date getDiscoveredDate() {
|
||||
return discoveredDate;
|
||||
}
|
||||
|
||||
public void setDiscoveredDate(Date discoveredDate) {
|
||||
this.discoveredDate = discoveredDate;
|
||||
}
|
||||
|
||||
public Zone getZone() {
|
||||
return zone;
|
||||
}
|
||||
|
||||
public void setZone(Zone zone) {
|
||||
this.zone = zone;
|
||||
}
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
package com.loafle.overflow.central.module.discovery.model;
|
||||
|
||||
/**
|
||||
* Created by snoop on 17. 6. 27.
|
||||
*/
|
||||
|
||||
|
||||
import com.loafle.overflow.central.module.discovery.type.PortType;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by root on 17. 6. 4.
|
||||
*/
|
||||
|
||||
public class Port {
|
||||
|
||||
|
||||
private long id;
|
||||
private PortType portType;
|
||||
private int portNumber;
|
||||
private Date discoveredDate;
|
||||
|
||||
private Host host;
|
||||
|
||||
public Port() {}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public PortType getPortType() {
|
||||
return portType;
|
||||
}
|
||||
|
||||
public void setPortType(PortType portType) {
|
||||
this.portType = portType;
|
||||
}
|
||||
|
||||
public int getPortNumber() {
|
||||
return portNumber;
|
||||
}
|
||||
|
||||
public void setPortNumber(int portNumber) {
|
||||
this.portNumber = portNumber;
|
||||
}
|
||||
|
||||
public Date getDiscoveredDate() {
|
||||
return discoveredDate;
|
||||
}
|
||||
|
||||
public void setDiscoveredDate(Date discoveredDate) {
|
||||
this.discoveredDate = discoveredDate;
|
||||
}
|
||||
|
||||
public Host getHost() {
|
||||
return host;
|
||||
}
|
||||
|
||||
public void setHost(Host host) {
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
package com.loafle.overflow.central.module.discovery.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by root on 17. 6. 4.
|
||||
*/
|
||||
|
||||
public class Service {
|
||||
private long id;
|
||||
private String cryptoType;
|
||||
private String serviceName;
|
||||
private Date discoveredDate;
|
||||
|
||||
private Port port;
|
||||
|
||||
public Service() {}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getCryptoType() {
|
||||
return cryptoType;
|
||||
}
|
||||
|
||||
public void setCryptoType(String cryptoType) {
|
||||
this.cryptoType = cryptoType;
|
||||
}
|
||||
|
||||
public String getServiceName() {
|
||||
return serviceName;
|
||||
}
|
||||
|
||||
public void setServiceName(String serviceName) {
|
||||
this.serviceName = serviceName;
|
||||
}
|
||||
|
||||
public Date getDiscoveredDate() {
|
||||
return discoveredDate;
|
||||
}
|
||||
|
||||
public void setDiscoveredDate(Date discoveredDate) {
|
||||
this.discoveredDate = discoveredDate;
|
||||
}
|
||||
|
||||
public Port getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setPort(Port port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
package com.loafle.overflow.central.module.discovery.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by snoop on 17. 10. 31.
|
||||
*/
|
||||
public class Zone {
|
||||
private long id;
|
||||
private String network;
|
||||
private String ip;
|
||||
private String iface;
|
||||
private String mac;
|
||||
private Date discoveredDate;
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getNetwork() {
|
||||
return network;
|
||||
}
|
||||
|
||||
public void setNetwork(String network) {
|
||||
this.network = network;
|
||||
}
|
||||
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
public String getIface() {
|
||||
return iface;
|
||||
}
|
||||
|
||||
public void setIface(String iface) {
|
||||
this.iface = iface;
|
||||
}
|
||||
|
||||
public String getMac() {
|
||||
return mac;
|
||||
}
|
||||
|
||||
public void setMac(String mac) {
|
||||
this.mac = mac;
|
||||
}
|
||||
|
||||
public Date getDiscoveredDate() {
|
||||
return discoveredDate;
|
||||
}
|
||||
|
||||
public void setDiscoveredDate(Date discoveredDate) {
|
||||
this.discoveredDate = discoveredDate;
|
||||
}
|
||||
}
|
|
@ -1,16 +1,16 @@
|
|||
package com.loafle.overflow.central.module.discovery.service;
|
||||
|
||||
|
||||
|
||||
import com.loafle.overflow.central.commons.model.SessionMetadata;
|
||||
import com.loafle.overflow.central.commons.service.MessagePublisher;
|
||||
import com.loafle.overflow.central.commons.stereotype.ProbeAPI;
|
||||
import com.loafle.overflow.central.commons.stereotype.WebappAPI;
|
||||
import com.loafle.overflow.central.module.discovery.model.DiscoveryHost;
|
||||
import com.loafle.overflow.central.module.discovery.model.DiscoveryPort;
|
||||
import com.loafle.overflow.central.module.discovery.model.DiscoveryStartInfo;
|
||||
import com.loafle.overflow.central.module.discovery.model.DiscoveryZone;
|
||||
import com.loafle.overflow.central.module.discovery.model.Host;
|
||||
import com.loafle.overflow.central.module.discovery.model.Port;
|
||||
import com.loafle.overflow.central.module.discovery.model.Zone;
|
||||
import com.loafle.overflow.core.annotation.ProbeAPI;
|
||||
import com.loafle.overflow.core.annotation.WebappAPI;
|
||||
import com.loafle.overflow.core.exception.OverflowException;
|
||||
import com.loafle.overflow.model.discovery.*;
|
||||
|
||||
import com.loafle.overflow.service.central.discovery.DiscoveryService;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -22,12 +22,12 @@ import java.util.Date;
|
|||
* Created by snoop on 17. 9. 28.
|
||||
*/
|
||||
@Service("DiscoveryService")
|
||||
public class DiscoveryService {
|
||||
public class CentralDiscoveryService implements DiscoveryService {
|
||||
|
||||
@Autowired
|
||||
private MessagePublisher messagePublisher;
|
||||
|
||||
public void startDiscovery(DiscoveryStartInfo startInfo) throws IOException {
|
||||
public void startDiscovery(DiscoveryStartInfo startInfo) throws OverflowException,IOException {
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
|
@ -61,40 +61,40 @@ public class DiscoveryService {
|
|||
// }
|
||||
|
||||
@WebappAPI
|
||||
public void discoverZone(String probeID, DiscoveryZone discoveryZone) {
|
||||
public void discoverZone(String probeID, DiscoverZone discoveryZone) {
|
||||
String requesterSessionID = SessionMetadata.getSessionID();
|
||||
|
||||
messagePublisher.publishToProbe(probeID, "DiscoveryService.DiscoverZone", requesterSessionID, discoveryZone);
|
||||
}
|
||||
|
||||
@WebappAPI
|
||||
public void discoverHost(String probeID, Zone zone, DiscoveryHost discoveryHost) {
|
||||
public void discoverHost(String probeID, Zone zone, DiscoverHost discoveryHost) {
|
||||
String requesterSessionID = SessionMetadata.getSessionID();
|
||||
|
||||
messagePublisher.publishToProbe(probeID, "DiscoveryService.DiscoverHost", requesterSessionID, zone, discoveryHost);
|
||||
}
|
||||
|
||||
@WebappAPI
|
||||
public void discoverPort(String probeID, Host host, DiscoveryPort discoveryPort) {
|
||||
public void discoverPort(String probeID, Host host, DiscoverPort discoveryPort) {
|
||||
String requesterSessionID = SessionMetadata.getSessionID();
|
||||
|
||||
messagePublisher.publishToProbe(probeID, "DiscoveryService.DiscoverPort", requesterSessionID, host, discoveryPort);
|
||||
}
|
||||
|
||||
@WebappAPI
|
||||
public void discoverService(String probeID, Port port, com.loafle.overflow.central.module.discovery.model.DiscoveryService discoveryService) {
|
||||
public void discoverService(String probeID, Port port, com.loafle.overflow.model.discovery.DiscoverService discoveryService) {
|
||||
String requesterSessionID = SessionMetadata.getSessionID();
|
||||
|
||||
messagePublisher.publishToProbe(probeID, "DiscoveryService.DiscoverService", requesterSessionID, port, discoveryService);
|
||||
}
|
||||
|
||||
@ProbeAPI
|
||||
public void discoveryStart(String requesterSessionID, Date startDate) {
|
||||
public void discoverStart(String requesterSessionID, Date startDate) {
|
||||
messagePublisher.publishToMemberSession(requesterSessionID, "DiscoveryService.discoveryStart", startDate);
|
||||
}
|
||||
|
||||
@ProbeAPI
|
||||
public void discoveryStop(String requesterSessionID, Date stopDate) {
|
||||
public void discoverStop(String requesterSessionID, Date stopDate) {
|
||||
messagePublisher.publishToMemberSession(requesterSessionID, "DiscoveryService.discoveryStop", stopDate);
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ public class DiscoveryService {
|
|||
}
|
||||
|
||||
@ProbeAPI
|
||||
public void discoveredService(String requesterSessionID, com.loafle.overflow.central.module.discovery.model.Service service) {
|
||||
public void discoveredService(String requesterSessionID, com.loafle.overflow.model.discovery.Service service) {
|
||||
messagePublisher.publishToMemberSession(requesterSessionID, "DiscoveryService.discoveredService", service);
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.loafle.overflow.central.module.domain.dao;
|
||||
|
||||
import com.loafle.overflow.central.module.domain.model.Domain;
|
||||
|
||||
import com.loafle.overflow.model.domain.Domain;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package com.loafle.overflow.central.module.domain.dao;
|
||||
|
||||
import com.loafle.overflow.central.module.domain.model.Domain;
|
||||
import com.loafle.overflow.central.module.domain.model.DomainMember;
|
||||
|
||||
import com.loafle.overflow.central.module.member.model.Member;
|
||||
import com.loafle.overflow.model.domain.Domain;
|
||||
import com.loafle.overflow.model.domain.DomainMember;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
package com.loafle.overflow.central.module.domain.model;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by root on 17. 6. 22.
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "DOMAIN", schema = "public")
|
||||
public class Domain {
|
||||
private long id;
|
||||
private String name;
|
||||
private Date createDate;
|
||||
|
||||
public Domain() {
|
||||
}
|
||||
public Domain(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Basic
|
||||
@Column(name = "NAME", nullable = true, length = 50)
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
@Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
|
||||
public Date getCreateDate() {
|
||||
return createDate;
|
||||
}
|
||||
|
||||
public void setCreateDate(Date createDate) {
|
||||
this.createDate = createDate;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
package com.loafle.overflow.central.module.domain.model;
|
||||
|
||||
import com.loafle.overflow.central.module.member.model.Member;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
/**
|
||||
* Created by root on 17. 6. 22.
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "DOMAIN_MEMBER", schema = "public")
|
||||
public class DomainMember {
|
||||
private long id;
|
||||
private Timestamp createDate;
|
||||
private Member member;
|
||||
private Domain domain;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Basic
|
||||
@Column(name = "CREATE_DATE", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP", insertable = false, updatable = false)
|
||||
public Timestamp getCreateDate() {
|
||||
return createDate;
|
||||
}
|
||||
|
||||
public void setCreateDate(Timestamp createDate) {
|
||||
this.createDate = createDate;
|
||||
}
|
||||
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "MEMBER_ID", nullable = false)
|
||||
public Member getMember() {
|
||||
return member;
|
||||
}
|
||||
|
||||
public void setMember(Member member) {
|
||||
this.member = member;
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "DOMAIN_ID", nullable = false)
|
||||
public Domain getDomain() {
|
||||
return domain;
|
||||
}
|
||||
|
||||
public void setDomain(Domain domain) {
|
||||
this.domain = domain;
|
||||
}
|
||||
}
|
|
@ -1,10 +1,12 @@
|
|||
package com.loafle.overflow.central.module.domain.service;
|
||||
|
||||
import com.loafle.overflow.central.module.domain.dao.DomainMemberDAO;
|
||||
import com.loafle.overflow.central.module.domain.model.Domain;
|
||||
import com.loafle.overflow.central.module.domain.model.DomainMember;
|
||||
|
||||
import com.loafle.overflow.central.module.member.dao.MemberDAO;
|
||||
import com.loafle.overflow.central.module.member.model.Member;
|
||||
import com.loafle.overflow.model.domain.Domain;
|
||||
import com.loafle.overflow.model.domain.DomainMember;
|
||||
import com.loafle.overflow.service.central.domain.DomainMemberService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -14,7 +16,7 @@ import java.util.List;
|
|||
* Created by snoop on 17. 6. 28.
|
||||
*/
|
||||
@Service("DomainMemberService")
|
||||
public class DomainMemberService {
|
||||
public class CentralDomainMemberService implements DomainMemberService {
|
||||
|
||||
@Autowired
|
||||
private DomainMemberDAO domainMemberDAO;
|
|
@ -1,7 +1,10 @@
|
|||
package com.loafle.overflow.central.module.domain.service;
|
||||
|
||||
import com.loafle.overflow.central.module.domain.dao.DomainDAO;
|
||||
import com.loafle.overflow.central.module.domain.model.Domain;
|
||||
|
||||
import com.loafle.overflow.core.exception.OverflowException;
|
||||
import com.loafle.overflow.model.domain.Domain;
|
||||
import com.loafle.overflow.service.central.domain.DomainService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -9,12 +12,12 @@ import org.springframework.stereotype.Service;
|
|||
* Created by snoop on 17. 6. 28.
|
||||
*/
|
||||
@Service("DomainService")
|
||||
public class DomainService {
|
||||
public class CentralDomainService implements DomainService {
|
||||
|
||||
@Autowired
|
||||
private DomainDAO domainDAO;
|
||||
|
||||
public void regist(Domain domain) {
|
||||
public void regist(Domain domain) throws OverflowException {
|
||||
this.domainDAO.save(domain);
|
||||
}
|
||||
}
|
|
@ -1,22 +1,9 @@
|
|||
package com.loafle.overflow.central.module.target.service;
|
||||
|
||||
import com.loafle.overflow.central.commons.utils.StringConvertor;
|
||||
import com.loafle.overflow.central.module.discovery.model.Host;
|
||||
import com.loafle.overflow.central.module.discovery.model.Port;
|
||||
import com.loafle.overflow.central.module.discovery.type.PortType;
|
||||
import com.loafle.overflow.central.module.infra.model.*;
|
||||
import com.loafle.overflow.central.module.infra.model.InfraService;
|
||||
import com.loafle.overflow.central.module.infra.service.*;
|
||||
import com.loafle.overflow.central.module.meta.model.MetaInfraType;
|
||||
import com.loafle.overflow.central.module.meta.model.MetaInfraVendor;
|
||||
import com.loafle.overflow.central.module.probe.model.Probe;
|
||||
import com.loafle.overflow.central.module.target.model.Target;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by snoop on 17. 6. 28.
|
||||
*/
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.loafle.overflow.central.module.target.service;
|
||||
|
||||
import com.loafle.overflow.central.module.discovery.model.Host;
|
||||
import com.loafle.overflow.central.module.probe.model.Probe;
|
||||
import com.loafle.overflow.central.spring.AppConfigTest;
|
||||
import org.codehaus.jackson.map.DeserializationConfig;
|
||||
|
|
Loading…
Reference in New Issue
Block a user