This commit is contained in:
crusader 2018-06-10 20:37:37 +09:00
parent c320f55122
commit 7dd1c9f165
23 changed files with 319 additions and 157 deletions

View File

@ -50,7 +50,7 @@
<dependency>
<groupId>com.loafle.overflow</groupId>
<artifactId>commons-java</artifactId>
<version>1.0.19-SNAPSHOT</version>
<version>1.0.20-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -1,6 +1,6 @@
package com.loafle.overflow.central.module.infra.dao;
import com.loafle.overflow.model.infra.InfraOSApplication;
import com.loafle.overflow.model.infra.InfraHostApplication;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@ -8,6 +8,6 @@ import org.springframework.stereotype.Repository;
* Created by insanity on 17. 6. 23.
*/
@Repository
public interface InfraOSApplicationDAO extends JpaRepository<InfraOSApplication, Long> {
public interface InfraHostApplicationDAO extends JpaRepository<InfraHostApplication, Long> {
}

View File

@ -1,6 +1,6 @@
package com.loafle.overflow.central.module.infra.dao;
import com.loafle.overflow.model.infra.InfraMachine;
import com.loafle.overflow.model.infra.InfraHostDaemon;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@ -8,6 +8,6 @@ import org.springframework.stereotype.Repository;
* Created by insanity on 17. 6. 23.
*/
@Repository
public interface InfraMachineDAO extends JpaRepository<InfraMachine, Long> {
public interface InfraHostDaemonDAO extends JpaRepository<InfraHostDaemon, Long> {
}

View File

@ -0,0 +1,20 @@
package com.loafle.overflow.central.module.infra.dao;
import java.util.List;
import com.loafle.overflow.model.infra.InfraHostIP;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
/**
* Created by insanity on 17. 6. 23.
*/
@Repository
public interface InfraHostIPDAO extends JpaRepository<InfraHostIP, Long> {
List<InfraHostIP> findAllByInfraHostId(Long infraHostId);
List<InfraHostIP> findAllByInfraHostIdAndMetaIPTypeKey(Long infraHostId, String metaIPTypeKey);
List<InfraHostIP> findAllByInfraHostIdAndMac(Long infraHostId, String mac);
InfraHostIP findByInfraHostIdAndMetaIPTypeKeyAndAddress(Long infraHostId, String metaIPTypeKey, String address);
}

View File

@ -1,6 +1,6 @@
package com.loafle.overflow.central.module.infra.dao;
import com.loafle.overflow.model.infra.InfraOSDaemon;
import com.loafle.overflow.model.infra.InfraHostMachine;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@ -8,6 +8,6 @@ import org.springframework.stereotype.Repository;
* Created by insanity on 17. 6. 23.
*/
@Repository
public interface InfraOSDaemonDAO extends JpaRepository<InfraOSDaemon, Long> {
public interface InfraHostMachineDAO extends JpaRepository<InfraHostMachine, Long> {
}

View File

@ -1,6 +1,6 @@
package com.loafle.overflow.central.module.infra.dao;
import com.loafle.overflow.model.infra.InfraOS;
import com.loafle.overflow.model.infra.InfraHostOS;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@ -8,6 +8,6 @@ import org.springframework.stereotype.Repository;
* Created by insanity on 17. 6. 23.
*/
@Repository
public interface InfraOSDAO extends JpaRepository<InfraOS, Long> {
public interface InfraHostOSDAO extends JpaRepository<InfraHostOS, Long> {
}

View File

@ -0,0 +1,18 @@
package com.loafle.overflow.central.module.infra.dao;
import java.util.List;
import com.loafle.overflow.model.infra.InfraHostPort;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
/**
* Created by insanity on 17. 6. 23.
*/
@Repository
public interface InfraHostPortDAO extends JpaRepository<InfraHostPort, Long> {
List<InfraHostPort> findAllByInfraHostId(Long infraHostId);
List<InfraHostPort> findAllByInfraHostIdAndMetaPortTypeId(Long infraHostId, Short metaPortTypeId);
InfraHostPort findByInfraHostIdAndMetaPortTypeIdAndPort(Long infraHostId, Short metaPortTypeId, Integer port);
}

View File

@ -1,13 +0,0 @@
package com.loafle.overflow.central.module.infra.dao;
import com.loafle.overflow.model.infra.InfraOSPort;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
/**
* Created by insanity on 17. 6. 23.
*/
@Repository
public interface InfraOSPortDAO extends JpaRepository<InfraOSPort, Long> {
InfraOSPort findByInfraOSAndPortAndPortType(Long infraOSId, Integer port, String portType);
}

View File

@ -0,0 +1,17 @@
package com.loafle.overflow.central.module.infra.dao;
import java.util.List;
import com.loafle.overflow.model.infra.InfraZone;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
/**
* Created by insanity on 17. 6. 23.
*/
@Repository
public interface InfraZoneDAO extends JpaRepository<InfraZone, Long> {
List<InfraZone> findAllByProbeDomainId(Long probeDomainId);
List<InfraZone> findAllByProbeId(Long probeId);
}

View File

@ -0,0 +1,26 @@
package com.loafle.overflow.central.module.infra.service;
import com.loafle.overflow.central.module.infra.dao.InfraHostApplicationDAO;
import com.loafle.overflow.core.exception.OverflowException;
import com.loafle.overflow.model.infra.InfraHostApplication;
import com.loafle.overflow.service.central.infra.InfraHostApplicationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Created by insanity on 17. 6. 28.
*/
@Service("InfraHostApplicationService")
public class CentralInfraHostApplicationService implements InfraHostApplicationService {
@Autowired
InfraHostApplicationDAO infraHostApplicationDAO;
public InfraHostApplication regist(InfraHostApplication infraHostApplication) throws OverflowException {
return this.infraHostApplicationDAO.save(infraHostApplication);
}
public InfraHostApplication read(Long id) throws OverflowException {
return this.infraHostApplicationDAO.findById(id).get();
}
}

View File

@ -0,0 +1,26 @@
package com.loafle.overflow.central.module.infra.service;
import com.loafle.overflow.central.module.infra.dao.InfraHostDaemonDAO;
import com.loafle.overflow.core.exception.OverflowException;
import com.loafle.overflow.model.infra.InfraHostDaemon;
import com.loafle.overflow.service.central.infra.InfraHostDaemonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Created by insanity on 17. 6. 28.
*/
@Service("InfraOSDaemonService")
public class CentralInfraHostDaemonService implements InfraHostDaemonService {
@Autowired
InfraHostDaemonDAO infraHostDaemonDAO;
public InfraHostDaemon regist(InfraHostDaemon infraOSDaemon) throws OverflowException {
return this.infraHostDaemonDAO.save(infraOSDaemon);
}
public InfraHostDaemon read(Long id) throws OverflowException {
return this.infraHostDaemonDAO.findById(id).get();
}
}

View File

@ -0,0 +1,46 @@
package com.loafle.overflow.central.module.infra.service;
import java.util.List;
import com.loafle.overflow.central.module.infra.dao.InfraHostIPDAO;
import com.loafle.overflow.central.module.infra.dao.InfraHostPortDAO;
import com.loafle.overflow.core.exception.OverflowException;
import com.loafle.overflow.model.infra.InfraHostIP;
import com.loafle.overflow.model.infra.InfraHostPort;
import com.loafle.overflow.service.central.infra.InfraHostIPService;
import com.loafle.overflow.service.central.infra.InfraHostPortService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Created by insanity on 17. 6. 28.
*/
@Service("InfraOSIPService")
public class CentralInfraHostIPService implements InfraHostIPService {
@Autowired
InfraHostIPDAO infraHostIPDAO;
public InfraHostIP regist(InfraHostIP infraHostIP) throws OverflowException {
return this.infraHostIPDAO.save(infraHostIP);
}
public InfraHostIP read(Long id) throws OverflowException {
return this.infraHostIPDAO.findById(id).get();
}
public List<InfraHostIP> readByInfraHostID(Long infraHostID) throws OverflowException {
return this.infraHostIPDAO.findAllByInfraHostId(infraHostID);
}
public List<InfraHostIP> readByInfraHostIDAndMetaIPTypeKey(Long infraHostID, String metaIPTypeKey)
throws OverflowException {
return this.infraHostIPDAO.findAllByInfraHostIdAndMetaIPTypeKey(infraHostID, metaIPTypeKey);
}
public InfraHostIP readByInfraHostIDAndMetaIPTypeKeyAndAddress(Long infraHostID, String metaIPTypeKey, String address)
throws OverflowException {
return this.infraHostIPDAO.findByInfraHostIdAndMetaIPTypeKeyAndAddress(infraHostID, metaIPTypeKey, address);
}
}

View File

@ -0,0 +1,25 @@
package com.loafle.overflow.central.module.infra.service;
import com.loafle.overflow.central.module.infra.dao.InfraHostMachineDAO;
import com.loafle.overflow.core.exception.OverflowException;
import com.loafle.overflow.model.infra.InfraHostMachine;
import com.loafle.overflow.service.central.infra.InfraHostMachineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Created by insanity on 17. 6. 28.
*/
@Service("InfraHostMachineService")
public class CentralInfraHostMachineService implements InfraHostMachineService {
@Autowired
InfraHostMachineDAO infraHostMachineDAO;
public InfraHostMachine regist(InfraHostMachine infraHostMachine) throws OverflowException {
return this.infraHostMachineDAO.save(infraHostMachine);
}
public InfraHostMachine read(Long id) {
return this.infraHostMachineDAO.findById(id).get();
}
}

View File

@ -0,0 +1,26 @@
package com.loafle.overflow.central.module.infra.service;
import com.loafle.overflow.central.module.infra.dao.InfraHostOSDAO;
import com.loafle.overflow.core.exception.OverflowException;
import com.loafle.overflow.model.infra.InfraHostOS;
import com.loafle.overflow.service.central.infra.InfraHostOSService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Created by insanity on 17. 6. 28.
*/
@Service("InfraHostOSService")
public class CentralInfraHostOSService implements InfraHostOSService {
@Autowired
InfraHostOSDAO infraHostOSDAO;
public InfraHostOS regist(InfraHostOS infraHostOS) throws OverflowException {
return this.infraHostOSDAO.save(infraHostOS);
}
public InfraHostOS read(Long id) throws OverflowException {
return this.infraHostOSDAO.findById(id).get();
}
}

View File

@ -0,0 +1,31 @@
package com.loafle.overflow.central.module.infra.service;
import com.loafle.overflow.central.module.infra.dao.InfraHostPortDAO;
import com.loafle.overflow.core.exception.OverflowException;
import com.loafle.overflow.model.infra.InfraHostPort;
import com.loafle.overflow.service.central.infra.InfraHostPortService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Created by insanity on 17. 6. 28.
*/
@Service("InfraOSPortService")
public class CentralInfraHostPortService implements InfraHostPortService {
@Autowired
InfraHostPortDAO infraHostPortDAO;
public InfraHostPort regist(InfraHostPort infraHostPort) throws OverflowException {
return this.infraHostPortDAO.save(infraHostPort);
}
public InfraHostPort read(Long id) throws OverflowException {
return this.infraHostPortDAO.findById(id).get();
}
public InfraHostPort readByInfraOSIDAndPortAndPortType(Long infraOSID, Short metaPortTypeID, Integer port)
throws OverflowException {
return this.infraHostPortDAO.findByInfraHostIdAndMetaPortTypeIdAndPort(infraOSID, metaPortTypeID, port);
}
}

View File

@ -28,4 +28,10 @@ public class CentralInfraHostService implements InfraHostService {
return this.infraHostDAO.findByProbeIdAndIpv4(probeId, ip);
}
@Override
public InfraHost readByProbeIdAndInfraHostIPsAddressAndMetaIPTypeKey(String probeID, String address, String ipTypeKey)
throws OverflowException {
return null;
}
}

View File

@ -1,25 +0,0 @@
package com.loafle.overflow.central.module.infra.service;
import com.loafle.overflow.central.module.infra.dao.InfraMachineDAO;
import com.loafle.overflow.core.exception.OverflowException;
import com.loafle.overflow.model.infra.InfraMachine;
import com.loafle.overflow.service.central.infra.InfraMachineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Created by insanity on 17. 6. 28.
*/
@Service("InfraMachineService")
public class CentralInfraMachineService implements InfraMachineService {
@Autowired
InfraMachineDAO infraMachineDAO;
public InfraMachine regist(InfraMachine infraMachine) throws OverflowException {
return this.infraMachineDAO.save(infraMachine);
}
public InfraMachine read(Long id) {
return this.infraMachineDAO.findById(id).get();
}
}

View File

@ -1,26 +0,0 @@
package com.loafle.overflow.central.module.infra.service;
import com.loafle.overflow.central.module.infra.dao.InfraOSApplicationDAO;
import com.loafle.overflow.core.exception.OverflowException;
import com.loafle.overflow.model.infra.InfraOSApplication;
import com.loafle.overflow.service.central.infra.InfraOSApplicationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Created by insanity on 17. 6. 28.
*/
@Service("InfraOSApplicationService")
public class CentralInfraOSApplicationService implements InfraOSApplicationService {
@Autowired
InfraOSApplicationDAO infraOSApplicationDAO;
public InfraOSApplication regist(InfraOSApplication infraOSApplication) throws OverflowException {
return this.infraOSApplicationDAO.save(infraOSApplication);
}
public InfraOSApplication read(Long id) throws OverflowException {
return this.infraOSApplicationDAO.findById(id).get();
}
}

View File

@ -1,26 +0,0 @@
package com.loafle.overflow.central.module.infra.service;
import com.loafle.overflow.central.module.infra.dao.InfraOSDaemonDAO;
import com.loafle.overflow.core.exception.OverflowException;
import com.loafle.overflow.model.infra.InfraOSDaemon;
import com.loafle.overflow.service.central.infra.InfraOSDaemonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Created by insanity on 17. 6. 28.
*/
@Service("InfraOSDaemonService")
public class CentralInfraOSDaemonService implements InfraOSDaemonService {
@Autowired
InfraOSDaemonDAO infraOSDaemonDAO;
public InfraOSDaemon regist(InfraOSDaemon infraOSDaemon) throws OverflowException {
return this.infraOSDaemonDAO.save(infraOSDaemon);
}
public InfraOSDaemon read(Long id) throws OverflowException {
return this.infraOSDaemonDAO.findById(id).get();
}
}

View File

@ -1,31 +0,0 @@
package com.loafle.overflow.central.module.infra.service;
import com.loafle.overflow.central.module.infra.dao.InfraOSPortDAO;
import com.loafle.overflow.core.exception.OverflowException;
import com.loafle.overflow.model.infra.InfraOSPort;
import com.loafle.overflow.service.central.infra.InfraOSPortService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Created by insanity on 17. 6. 28.
*/
@Service("InfraOSPortService")
public class CentralInfraOSPortService implements InfraOSPortService {
@Autowired
InfraOSPortDAO infraOSPortDAO;
public InfraOSPort regist(InfraOSPort infraOSPort) throws OverflowException {
return this.infraOSPortDAO.save(infraOSPort);
}
public InfraOSPort read(Long id) throws OverflowException {
return this.infraOSPortDAO.findById(id).get();
}
public InfraOSPort readByInfraOSIDAndPortAndPortType(Long infraOSID, Integer port, String portType)
throws OverflowException {
return this.infraOSPortDAO.findByInfraOSAndPortAndPortType(infraOSID, port, portType);
}
}

View File

@ -1,26 +0,0 @@
package com.loafle.overflow.central.module.infra.service;
import com.loafle.overflow.central.module.infra.dao.InfraOSDAO;
import com.loafle.overflow.core.exception.OverflowException;
import com.loafle.overflow.model.infra.InfraOS;
import com.loafle.overflow.service.central.infra.InfraOSService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Created by insanity on 17. 6. 28.
*/
@Service("InfraOSService")
public class CentralInfraOSService implements InfraOSService {
@Autowired
InfraOSDAO infraOSDAO;
public InfraOS regist(InfraOS infraOS) throws OverflowException {
return this.infraOSDAO.save(infraOS);
}
public InfraOS read(Long id) throws OverflowException {
return this.infraOSDAO.findById(id).get();
}
}

View File

@ -6,7 +6,12 @@ import com.loafle.overflow.core.model.PageParams;
import com.loafle.overflow.model.probe.Probe;
import com.loafle.overflow.central.module.sensor.dao.SensorDAO;
import com.loafle.overflow.core.exception.OverflowException;
import com.loafle.overflow.model.discovery.Host;
import com.loafle.overflow.model.discovery.Zone;
import com.loafle.overflow.model.infra.Infra;
import com.loafle.overflow.model.infra.InfraHost;
import com.loafle.overflow.model.infra.InfraZone;
import com.loafle.overflow.model.noauthprobe.NoAuthProbeDescription;
import com.loafle.overflow.service.central.infra.InfraService;
import com.loafle.overflow.service.central.probe.ProbeService;
import org.springframework.beans.factory.annotation.Autowired;
@ -15,7 +20,6 @@ import org.springframework.stereotype.Service;
import java.util.List;
@Service("InfraService")
public class CentralInfraService implements InfraService {
@ -51,4 +55,25 @@ public class CentralInfraService implements InfraService {
return infraList;
}
public InfraZone regist(Long probeID, List<Host> hosts, List<com.loafle.overflow.model.discovery.Service> services) throws OverflowException {
return null;
}
public InfraZone regist(Long probeID, Zone zone) throws OverflowException {
return null;
}
public InfraHost regist(Long probeID, Host host) throws OverflowException {
return null;
}
public InfraService regist(Long probeID, com.loafle.overflow.model.discovery.Service service)
throws OverflowException {
return null;
}
public InfraHost regist(Long probeID, NoAuthProbeDescription noAuthProbeDescription) throws OverflowException {
return null;
}
}

View File

@ -0,0 +1,43 @@
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.InfraZoneDAO;
import com.loafle.overflow.core.model.PageParams;
import com.loafle.overflow.model.probe.Probe;
import com.loafle.overflow.central.module.sensor.dao.SensorDAO;
import com.loafle.overflow.core.exception.OverflowException;
import com.loafle.overflow.model.infra.Infra;
import com.loafle.overflow.model.infra.InfraZone;
import com.loafle.overflow.service.central.infra.InfraService;
import com.loafle.overflow.service.central.infra.InfraZoneService;
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;
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);
}
}