From 05f1cd8efffcfeeda17aeb38ec10315e0ea6e8cb Mon Sep 17 00:00:00 2001 From: insanity Date: Thu, 7 Jun 2018 22:23:21 +0900 Subject: [PATCH] arranging --- .../model/discovery/DiscoveryStartInfo.java | 92 ----------- .../overflow/model/probe/ProbeTask.java | 147 ------------------ .../central/infra/InfraHostService.java | 1 + .../service/central/infra/InfraService.java | 16 +- .../central/infra/InfraServiceService.java | 6 + .../central/probe/ProbeHostService.java | 9 +- .../service/central/probe/ProbeService.java | 17 +- .../central/probe/ProbeTaskService.java | 18 --- .../service/central/sensor/SensorService.java | 28 ++-- .../target/TargetDiscoveryService.java | 17 -- .../service/central/target/TargetService.java | 29 ++-- 11 files changed, 57 insertions(+), 323 deletions(-) delete mode 100644 src/main/java/com/loafle/overflow/model/discovery/DiscoveryStartInfo.java delete mode 100644 src/main/java/com/loafle/overflow/model/probe/ProbeTask.java delete mode 100644 src/main/java/com/loafle/overflow/service/central/probe/ProbeTaskService.java delete mode 100644 src/main/java/com/loafle/overflow/service/central/target/TargetDiscoveryService.java diff --git a/src/main/java/com/loafle/overflow/model/discovery/DiscoveryStartInfo.java b/src/main/java/com/loafle/overflow/model/discovery/DiscoveryStartInfo.java deleted file mode 100644 index 52440b7..0000000 --- a/src/main/java/com/loafle/overflow/model/discovery/DiscoveryStartInfo.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.loafle.overflow.model.discovery; - -import java.util.List; - -/** - * Created by snoop on 17. 9. 29. - */ -public class DiscoveryStartInfo { - String startIpv4; - String endIPv4; - String excludeIpv4; - - String startIpv6; - String endIPv6; - String excludeIpv6; - - String startPort; - String endPort; - List services; - - public String getStartIpv4() { - return startIpv4; - } - - public void setStartIpv4(String startIpv4) { - this.startIpv4 = startIpv4; - } - - public String getEndIPv4() { - return endIPv4; - } - - public void setEndIPv4(String endIPv4) { - this.endIPv4 = endIPv4; - } - - public String getExcludeIpv4() { - return excludeIpv4; - } - - public void setExcludeIpv4(String excludeIpv4) { - this.excludeIpv4 = excludeIpv4; - } - - public String getStartIpv6() { - return startIpv6; - } - - public void setStartIpv6(String startIpv6) { - this.startIpv6 = startIpv6; - } - - public String getEndIPv6() { - return endIPv6; - } - - public void setEndIPv6(String endIPv6) { - this.endIPv6 = endIPv6; - } - - public String getExcludeIpv6() { - return excludeIpv6; - } - - public void setExcludeIpv6(String excludeIpv6) { - this.excludeIpv6 = excludeIpv6; - } - - public String getStartPort() { - return startPort; - } - - public void setStartPort(String startPort) { - this.startPort = startPort; - } - - public String getEndPort() { - return endPort; - } - - public void setEndPort(String endPort) { - this.endPort = endPort; - } - - public List getServices() { - return services; - } - - public void setServices(List services) { - this.services = services; - } -} diff --git a/src/main/java/com/loafle/overflow/model/probe/ProbeTask.java b/src/main/java/com/loafle/overflow/model/probe/ProbeTask.java deleted file mode 100644 index 386fbc5..0000000 --- a/src/main/java/com/loafle/overflow/model/probe/ProbeTask.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.loafle.overflow.model.probe; - -import com.loafle.overflow.model.meta.MetaProbeTaskType; - -import javax.persistence.*; -import java.util.Date; - -/** - * Created by root on 17. 6. 22. - */ -@Entity -@Table(name = "PROBE_TASK", schema = "public") -public class ProbeTask { - private Long id; - private MetaProbeTaskType metaProbeTaskType; - private Probe probe; - private String data; - private Date createDate; - private Date sendDate; - private Date startDate; - private Date endDate; - private Boolean succeed; - - @Id - @GeneratedValue(strategy = GenerationType.IDENTITY) - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - @ManyToOne - @JoinColumn(name = "META_PROBE_TASK_TYPE_ID", nullable = false) - public MetaProbeTaskType getMetaProbeTaskType() { - return metaProbeTaskType; - } - - public void setMetaProbeTaskType(MetaProbeTaskType metaProbeTaskType) { - this.metaProbeTaskType = metaProbeTaskType; - } - - @ManyToOne - @JoinColumn(name = "PROBE_ID", nullable = false) - public Probe getProbe() { - return probe; - } - - public void setProbe(Probe probe) { - this.probe = probe; - } - - @Column(name = "DATA", nullable = true, length = 255) - public String getData() { - return data; - } - - public void setData(String data) { - this.data = data; - } - - @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; - } - - @Column(name = "SEND_DATE", nullable = true) - public Date getSendDate() { - return sendDate; - } - - public void setSendDate(Date sendDate) { - this.sendDate = sendDate; - } - - @Column(name = "START_DATE", nullable = true) - public Date getStartDate() { - return startDate; - } - - public void setStartDate(Date startDate) { - this.startDate = startDate; - } - - @Column(name = "END_DATE", nullable = true) - public Date getEndDate() { - return endDate; - } - - public void setEndDate(Date endDate) { - this.endDate = endDate; - } - - @Column(name = "SUCCEED", nullable = true) - public Boolean getSucceed() { - return succeed; - } - - public void setSucceed(Boolean succeed) { - this.succeed = succeed; - } - - // @Override - // public boolean equals(Object o) { - // if (this == o) return true; - // if (o == null || getClass() != o.getClass()) return false; - // - // ProbeTask that = (ProbeTask) o; - // - // if (id != that.id) return false; - // if (typeId != that.typeId) return false; - // if (probeId != that.probeId) return false; - // if (data != null ? !data.equals(that.data) : that.data != null) return false; - // if (createDate != null ? !createDate.equals(that.createDate) : - // that.createDate != null) return false; - // if (sendDate != null ? !sendDate.equals(that.sendDate) : that.sendDate != - // null) return false; - // if (startDate != null ? !startDate.equals(that.startDate) : that.startDate != - // null) return false; - // if (endDate != null ? !endDate.equals(that.endDate) : that.endDate != null) - // return false; - // if (succeed != null ? !succeed.equals(that.succeed) : that.succeed != null) - // return false; - // - // return true; - // } - // - // @Override - // public int hashCode() { - // int result = (int) (id ^ (id >>> 32)); - // result = 31 * result + (int) typeId; - // result = 31 * result + (int) (probeId ^ (probeId >>> 32)); - // result = 31 * result + (data != null ? data.hashCode() : 0); - // result = 31 * result + (createDate != null ? createDate.hashCode() : 0); - // result = 31 * result + (sendDate != null ? sendDate.hashCode() : 0); - // result = 31 * result + (startDate != null ? startDate.hashCode() : 0); - // result = 31 * result + (endDate != null ? endDate.hashCode() : 0); - // result = 31 * result + (succeed != null ? succeed.hashCode() : 0); - // return result; - // } -} diff --git a/src/main/java/com/loafle/overflow/service/central/infra/InfraHostService.java b/src/main/java/com/loafle/overflow/service/central/infra/InfraHostService.java index 10451a1..376b25f 100644 --- a/src/main/java/com/loafle/overflow/service/central/infra/InfraHostService.java +++ b/src/main/java/com/loafle/overflow/service/central/infra/InfraHostService.java @@ -8,6 +8,7 @@ import com.loafle.overflow.model.infra.InfraHost; */ public interface InfraHostService { + InfraHost regist(InfraHost infraHost) throws OverflowException; InfraHost read(Long id) throws OverflowException; diff --git a/src/main/java/com/loafle/overflow/service/central/infra/InfraService.java b/src/main/java/com/loafle/overflow/service/central/infra/InfraService.java index 3776b73..96b7c9f 100644 --- a/src/main/java/com/loafle/overflow/service/central/infra/InfraService.java +++ b/src/main/java/com/loafle/overflow/service/central/infra/InfraService.java @@ -1,31 +1,27 @@ package com.loafle.overflow.service.central.infra; -import java.util.List; - +import com.loafle.overflow.core.annotation.WebappAPI; import com.loafle.overflow.core.exception.OverflowException; import com.loafle.overflow.core.model.PageParams; import com.loafle.overflow.model.infra.Infra; -import com.loafle.overflow.model.probe.Probe; -import com.loafle.overflow.model.target.Target; import org.springframework.data.domain.Page; /** * Created by insanity on 17. 6. 28. */ - public interface InfraService { + + @WebappAPI Infra regist(Infra infra) throws OverflowException; + @WebappAPI Infra read(Long id) throws OverflowException; + @WebappAPI Page readAllByProbeID(Long probeID, PageParams pageParams) throws OverflowException; + @WebappAPI Page readAllByDomainID(Long domainID, PageParams pageParams) throws OverflowException; - List readAllTargetByDomainID(Long domainID) throws OverflowException; - - List readAllTargetByProbes(List probes) throws OverflowException; - - Infra readByTargetID(Long targetID) throws OverflowException; } diff --git a/src/main/java/com/loafle/overflow/service/central/infra/InfraServiceService.java b/src/main/java/com/loafle/overflow/service/central/infra/InfraServiceService.java index eb54e5f..486be88 100644 --- a/src/main/java/com/loafle/overflow/service/central/infra/InfraServiceService.java +++ b/src/main/java/com/loafle/overflow/service/central/infra/InfraServiceService.java @@ -1,7 +1,13 @@ package com.loafle.overflow.service.central.infra; +import com.loafle.overflow.core.exception.OverflowException; + /** * Created by insanity on 17. 6. 28. */ public interface InfraServiceService { + + InfraService regist(InfraService infraService) throws OverflowException; + + InfraService read(Long id) throws OverflowException; } diff --git a/src/main/java/com/loafle/overflow/service/central/probe/ProbeHostService.java b/src/main/java/com/loafle/overflow/service/central/probe/ProbeHostService.java index ad8e372..799af47 100644 --- a/src/main/java/com/loafle/overflow/service/central/probe/ProbeHostService.java +++ b/src/main/java/com/loafle/overflow/service/central/probe/ProbeHostService.java @@ -10,12 +10,15 @@ import com.loafle.overflow.model.probe.ProbeHost; * Created by snoop on 17. 8. 21. */ public interface ProbeHostService { - ProbeHost read(Long id) throws OverflowException; - - ProbeHost readByProbeID(Long probeID) throws OverflowException; ProbeHost regist(ProbeHost probeHost) throws OverflowException; + @WebappAPI + ProbeHost read(Long id) throws OverflowException; + + @WebappAPI + ProbeHost readByProbeID(Long probeID) throws OverflowException; + @WebappAPI List readAllByDomainID(Long domainID) throws OverflowException; } diff --git a/src/main/java/com/loafle/overflow/service/central/probe/ProbeService.java b/src/main/java/com/loafle/overflow/service/central/probe/ProbeService.java index 4e4c6a7..7efe0a8 100644 --- a/src/main/java/com/loafle/overflow/service/central/probe/ProbeService.java +++ b/src/main/java/com/loafle/overflow/service/central/probe/ProbeService.java @@ -11,11 +11,8 @@ import java.util.List; * Created by snoop on 17. 6. 28. */ public interface ProbeService { - // NoauthProbe.acceptNoAuthProbe - Probe regist(Probe probe) throws OverflowException; - // NoauthProbe.acceptNoAuthProbe - List regist(List probes) throws OverflowException; + Probe regist(Probe probe) throws OverflowException; @WebappAPI List readAllByDomainID(Long id) throws OverflowException; @@ -23,13 +20,7 @@ public interface ProbeService { @WebappAPI Probe read(Long id) throws OverflowException; - @WebappAPI - Probe modifyDisplayName(Long probeId, String displayName) throws OverflowException; - - @ProbeAPI // ? - Probe readByProbeKey(String probeKey) throws OverflowException; - - @ProbeAPI // ? + @WebappAPI Probe modify(Probe probe) throws OverflowException; @ProbeAPI @@ -38,4 +29,8 @@ public interface ProbeService { @ProbeAPI void onDisconnect(String probeKey) throws OverflowException; + Probe increaseTargetCount(Long id) throws OverflowException; + + Probe decreaseTargetCount(Long id) throws OverflowException; + } diff --git a/src/main/java/com/loafle/overflow/service/central/probe/ProbeTaskService.java b/src/main/java/com/loafle/overflow/service/central/probe/ProbeTaskService.java deleted file mode 100644 index 19a4c21..0000000 --- a/src/main/java/com/loafle/overflow/service/central/probe/ProbeTaskService.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.loafle.overflow.service.central.probe; - -import com.loafle.overflow.core.annotation.ProbeAPI; -import com.loafle.overflow.core.exception.OverflowException; -import com.loafle.overflow.model.probe.ProbeTask; - -import java.util.List; - -/** - * Created by snoop on 17. 6. 28. - */ -public interface ProbeTaskService { - @ProbeAPI - ProbeTask regist(ProbeTask probeTask) throws OverflowException; - - @ProbeAPI - List readAllByProbeID(Long probeID) throws OverflowException; -} diff --git a/src/main/java/com/loafle/overflow/service/central/sensor/SensorService.java b/src/main/java/com/loafle/overflow/service/central/sensor/SensorService.java index a63fd0e..1207ce4 100644 --- a/src/main/java/com/loafle/overflow/service/central/sensor/SensorService.java +++ b/src/main/java/com/loafle/overflow/service/central/sensor/SensorService.java @@ -14,13 +14,29 @@ import java.util.List; */ public interface SensorService { @WebappAPI - Sensor regist(Sensor sensor) throws OverflowException; + Sensor regist(Sensor sensor, Long targetID) throws OverflowException; @WebappAPI Sensor read(Long id) throws OverflowException; @WebappAPI - void remove(Long id) throws OverflowException; + void remove(Long id, Long targetID) throws OverflowException; + + @WebappAPI + Page readAllByProbeID(Long probeID, PageParams pageParams) throws OverflowException; + + @WebappAPI + Page readAllByDomainID(Long domainID, PageParams pageParams) throws OverflowException; + + @WebappAPI + Page readAllByInfraID(Long infraID, PageParams pageParams) throws OverflowException; + + @WebappAPI + Page readAllByTargetID(Long targetID, PageParams pageParams) throws OverflowException; + + Sensor increaseSensorItemCount(Long id) throws OverflowException; + + Sensor decreaseSensorItemCount(Long id) throws OverflowException; @WebappAPI Sensor start(Long id) throws OverflowException; @@ -34,12 +50,4 @@ public interface SensorService { @WebappAPI String generateSensorConfig(Sensor sensor) throws OverflowException; - @WebappAPI - Page readAllByDomainID(Long domainID, PageParams pageParams) throws OverflowException; - - @WebappAPI - Page readAllByInfraID(Long infraID, PageParams pageParams) throws OverflowException; - - @WebappAPI - Page readAllByTargetID(Long targetID, PageParams pageParams) throws OverflowException; } diff --git a/src/main/java/com/loafle/overflow/service/central/target/TargetDiscoveryService.java b/src/main/java/com/loafle/overflow/service/central/target/TargetDiscoveryService.java deleted file mode 100644 index 175a655..0000000 --- a/src/main/java/com/loafle/overflow/service/central/target/TargetDiscoveryService.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.loafle.overflow.service.central.target; - -import com.loafle.overflow.core.annotation.WebappAPI; -import com.loafle.overflow.core.exception.OverflowException; -import com.loafle.overflow.model.discovery.Host; -import com.loafle.overflow.model.probe.Probe; - -import java.util.List; - -/** - * Created by snoop on 17. 6. 28. - */ -public interface TargetDiscoveryService { - - @WebappAPI - boolean saveAllTarget(List hosts, Probe probe) throws OverflowException; -} diff --git a/src/main/java/com/loafle/overflow/service/central/target/TargetService.java b/src/main/java/com/loafle/overflow/service/central/target/TargetService.java index 6b15f82..dc5aba5 100644 --- a/src/main/java/com/loafle/overflow/service/central/target/TargetService.java +++ b/src/main/java/com/loafle/overflow/service/central/target/TargetService.java @@ -16,33 +16,32 @@ import org.springframework.data.domain.Page; */ public interface TargetService { - public Target regist(Target target, Probe probe) throws OverflowException; - - public void remove(Target target, Probe probe) throws OverflowException; - - public Target read(String id) throws OverflowException; - - public Target increaseSensorCount(Target target) throws OverflowException; - - public Target decreaseSensorCount(Target target) throws OverflowException; + Target regist(Target target, String probeID) throws OverflowException; @WebappAPI - public Target modify(Target target) throws OverflowException; + void remove(Target target, String probeID) throws OverflowException; @WebappAPI - void remove(Target target) throws OverflowException; + Target read(Long id) throws OverflowException; @WebappAPI - public List registDiscoveredTargets(Long probeId, List hosts, List services) + Target modify(Target target) throws OverflowException; + + @WebappAPI + List registDiscoveredTargets(Long probeId, List hosts, List services) throws OverflowException; @WebappAPI - public Target readExistHostTarget(Long probeId, String ip) throws OverflowException; + Target readExistHostTarget(Long probeId, String ip) throws OverflowException; @WebappAPI - public Target readExistServiceTarget(Long hostId, int portNumber, String portType) throws OverflowException; + Target readExistServiceTarget(Long hostId, int portNumber, String portType) throws OverflowException; @WebappAPI - public Page readAllByProbeID(Long probeID, PageParams pageParams) throws OverflowException; + Page readAllByProbeID(Long probeID, PageParams pageParams) throws OverflowException; + + Target increaseSensorCount(Long id) throws OverflowException; + + Target decreaseSensorCount(Long id) throws OverflowException; }