This commit is contained in:
crusader 2018-06-10 16:36:58 +09:00
parent a327e025f6
commit 77147b2267
5 changed files with 102 additions and 56 deletions

View File

@ -61,5 +61,4 @@ public class MetaCrawler {
public void setCreateDate(Date createDate) { public void setCreateDate(Date createDate) {
this.createDate = createDate; this.createDate = createDate;
} }
} }

View File

@ -1,52 +0,0 @@
package com.loafle.overflow.model.meta;
/**
* Created by snoop on 17. 9. 8.
*/
public enum MetaCrawlerEnum {
UNKNOWN((short) 1),
ACTIVEDIRECTORY((short) 2),
CASSANDRA((short) 3),
DHCP((short) 4),
DNS((short) 5),
FTP((short) 6),
HTTP((short) 7),
IMAP((short) 8),
LDAP((short) 9),
MONGODB((short) 10),
MSSQL((short) 11),
MYSQL((short) 12),
NETBIOS((short) 13),
ORACLE((short) 14),
POP((short) 15),
POSTGRESQL((short) 16),
REDIS((short) 17),
JMX((short) 18),
SMB((short) 19),
SMTP((short) 20),
SNMPV2((short) 21),
SNMPV3((short) 22),
SSH((short) 23),
TELNET((short) 24),
WMI((short) 25);
private Short value;
private MetaCrawlerEnum(Short value) {
this.value = value;
}
public Short getValue() {
return this.value;
}
public boolean equals(MetaCrawlerEnum metaCrawlerEnum) {
return this.value.equals(metaCrawlerEnum.value);
}
public boolean equals(MetaCrawler metaCrawler) {
return this.value.equals(metaCrawler.getId());
}
}

View File

@ -1,5 +1,8 @@
package com.loafle.overflow.model.meta; package com.loafle.overflow.model.meta;
import java.util.HashMap;
import java.util.Map;
import javax.persistence.*; import javax.persistence.*;
/** /**
@ -9,4 +12,24 @@ import javax.persistence.*;
@Table(name = "META_TARGET_HOST_TYPE", schema = "public") @Table(name = "META_TARGET_HOST_TYPE", schema = "public")
@DiscriminatorValue("2") @DiscriminatorValue("2")
public class MetaTargetHostType extends MetaTargetType { public class MetaTargetHostType extends MetaTargetType {
private static Map<String, Integer> mapping;
public MetaTargetHostType(Integer id) {
this.setId(id);
}
static {
Map<String, Integer> mapping = new HashMap<>();
MetaTargetHostType.mapping.putAll(mapping);
}
public static MetaTargetHostType toMetaTargetHostType(String key) {
Integer id = MetaTargetHostType.mapping.get(key);
if (null == id) {
return null;
}
return new MetaTargetHostType(id);
}
} }

View File

@ -1,5 +1,8 @@
package com.loafle.overflow.model.meta; package com.loafle.overflow.model.meta;
import java.util.HashMap;
import java.util.Map;
import javax.persistence.*; import javax.persistence.*;
/** /**
@ -9,5 +12,78 @@ import javax.persistence.*;
@Table(name = "META_TARGET_SERVICE_TYPE", schema = "public") @Table(name = "META_TARGET_SERVICE_TYPE", schema = "public")
@DiscriminatorValue("3") @DiscriminatorValue("3")
public class MetaTargetServiceType extends MetaTargetType { public class MetaTargetServiceType extends MetaTargetType {
private static Map<String, Integer> mapping;
public MetaTargetServiceType(Integer id) {
this.setId(id);
}
static {
Map<String, Integer> mapping = new HashMap<>();
mapping.put("UNKNOWN", 1000);
mapping.put("ACTIVE_DIRECTORY", 1001);
mapping.put("APACHE_HTTPD", 1002);
mapping.put("CASSANDRA", 1003);
mapping.put("COUCHBASE", 1004);
mapping.put("COUCHDB", 1005);
mapping.put("DB2", 1006);
mapping.put("DHCP", 1007);
mapping.put("DNS", 1008);
mapping.put("EXCHANGE_SERVER", 1009);
mapping.put("EXIM", 1010);
mapping.put("FIREBIRD", 1011);
mapping.put("FTP", 1012);
mapping.put("GLASSFISH", 1013);
mapping.put("HTTP", 1014);
mapping.put("HTTPS", 1015);
mapping.put("IMAP", 1016);
mapping.put("INFLUXDB", 1017);
mapping.put("INGRES", 1018);
mapping.put("JBOSS", 1019);
mapping.put("JMX", 1020);
mapping.put("LDAP", 1021);
mapping.put("LIGHTTPD", 1022);
mapping.put("MARIADB", 1023);
mapping.put("MEMCACHED", 1024);
mapping.put("IIS", 1025);
mapping.put("SQL_SERVER", 1026);
mapping.put("MONGODB", 1027);
mapping.put("MYSQL", 1028);
mapping.put("NETBIOS", 1029);
mapping.put("NGINX", 1030);
mapping.put("NNTP", 1031);
mapping.put("ORACLE", 1032);
mapping.put("POP", 1033);
mapping.put("POSTFIX", 1034);
mapping.put("POSTGRESQL", 1035);
mapping.put("REDIS", 1036);
mapping.put("REDIS_SENTINEL", 1037);
mapping.put("SENDMAIL", 1038);
mapping.put("SMB", 1039);
mapping.put("SMTP", 1040);
mapping.put("SNMP", 1041);
mapping.put("SNMP_V2", 1042);
mapping.put("SNMP_V3", 1043);
mapping.put("SQLITE", 1044);
mapping.put("SQUID_CACHE", 1045);
mapping.put("SQUID_PROXY", 1046);
mapping.put("SSH", 1047);
mapping.put("SYBASE", 1048);
mapping.put("TELNET", 1049);
mapping.put("TOMCAT", 1050);
mapping.put("VARNISH", 1051);
mapping.put("WEBSPHERE", 1052);
mapping.put("WMI", 1053);
mapping.put("ZIMBRA", 1054);
MetaTargetServiceType.mapping.putAll(mapping);
}
public static MetaTargetServiceType toMetaTargetServiceType(String key) {
Integer id = MetaTargetServiceType.mapping.get(key);
if (null == id) {
return null;
}
return new MetaTargetServiceType(id);
}
} }

View File

@ -12,7 +12,7 @@ import java.util.Date;
@Inheritance(strategy = InheritanceType.JOINED) @Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(name = "META_INFRA_TYPE_ID", discriminatorType = DiscriminatorType.INTEGER) @DiscriminatorColumn(name = "META_INFRA_TYPE_ID", discriminatorType = DiscriminatorType.INTEGER)
public abstract class MetaTargetType { public abstract class MetaTargetType {
private Long id; private Integer id;
private MetaInfraType metaInfraType; private MetaInfraType metaInfraType;
private String key; private String key;
private String name; private String name;
@ -20,11 +20,11 @@ public abstract class MetaTargetType {
private Date createDate; private Date createDate;
@Id @Id
public Long getId() { public Integer getId() {
return id; return id;
} }
public void setId(Long id) { public void setId(Integer id) {
this.id = id; this.id = id;
} }