ing
This commit is contained in:
parent
1cb596487f
commit
4d22b8f367
2
pom.xml
2
pom.xml
|
@ -4,7 +4,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.loafle</groupId>
|
<groupId>com.loafle.maven</groupId>
|
||||||
<artifactId>maven_parent_jar</artifactId>
|
<artifactId>maven_parent_jar</artifactId>
|
||||||
<version>1.0.0-RELEASE</version>
|
<version>1.0.0-RELEASE</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
|
@ -9,22 +9,20 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext
|
||||||
|
|
||||||
public class GeneralContainer {
|
public class GeneralContainer {
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
if (args.length <= 0) {
|
if (args.length <= 0) {
|
||||||
System.out.println("first parameter is path of pid file");
|
System.out.println("first parameter is path of pid file");
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
String pidFilePath = args[0];
|
|
||||||
|
|
||||||
try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext()) {
|
|
||||||
context.getBeanFactory().registerSingleton(Container.PIDFILE_PATH, pidFilePath);
|
|
||||||
context.register(ContainerConfiguration.class, GeneralContainerConfiguration.class);
|
|
||||||
context.refresh();
|
|
||||||
context.registerShutdownHook();
|
|
||||||
GeneralContainerServer server = context.getBean(GeneralContainerServer.class);
|
|
||||||
server.start();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
String pidFilePath = args[0];
|
||||||
|
|
||||||
|
try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext()) {
|
||||||
|
context.getBeanFactory().registerSingleton(Container.PIDFILE_PATH, pidFilePath);
|
||||||
|
context.register(ContainerConfiguration.class, GeneralContainerConfiguration.class);
|
||||||
|
context.refresh();
|
||||||
|
context.registerShutdownHook();
|
||||||
|
GeneralContainerServer server = context.getBean(GeneralContainerServer.class);
|
||||||
|
server.start();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,29 +15,27 @@ import com.loafle.overflow.container.general.crawler.impl.wmi.WMICrawler;
|
||||||
import com.loafle.overflow.crawler.Crawler;
|
import com.loafle.overflow.crawler.Crawler;
|
||||||
|
|
||||||
public abstract class Crawlers {
|
public abstract class Crawlers {
|
||||||
private static Map<String, Crawler> crawlers = new HashMap<>();
|
private static Map<String, Crawler> crawlers = new HashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
addCrawler(new MySQLCrawler());
|
addCrawler(new MySQLCrawler());
|
||||||
addCrawler(new OracleCrawler());
|
addCrawler(new OracleCrawler());
|
||||||
addCrawler(new PostgreSQLCrawler());
|
addCrawler(new PostgreSQLCrawler());
|
||||||
addCrawler(new SQLServerCrawler());
|
addCrawler(new SQLServerCrawler());
|
||||||
addCrawler(new JMXCrawler());
|
addCrawler(new JMXCrawler());
|
||||||
addCrawler(new MongoDBCrawler());
|
addCrawler(new MongoDBCrawler());
|
||||||
addCrawler(new RedisCralwer());
|
addCrawler(new RedisCralwer());
|
||||||
addCrawler(new SNMPCrawler());
|
addCrawler(new SNMPCrawler());
|
||||||
addCrawler(new WMICrawler());
|
addCrawler(new WMICrawler());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
private static void addCrawler(Crawler crawler) {
|
||||||
|
String name = crawler.name();
|
||||||
|
crawlers.put(name, crawler);
|
||||||
|
}
|
||||||
|
|
||||||
private static void addCrawler(Crawler crawler) {
|
public static Map<String, Crawler> getCrawlers() {
|
||||||
String name = crawler.name();
|
return Crawlers.crawlers;
|
||||||
crawlers.put(name, crawler);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static Map<String, Crawler> getCrawlers() {
|
|
||||||
return Crawlers.crawlers;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
package com.loafle.overflow.container.general.crawler.impl.database;
|
package com.loafle.overflow.container.general.crawler.impl.database;
|
||||||
|
|
||||||
public class DatabaseMetaInfo {
|
public class DatabaseMetaInfo {
|
||||||
private String name;
|
private String name;
|
||||||
public String getName() {
|
|
||||||
return name;
|
public String getName() {
|
||||||
}
|
return name;
|
||||||
public void setName(String name) {
|
}
|
||||||
this.name = name;
|
|
||||||
}
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,18 +3,18 @@ package com.loafle.overflow.container.general.crawler.impl.database.sqlserver;
|
||||||
import com.loafle.overflow.container.general.crawler.impl.database.DatabaseCrawler;
|
import com.loafle.overflow.container.general.crawler.impl.database.DatabaseCrawler;
|
||||||
|
|
||||||
public class SQLServerCrawler extends DatabaseCrawler {
|
public class SQLServerCrawler extends DatabaseCrawler {
|
||||||
@Override
|
@Override
|
||||||
public String name() {
|
public String name() {
|
||||||
return "SQLSERVER";
|
return "SQLSERVER";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "SQL Server Crawler";
|
return "SQL Server Crawler";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadDriverClass() throws ClassNotFoundException {
|
protected void loadDriverClass() throws ClassNotFoundException {
|
||||||
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
|
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user