From 4d22b8f36738bac6ff3d40694c24cd1fce7e1fed Mon Sep 17 00:00:00 2001 From: crusader Date: Wed, 25 Apr 2018 18:52:11 +0900 Subject: [PATCH] ing --- pom.xml | 2 +- .../container/general/GeneralContainer.java | 32 +++++++-------- .../container/general/crawler/Crawlers.java | 40 +++++++++---------- .../impl/database/DatabaseMetaInfo.java | 16 ++++---- .../database/sqlserver/SQLServerCrawler.java | 24 +++++------ 5 files changed, 56 insertions(+), 58 deletions(-) diff --git a/pom.xml b/pom.xml index 5832ff0..3519c0f 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 - com.loafle + com.loafle.maven maven_parent_jar 1.0.0-RELEASE diff --git a/src/main/java/com/loafle/overflow/container/general/GeneralContainer.java b/src/main/java/com/loafle/overflow/container/general/GeneralContainer.java index 1dd7f93..0954aa3 100644 --- a/src/main/java/com/loafle/overflow/container/general/GeneralContainer.java +++ b/src/main/java/com/loafle/overflow/container/general/GeneralContainer.java @@ -9,22 +9,20 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext public class GeneralContainer { - public static void main(String[] args) throws Exception { - if (args.length <= 0) { - System.out.println("first parameter is path of pid file"); - 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(); - } + public static void main(String[] args) throws Exception { + if (args.length <= 0) { + System.out.println("first parameter is path of pid file"); + 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(); + } + } } - - diff --git a/src/main/java/com/loafle/overflow/container/general/crawler/Crawlers.java b/src/main/java/com/loafle/overflow/container/general/crawler/Crawlers.java index 6cdebe0..d3d1b95 100644 --- a/src/main/java/com/loafle/overflow/container/general/crawler/Crawlers.java +++ b/src/main/java/com/loafle/overflow/container/general/crawler/Crawlers.java @@ -15,29 +15,27 @@ import com.loafle.overflow.container.general.crawler.impl.wmi.WMICrawler; import com.loafle.overflow.crawler.Crawler; public abstract class Crawlers { - private static Map crawlers = new HashMap<>(); + private static Map crawlers = new HashMap<>(); - static { - addCrawler(new MySQLCrawler()); - addCrawler(new OracleCrawler()); - addCrawler(new PostgreSQLCrawler()); - addCrawler(new SQLServerCrawler()); - addCrawler(new JMXCrawler()); - addCrawler(new MongoDBCrawler()); - addCrawler(new RedisCralwer()); - addCrawler(new SNMPCrawler()); - addCrawler(new WMICrawler()); + static { + addCrawler(new MySQLCrawler()); + addCrawler(new OracleCrawler()); + addCrawler(new PostgreSQLCrawler()); + addCrawler(new SQLServerCrawler()); + addCrawler(new JMXCrawler()); + addCrawler(new MongoDBCrawler()); + addCrawler(new RedisCralwer()); + addCrawler(new SNMPCrawler()); + addCrawler(new WMICrawler()); + } - } + private static void addCrawler(Crawler crawler) { + String name = crawler.name(); + crawlers.put(name, crawler); + } - private static void addCrawler(Crawler crawler) { - String name = crawler.name(); - crawlers.put(name, crawler); - } - - public static Map getCrawlers() { - return Crawlers.crawlers; - } + public static Map getCrawlers() { + return Crawlers.crawlers; + } } - diff --git a/src/main/java/com/loafle/overflow/container/general/crawler/impl/database/DatabaseMetaInfo.java b/src/main/java/com/loafle/overflow/container/general/crawler/impl/database/DatabaseMetaInfo.java index 52e3a02..6dd2813 100644 --- a/src/main/java/com/loafle/overflow/container/general/crawler/impl/database/DatabaseMetaInfo.java +++ b/src/main/java/com/loafle/overflow/container/general/crawler/impl/database/DatabaseMetaInfo.java @@ -1,11 +1,13 @@ package com.loafle.overflow.container.general.crawler.impl.database; public class DatabaseMetaInfo { - private String name; - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } + private String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } } diff --git a/src/main/java/com/loafle/overflow/container/general/crawler/impl/database/sqlserver/SQLServerCrawler.java b/src/main/java/com/loafle/overflow/container/general/crawler/impl/database/sqlserver/SQLServerCrawler.java index 4a3777b..d425648 100644 --- a/src/main/java/com/loafle/overflow/container/general/crawler/impl/database/sqlserver/SQLServerCrawler.java +++ b/src/main/java/com/loafle/overflow/container/general/crawler/impl/database/sqlserver/SQLServerCrawler.java @@ -3,18 +3,18 @@ package com.loafle.overflow.container.general.crawler.impl.database.sqlserver; import com.loafle.overflow.container.general.crawler.impl.database.DatabaseCrawler; public class SQLServerCrawler extends DatabaseCrawler { - @Override - public String name() { - return "SQLSERVER"; - } + @Override + public String name() { + return "SQLSERVER"; + } - @Override - public String toString() { - return "SQL Server Crawler"; - } + @Override + public String toString() { + return "SQL Server Crawler"; + } - @Override - protected void loadDriverClass() throws ClassNotFoundException { - Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); - } + @Override + protected void loadDriverClass() throws ClassNotFoundException { + Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); + } }