ing
This commit is contained in:
		
							parent
							
								
									f83c51ea4e
								
							
						
					
					
						commit
						a50c29cc10
					
				
							
								
								
									
										2
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								pom.xml
									
									
									
									
									
								
							@ -51,7 +51,7 @@
 | 
			
		||||
        <dependency>
 | 
			
		||||
            <groupId>com.loafle.overflow</groupId>
 | 
			
		||||
            <artifactId>commons-java</artifactId>
 | 
			
		||||
            <version>1.0.71-SNAPSHOT</version>
 | 
			
		||||
            <version>1.0.72-SNAPSHOT</version>
 | 
			
		||||
        </dependency>
 | 
			
		||||
 | 
			
		||||
        <dependency>
 | 
			
		||||
 | 
			
		||||
@ -55,8 +55,8 @@ public class CentralInfraHostPortService implements InfraHostPortService {
 | 
			
		||||
  public InfraHostPort regist(InfraHostPort infraHostPort) throws OverflowException {
 | 
			
		||||
    infraHostPort = this.validate(infraHostPort);
 | 
			
		||||
 | 
			
		||||
    if (null == infraHostPort.getInfraHost()) {
 | 
			
		||||
      throw new OverflowException("InfraHost is not valid");
 | 
			
		||||
    if (null == infraHostPort.getInfraHostIP()) {
 | 
			
		||||
      throw new OverflowException("InfraHostIP is not valid");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return this.infraHostPortDAO.save(infraHostPort);
 | 
			
		||||
@ -66,6 +66,11 @@ public class CentralInfraHostPortService implements InfraHostPortService {
 | 
			
		||||
    return this.infraHostPortDAO.findById(id).get();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public InfraHostPort readByInfraHostIPIDAndMetaPortTypeKeyAndPort(Long infraHostIPID, String metaPortTypeKey,
 | 
			
		||||
      Integer port) throws OverflowException {
 | 
			
		||||
    return this.infraHostPortDAO.findByInfraHostIdAndMetaPortTypeKeyAndPort(infraHostIPID, metaPortTypeKey, port);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public InfraHostPort readByInfraHostIDAndMetaPortTypeKeyAndPort(Long infraHostID, String metaPortTypeKey,
 | 
			
		||||
      Integer port) throws OverflowException {
 | 
			
		||||
    return this.infraHostPortDAO.findByInfraHostIdAndMetaPortTypeKeyAndPort(infraHostID, metaPortTypeKey, port);
 | 
			
		||||
@ -73,6 +78,7 @@ public class CentralInfraHostPortService implements InfraHostPortService {
 | 
			
		||||
 | 
			
		||||
  public InfraHostPort readByInfraHostInfraZoneIDAndMetaPortTypeKeyAndPort(Long infraHostInfraZoneID,
 | 
			
		||||
      String metaPortTypeKey, Integer port) throws OverflowException {
 | 
			
		||||
    return this.infraHostPortDAO.findByInfraHostInfraZoneIdAndMetaPortTypeKeyAndPort(infraHostInfraZoneID, metaPortTypeKey, port);
 | 
			
		||||
    return this.infraHostPortDAO.findByInfraHostInfraZoneIdAndMetaPortTypeKeyAndPort(infraHostInfraZoneID,
 | 
			
		||||
        metaPortTypeKey, port);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -14,17 +14,12 @@ import com.loafle.overflow.model.discovery.Port;
 | 
			
		||||
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.InfraHostApplication;
 | 
			
		||||
import com.loafle.overflow.model.infra.InfraHostDaemon;
 | 
			
		||||
import com.loafle.overflow.model.infra.InfraHostIP;
 | 
			
		||||
import com.loafle.overflow.model.infra.InfraHostMachine;
 | 
			
		||||
import com.loafle.overflow.model.infra.InfraHostOS;
 | 
			
		||||
import com.loafle.overflow.model.infra.InfraHostPort;
 | 
			
		||||
import com.loafle.overflow.model.infra.InfraZone;
 | 
			
		||||
import com.loafle.overflow.model.meta.MetaCryptoType;
 | 
			
		||||
import com.loafle.overflow.model.meta.MetaIPType;
 | 
			
		||||
import com.loafle.overflow.model.meta.MetaInfraType;
 | 
			
		||||
import com.loafle.overflow.model.meta.MetaPortType;
 | 
			
		||||
import com.loafle.overflow.model.meta.MetaTargetHostType;
 | 
			
		||||
import com.loafle.overflow.model.meta.MetaTargetZoneType;
 | 
			
		||||
import com.loafle.overflow.service.central.infra.InfraService;
 | 
			
		||||
@ -39,7 +34,6 @@ import inet.ipaddr.IPAddress;
 | 
			
		||||
import inet.ipaddr.IPAddressString;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
@Service("InfraService")
 | 
			
		||||
@ -248,11 +242,10 @@ public class CentralInfraService implements InfraService {
 | 
			
		||||
          infraHostIP.getMetaIPType().getName()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    infraHostPort.setInfraHost(infraHost);
 | 
			
		||||
    infraHostPort.setInfraHostIP(infraHostIP);
 | 
			
		||||
    infraHostPort = this.infraHostPortService.regist(infraHostPort);
 | 
			
		||||
 | 
			
		||||
    com.loafle.overflow.model.infra.InfraService infraService = new com.loafle.overflow.model.infra.InfraService();
 | 
			
		||||
    infraService.setInfraHostIP(infraHostIP);
 | 
			
		||||
    infraService.setInfraHostPort(infraHostPort);
 | 
			
		||||
    infraService.setMetaCryptoType(metaCryptoType);
 | 
			
		||||
 | 
			
		||||
@ -307,27 +300,21 @@ public class CentralInfraService implements InfraService {
 | 
			
		||||
    infraHost.setProbe(new Probe(probeID));
 | 
			
		||||
    infraHost.setInfraZone(new InfraZone(infraZoneID));
 | 
			
		||||
    infraHost.setMetaInfraType(MetaInfraType.Enum.HOST.to());
 | 
			
		||||
    infraHost.setMetaTargetHostType(MetaTargetHostType.Enum.UNKNOWN.to());
 | 
			
		||||
 | 
			
		||||
    infraHost = this.infraHostDAO.save(infraHost);
 | 
			
		||||
 | 
			
		||||
    InfraHostMachine infraHostMachine = oriInfraHost.getInfraHostMachine();
 | 
			
		||||
    if (null != infraHostMachine) {
 | 
			
		||||
      infraHostMachine.setInfraHost(infraHost);
 | 
			
		||||
      this.infraHostMachineService.regist(infraHostMachine);
 | 
			
		||||
    }
 | 
			
		||||
    infraHost.setInfraHostMachine(oriInfraHost.getInfraHostMachine());
 | 
			
		||||
 | 
			
		||||
    InfraHostOS infraHostOS = oriInfraHost.getInfraHostOS();
 | 
			
		||||
    infraHost.setInfraHostOS(infraHostOS);
 | 
			
		||||
    if (null != infraHostOS) {
 | 
			
		||||
      // MetaTargetHostType metaTargetHostType =
 | 
			
		||||
      // this.metaTargetHostTypeService.readByInfraHostOS(infraHostOS);
 | 
			
		||||
      infraHost.setMetaTargetHostType(MetaTargetHostType.Enum.UNKNOWN.to());
 | 
			
		||||
      infraHost = this.infraHostDAO.save(infraHost);
 | 
			
		||||
    } else {
 | 
			
		||||
      infraHost.setMetaTargetHostType(MetaTargetHostType.Enum.UNKNOWN.to());
 | 
			
		||||
 | 
			
		||||
      infraHostOS.setInfraHost(infraHost);
 | 
			
		||||
      this.infraHostOSService.regist(infraHostOS);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    infraHost = this.infraHostDAO.save(infraHost);
 | 
			
		||||
 | 
			
		||||
    if (null != oriInfraHost.getInfraHostIPs()) {
 | 
			
		||||
      for (InfraHostIP infraHostIP : oriInfraHost.getInfraHostIPs()) {
 | 
			
		||||
        infraHostIP = this.infraHostIPService.validate(infraHostIP);
 | 
			
		||||
@ -339,15 +326,6 @@ public class CentralInfraService implements InfraService {
 | 
			
		||||
      throw new OverflowException("InfraHostIPs is not valid");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (null != oriInfraHost.getInfraHostPorts()) {
 | 
			
		||||
      for (InfraHostPort infraHostPort : oriInfraHost.getInfraHostPorts()) {
 | 
			
		||||
        infraHostPort = this.infraHostPortService.validate(infraHostPort);
 | 
			
		||||
        infraHostPort.setInfraHost(infraHost);
 | 
			
		||||
 | 
			
		||||
        this.infraHostPortService.regist(infraHostPort);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return infraHost;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user