From 1cf599c5cf6f38a4f3e50228181712b092a13308 Mon Sep 17 00:00:00 2001 From: icanci Date: Wed, 16 Nov 2022 18:57:09 +0800 Subject: [PATCH] doc --- pom.xml | 89 ++++++------------- rec-core/pom.xml | 27 ------ .../resources/rec-http-spi-load.properties | 6 +- .../rec/engine/sdk/netty/PropertiesUtil.java | 56 ++++++++++++ 4 files changed, 86 insertions(+), 92 deletions(-) create mode 100644 rec-engine/rec-engine-sdk-netty/src/main/java/cn/icanci/rec/engine/sdk/netty/PropertiesUtil.java diff --git a/pom.xml b/pom.xml index 07d6d5d..e1922e8 100644 --- a/pom.xml +++ b/pom.xml @@ -291,19 +291,13 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.0.0-M1 + ${maven-deploy-plugin.version} ${javadoc.opts} - - - src/main/resources - true - - maven-compiler-plugin @@ -312,12 +306,34 @@ ${maven.compiler.target} ${maven.compiler.source} ${project.build.sourceEncoding} - true - - -parameters - + + + org.apache.maven.plugins + maven-source-plugin + + + package + + jar-no-fork + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + + package + + jar + + + + @@ -336,19 +352,12 @@ release - - org.apache.maven.plugins - maven-deploy-plugin - ${maven-deploy-plugin.version} - org.apache.maven.plugins maven-source-plugin - ${maven-source-plugin.version} - attach-sources package jar-no-fork @@ -360,25 +369,12 @@ org.apache.maven.plugins maven-javadoc-plugin - ${maven-javadoc-plugin.version} - - package - - - date - - - - attach-javadocs package jar - - none - @@ -407,37 +403,6 @@ true - - org.codehaus.mojo - flatten-maven-plugin - 1.2.7 - - clean - true - - remove - remove - - ${project.build.directory}/flattened - - - - flatten - process-resources - - flatten - - - - flatten.clean - clean - - clean - - - - - diff --git a/rec-core/pom.xml b/rec-core/pom.xml index 17a7eb8..969fc7f 100644 --- a/rec-core/pom.xml +++ b/rec-core/pom.xml @@ -29,11 +29,6 @@ - - cn.icanci.rec - rec-common - ${parent.version} - cn.icanci.rec rec-engine-sdk @@ -44,28 +39,6 @@ rec-engine-sdk-http ${parent.version} - - - org.mvel - mvel2 - - - org.codehaus.groovy - groovy-all - pom - - - org.apache.commons - commons-lang3 - - - org.apache.commons - commons-collections4 - - - com.google.guava - guava - diff --git a/rec-core/src/main/resources/rec-http-spi-load.properties b/rec-core/src/main/resources/rec-http-spi-load.properties index 46b31fc..f385ff9 100644 --- a/rec-core/src/main/resources/rec-http-spi-load.properties +++ b/rec-core/src/main/resources/rec-http-spi-load.properties @@ -1,6 +1,6 @@ -# ???? +# Service address for loading data rec-http-request-url=http://localhost:9999/rec/webapi/dataSourceType -# ?????????true???????????????false????rec-load-domains?? +# If rec-load-all is true, load all domain data; otherwise, load rec-load-domains data rec-load-all=true -# ?rec-load-all?false????rec-load-domains????????????,?? +# Domain Code separated by English comma rec-load-domains=xxx,xxx,xxx \ No newline at end of file diff --git a/rec-engine/rec-engine-sdk-netty/src/main/java/cn/icanci/rec/engine/sdk/netty/PropertiesUtil.java b/rec-engine/rec-engine-sdk-netty/src/main/java/cn/icanci/rec/engine/sdk/netty/PropertiesUtil.java new file mode 100644 index 0000000..1aff2af --- /dev/null +++ b/rec-engine/rec-engine-sdk-netty/src/main/java/cn/icanci/rec/engine/sdk/netty/PropertiesUtil.java @@ -0,0 +1,56 @@ +package cn.icanci.rec.engine.sdk.netty; + +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Properties; + +/** + * @author icanci + * @since 1.0 Created in 2022/11/15 21:38 + */ +public class PropertiesUtil { + /** + * The constant confProperties. + */ + private static Properties confProperties; + + /** + * 初始化 + * + * @param classLoader classLoader + * @param sourcePath sourcePath + */ + private static void init(ClassLoader classLoader, String sourcePath) { + if (confProperties == null) { + confProperties = new Properties(); + + try (InputStream in = classLoader.getResourceAsStream(sourcePath)) { + confProperties.load(in); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + /** + * Get string. + * + * @param classLoader 类加载器 + * @return the string + */ + public static Map getPropertyMap(ClassLoader classLoader, String sourcePath) { + // 初始化加载 + init(classLoader, sourcePath); + + Map propertyMap = new HashMap<>(); + Iterator> iterator = confProperties.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry next = iterator.next(); + propertyMap.put((String) next.getKey(), (String) next.getValue()); + } + return propertyMap; + } +} -- Gitee