ing
This commit is contained in:
parent
ad2030c7af
commit
b4f91ed964
2
pom.xml
2
pom.xml
|
@ -50,7 +50,7 @@
|
|||
<dependency>
|
||||
<groupId>com.loafle.overflow</groupId>
|
||||
<artifactId>commons-java</artifactId>
|
||||
<version>1.0.24-SNAPSHOT</version>
|
||||
<version>1.0.26-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -12,6 +12,8 @@ import org.springframework.stereotype.Repository;
|
|||
*/
|
||||
@Repository
|
||||
public interface InfraZoneDAO extends JpaRepository<InfraZone, Long> {
|
||||
InfraZone findByProbeIdAndNetwork(Long probeId, String network);
|
||||
|
||||
List<InfraZone> findAllByProbeDomainId(Long probeDomainId);
|
||||
List<InfraZone> findAllByProbeId(Long probeId);
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
package com.loafle.overflow.central.module.infra.service;
|
||||
|
||||
import com.loafle.overflow.central.module.infra.dao.InfraHostDAO;
|
||||
import com.loafle.overflow.core.exception.OverflowException;
|
||||
import com.loafle.overflow.model.infra.InfraHost;
|
||||
import com.loafle.overflow.service.central.infra.InfraHostService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* Created by insanity on 17. 6. 28.
|
||||
*/
|
||||
|
||||
@Service("InfraHostService")
|
||||
public class CentralInfraHostService implements InfraHostService {
|
||||
@Autowired
|
||||
InfraHostDAO infraHostDAO;
|
||||
|
||||
public InfraHost regist(InfraHost infraHost) throws OverflowException {
|
||||
return this.infraHostDAO.save(infraHost);
|
||||
}
|
||||
|
||||
public InfraHost read(Long id) throws OverflowException {
|
||||
return this.infraHostDAO.findById(id).get();
|
||||
}
|
||||
|
||||
public InfraHost readByProbeIdAndIpv4(Long probeId, String ip) throws OverflowException {
|
||||
return this.infraHostDAO.findByProbeIdAndIpv4(probeId, ip);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InfraHost readByProbeIdAndInfraHostIPsAddressAndMetaIPTypeKey(String probeID, String address, String ipTypeKey)
|
||||
throws OverflowException {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -2,6 +2,9 @@ package com.loafle.overflow.central.module.infra.service;
|
|||
|
||||
import com.loafle.overflow.central.commons.utils.PageUtil;
|
||||
import com.loafle.overflow.central.module.infra.dao.InfraDAO;
|
||||
import com.loafle.overflow.central.module.infra.dao.InfraHostDAO;
|
||||
import com.loafle.overflow.central.module.infra.dao.InfraServiceDAO;
|
||||
import com.loafle.overflow.central.module.infra.dao.InfraZoneDAO;
|
||||
import com.loafle.overflow.core.model.PageParams;
|
||||
import com.loafle.overflow.model.probe.Probe;
|
||||
import com.loafle.overflow.core.exception.OverflowException;
|
||||
|
@ -18,7 +21,6 @@ import com.loafle.overflow.model.noauthprobe.NoAuthProbeDescription;
|
|||
import com.loafle.overflow.model.noauthprobe.NoAuthProbeDescriptionHost;
|
||||
import com.loafle.overflow.model.noauthprobe.NoAuthProbeDescriptionNetwork;
|
||||
import com.loafle.overflow.service.central.infra.InfraService;
|
||||
import com.loafle.overflow.service.central.probe.ProbeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -33,45 +35,51 @@ public class CentralInfraService implements InfraService {
|
|||
InfraDAO infraDAO;
|
||||
|
||||
@Autowired
|
||||
private ProbeService probeService;
|
||||
InfraZoneDAO infraZoneDAO;
|
||||
|
||||
@Autowired
|
||||
InfraHostDAO infraHostDAO;
|
||||
|
||||
@Autowired
|
||||
InfraServiceDAO infraServiceDAO;
|
||||
|
||||
@Override
|
||||
public Infra regist(Infra infra) throws OverflowException {
|
||||
return this.infraDAO.save(infra);
|
||||
}
|
||||
|
||||
public Infra read(Long id) throws OverflowException {
|
||||
return this.infraDAO.findById(id).get();
|
||||
}
|
||||
|
||||
public Page<Infra> readAllByProbeID(Long probeID, PageParams pageParams) throws OverflowException {
|
||||
return this.infraDAO.findAllByProbeId(probeID, PageUtil.getPageRequest(pageParams));
|
||||
}
|
||||
|
||||
public Page<Infra> readAllByDomainID(Long domainID, PageParams pageParams) throws OverflowException {
|
||||
List<Probe> probeList = this.probeService.readAllByDomainID(domainID);
|
||||
|
||||
if (probeList == null || probeList.size() <= 0) {
|
||||
throw new OverflowException("ProbeNotFoundException", new Throwable());
|
||||
@Override
|
||||
public InfraZone registZone(Long probeID, Zone zone) throws OverflowException {
|
||||
InfraZone infraZone = this.infraZoneDAO.findByProbeIdAndNetwork(probeID, zone.getNetwork());
|
||||
if (null != infraZone) {
|
||||
return infraZone;
|
||||
}
|
||||
|
||||
Page<Infra> infraList = this.infraDAO.findAllByProbeIn(probeList, PageUtil.getPageRequest(pageParams));
|
||||
return infraList;
|
||||
}
|
||||
infraZone = new InfraZone();
|
||||
infraZone.setMetaInfraType(MetaInfraType.Enum.ZONE.to());
|
||||
|
||||
public InfraZone regist(Long probeID, Zone zone) throws OverflowException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public InfraHost regist(Long probeID, Host host) throws OverflowException {
|
||||
@Override
|
||||
public InfraHost registHost(Long probeID, Host host) throws OverflowException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public InfraService regist(Long probeID, com.loafle.overflow.model.discovery.Service service)
|
||||
@Override
|
||||
public InfraService registService(Long probeID, com.loafle.overflow.model.discovery.Service service)
|
||||
throws OverflowException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public InfraHost regist(Long probeID, NoAuthProbeDescription noAuthProbeDescription) throws OverflowException {
|
||||
@Override
|
||||
public List<Infra> registDiscoverd(Long probeID, List<Host> hosts,
|
||||
List<com.loafle.overflow.model.discovery.Service> services) throws OverflowException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public InfraHost registByNoAuthProbe(Long probeID, NoAuthProbeDescription noAuthProbeDescription)
|
||||
throws OverflowException {
|
||||
NoAuthProbeDescriptionNetwork networkInfo = noAuthProbeDescription.getNetwork();
|
||||
InfraHostIP infraHostIP = new InfraHostIP();
|
||||
// FIXME getting IPType from networkInfo
|
||||
|
@ -90,4 +98,19 @@ public class CentralInfraService implements InfraService {
|
|||
return this.infraDAO.save(infraHost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Infra read(Long id) throws OverflowException {
|
||||
return this.infraDAO.findById(id).get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Infra> readAllByProbeID(Long probeID, PageParams pageParams) throws OverflowException {
|
||||
return this.infraDAO.findAllByProbeId(probeID, PageUtil.getPageRequest(pageParams));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Infra> readAllByDomainID(Long domainID, PageParams pageParams) throws OverflowException {
|
||||
return this.infraDAO.findAllByProbeDomainId(domainID, PageUtil.getPageRequest(pageParams));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
package com.loafle.overflow.central.module.infra.service;
|
||||
|
||||
import com.loafle.overflow.central.module.infra.dao.InfraServiceDAO;
|
||||
import com.loafle.overflow.core.exception.OverflowException;
|
||||
import com.loafle.overflow.model.infra.InfraService;
|
||||
import com.loafle.overflow.service.central.infra.InfraServiceService;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* Created by insanity on 17. 6. 28.
|
||||
*/
|
||||
@Service("InfraServiceService")
|
||||
public class CentralInfraServiceService implements InfraServiceService {
|
||||
|
||||
@Autowired
|
||||
InfraServiceDAO infraServiceDAO;
|
||||
|
||||
public com.loafle.overflow.model.infra.InfraService regist(InfraService infraService) throws OverflowException {
|
||||
return this.infraServiceDAO.save(infraService);
|
||||
}
|
||||
|
||||
public com.loafle.overflow.model.infra.InfraService read(Long id) throws OverflowException {
|
||||
return this.infraServiceDAO.findById(id).get();
|
||||
}
|
||||
|
||||
public com.loafle.overflow.model.infra.InfraService readByInfraHostIDAndPortAndPortType(Long infraHostID, int port, String portType)
|
||||
throws OverflowException {
|
||||
return this.infraServiceDAO.findByInfraHostIdAndPortAndPortType(infraHostID, port, portType);
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package com.loafle.overflow.central.module.infra.service;
|
||||
|
||||
import com.loafle.overflow.central.module.infra.dao.InfraZoneDAO;
|
||||
import com.loafle.overflow.core.exception.OverflowException;
|
||||
import com.loafle.overflow.model.infra.InfraZone;
|
||||
import com.loafle.overflow.service.central.infra.InfraZoneService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service("InfraZoneService")
|
||||
public class CentralInfraZoneService implements InfraZoneService {
|
||||
|
||||
@Autowired
|
||||
InfraZoneDAO infraZoneDAO;
|
||||
|
||||
public InfraZone regist(InfraZone infraZone) throws OverflowException {
|
||||
return this.infraZoneDAO.save(infraZone);
|
||||
}
|
||||
|
||||
public InfraZone read(Long id) throws OverflowException {
|
||||
return this.infraZoneDAO.findById(id).get();
|
||||
}
|
||||
|
||||
public List<InfraZone> readAllByProbeID(Long probeID) throws OverflowException {
|
||||
return this.infraZoneDAO.findAllByProbeId(probeID);
|
||||
}
|
||||
|
||||
public List<InfraZone> readAllByDomainID(Long domainID) throws OverflowException {
|
||||
return this.infraZoneDAO.findAllByProbeDomainId(domainID);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user