From c0229ae74eb6db9e1eb215ef51aafee4250552a0 Mon Sep 17 00:00:00 2001 From: richie Date: Thu, 22 Nov 2018 15:22:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=92=E4=BB=B6=E5=8F=AF=E8=A7=86=E5=8C=96?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../simple/PluginInitializeFilterBridge.java | 24 ++++++++++ .../demo/simple/PluginLocaleFinderBridge.java | 10 +++++ .../{ => account}/PluginSimpleConfig.java | 45 +++++++++++++++++-- .../conf/demo/simple/locale/conf.properties | 12 +++++ .../demo/simple/locale/conf_zh_CN.properties | 12 +++++ 5 files changed, 99 insertions(+), 4 deletions(-) create mode 100644 src/main/java/com/fr/conf/demo/simple/PluginInitializeFilterBridge.java create mode 100644 src/main/java/com/fr/conf/demo/simple/PluginLocaleFinderBridge.java rename src/main/java/com/fr/conf/demo/simple/{ => account}/PluginSimpleConfig.java (52%) create mode 100644 src/main/resources/com/fr/conf/demo/simple/locale/conf.properties create mode 100644 src/main/resources/com/fr/conf/demo/simple/locale/conf_zh_CN.properties diff --git a/src/main/java/com/fr/conf/demo/simple/PluginInitializeFilterBridge.java b/src/main/java/com/fr/conf/demo/simple/PluginInitializeFilterBridge.java new file mode 100644 index 0000000..17457a7 --- /dev/null +++ b/src/main/java/com/fr/conf/demo/simple/PluginInitializeFilterBridge.java @@ -0,0 +1,24 @@ +package com.fr.conf.demo.simple; + +import com.fr.conf.demo.simple.account.PluginSimpleConfig; +import com.fr.decision.fun.impl.AbstractEmbedRequestFilterProvider; + +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class PluginInitializeFilterBridge extends AbstractEmbedRequestFilterProvider { + + @Override + public void init(FilterConfig filterConfig) { + PluginSimpleConfig.getInstance(); + } + + @Override + public void doFilter(HttpServletRequest req, HttpServletResponse res, FilterChain filterChain) throws IOException, ServletException { + + } +} diff --git a/src/main/java/com/fr/conf/demo/simple/PluginLocaleFinderBridge.java b/src/main/java/com/fr/conf/demo/simple/PluginLocaleFinderBridge.java new file mode 100644 index 0000000..7d4c346 --- /dev/null +++ b/src/main/java/com/fr/conf/demo/simple/PluginLocaleFinderBridge.java @@ -0,0 +1,10 @@ +package com.fr.conf.demo.simple; + +import com.fr.stable.fun.impl.AbstractLocaleFinder; + +public class PluginLocaleFinderBridge extends AbstractLocaleFinder { + @Override + public String find() { + return "com/fr/conf/demo/simple/locale/conf"; + } +} diff --git a/src/main/java/com/fr/conf/demo/simple/PluginSimpleConfig.java b/src/main/java/com/fr/conf/demo/simple/account/PluginSimpleConfig.java similarity index 52% rename from src/main/java/com/fr/conf/demo/simple/PluginSimpleConfig.java rename to src/main/java/com/fr/conf/demo/simple/account/PluginSimpleConfig.java index 7b2bc05..f55a0c9 100644 --- a/src/main/java/com/fr/conf/demo/simple/PluginSimpleConfig.java +++ b/src/main/java/com/fr/conf/demo/simple/account/PluginSimpleConfig.java @@ -1,4 +1,4 @@ -package com.fr.conf.demo.simple; +package com.fr.conf.demo.simple.account; import com.fr.config.ConfigContext; import com.fr.config.DefaultConfiguration; @@ -12,7 +12,7 @@ import com.fr.intelli.record.Original; import com.fr.record.analyzer.EnableMetrics; import com.fr.stable.StringUtils; -@Visualization(category = "Plugin") +@Visualization(category = "Plugin-Config_Group") @EnableMetrics public class PluginSimpleConfig extends DefaultConfiguration { @@ -26,12 +26,22 @@ public class PluginSimpleConfig extends DefaultConfiguration { return config; } - @Identifier(value = "text", name = "Plugin-Config_Property_Text", description = "Plugin-Config_Property_Text_Description", group = "Plugin", status = Status.SHOW) + @Identifier(value = "text", name = "Plugin-Config_Property_Text", description = "Plugin-Config_Property_Text_Description", status = Status.SHOW) private Conf text = Holders.simple(StringUtils.EMPTY); - @Identifier(value = "count", name = "Plugin-Config_Property_Count", description = "Config_Property_Count_Description", group = "Plugin", status = Status.SHOW) + @Identifier(value = "count", name = "Plugin-Config_Property_Count", description = "Plugin-Config_Property_Count_Description", status = Status.SHOW) private Conf count = Holders.simple(100); + @Identifier(value = "price", name = "Plugin-Config_Property_Price", description = "Plugin-Config_Property_Price_Description", status = Status.SHOW) + private Conf price = Holders.simple(1000.0); + + @Identifier(value = "time", name = "Plugin-Config_Property_Time", description = "Plugin-Config_Property_Time_Description", status = Status.SHOW) + private Conf time = Holders.simple(99999999L); + + @Identifier(value = "student", name = "Plugin-Config_Property_Student", description = "Plugin-Config_Property_Student_Description", status = Status.SHOW) + private Conf student = Holders.simple(true); + + public String getText() { return text.get(); } @@ -48,11 +58,38 @@ public class PluginSimpleConfig extends DefaultConfiguration { this.count.set(count); } + public double getPrice() { + return price.get(); + } + + public void setPrice(double price) { + this.price.set(price); + } + + public long getTime() { + return time.get(); + } + + public void setTime(long time) { + this.time.set(time); + } + + public boolean isStudent() { + return student.get(); + } + + public void setStudent(boolean student) { + this.student.set(student); + } + @Override public Object clone() throws CloneNotSupportedException { PluginSimpleConfig cloned = (PluginSimpleConfig) super.clone(); cloned.text = (Conf) text.clone(); cloned.count = (Conf) count.clone(); + cloned.price = (Conf) price.clone(); + cloned.time = (Conf) time.clone(); + cloned.student = (Conf) student.clone(); return cloned; } } diff --git a/src/main/resources/com/fr/conf/demo/simple/locale/conf.properties b/src/main/resources/com/fr/conf/demo/simple/locale/conf.properties new file mode 100644 index 0000000..c5d7ea8 --- /dev/null +++ b/src/main/resources/com/fr/conf/demo/simple/locale/conf.properties @@ -0,0 +1,12 @@ +Plugin-Config_Demo=Plugin Demo +Plugin-Config_Property_Text=Account +Plugin-Config_Property_Count=Count +Plugin-Config_Property_Text_Description=This is a text property. +Plugin-Config_Property_Count_Description=This is a int property. +Plugin-Config_Group=Plugin +Plugin-Config_Property_Price=Price +Plugin-Config_Property_Price_Description=This is a price property. +Plugin-Config_Property_Time=Time +Plugin-Config_Property_Time_Description=This is a time proeprty. +Plugin-Config_Property_Student=Student +Plugin-Config_Property_Student_Description=This is a bool property. \ No newline at end of file diff --git a/src/main/resources/com/fr/conf/demo/simple/locale/conf_zh_CN.properties b/src/main/resources/com/fr/conf/demo/simple/locale/conf_zh_CN.properties new file mode 100644 index 0000000..d01325e --- /dev/null +++ b/src/main/resources/com/fr/conf/demo/simple/locale/conf_zh_CN.properties @@ -0,0 +1,12 @@ +Plugin-Config_Demo=\u793A\u4F8B\u63D2\u4EF6 +Plugin-Config_Property_Text=\u8D26\u53F7 +Plugin-Config_Property_Count=\u6570\u91CF +Plugin-Config_Property_Text_Description=\u8FD9\u662F\u4E00\u4E2A\u6587\u672C\u7C7B\u578B\u7684\u914D\u7F6E\u5C5E\u6027\u3002 +Plugin-Config_Property_Count_Description=\u8FD9\u662F\u4E00\u4E2A\u6574\u6570\u7C7B\u578B\u7684\u914D\u7F6E\u5C5E\u6027\u3002 +Plugin-Config_Group=\u63D2\u4EF6\u914D\u7F6E +Plugin-Config_Property_Price=\u4EF7\u683C +Plugin-Config_Property_Price_Description=\u8FD9\u662F\u7528\u6765\u8BBE\u7F6E\u4EF7\u683C\u7684\u3002 +Plugin-Config_Property_Time=\u65F6\u95F4 +Plugin-Config_Property_Time_Description=\u8FD9\u662F\u7528\u6765\u8BBE\u7F6E\u6709\u6548\u65F6\u95F4\u7684 +Plugin-Config_Property_Student=\u5B66\u751F +Plugin-Config_Property_Student_Description=\u8FD9\u662F\u7528\u6765\u8BBE\u7F6E\u662F\u5426\u4E3A\u5B66\u751F\u7684\u3002 \ No newline at end of file