From a08102422f6fdf90f4ca5f3d4951e69b6fc19e5d Mon Sep 17 00:00:00 2001 From: richie Date: Thu, 22 Nov 2018 14:06:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BE=9B=E9=85=8D=E7=BD=AE=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 5 + build.xml | 130 ++++++++++++++++++ lib/report/.gitkeep | 0 plugin.xml | 15 ++ pom.xml | 18 +++ .../conf/demo/simple/PluginSimpleConfig.java | 58 ++++++++ 6 files changed, 226 insertions(+) create mode 100644 .gitignore create mode 100644 build.xml create mode 100644 lib/report/.gitkeep create mode 100644 plugin.xml create mode 100644 pom.xml create mode 100644 src/main/java/com/fr/conf/demo/simple/PluginSimpleConfig.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d91e065 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +*.iml +.idea/ +lib/report/*.jar +.DS_Store +.classpath \ No newline at end of file diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..86a0542 --- /dev/null +++ b/build.xml @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lib/report/.gitkeep b/lib/report/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/plugin.xml b/plugin.xml new file mode 100644 index 0000000..e773956 --- /dev/null +++ b/plugin.xml @@ -0,0 +1,15 @@ + + com.fr.conf.demo.simple + com.fr.conf.demo.simple + + yes + 1。0 + 10.0 + 2018-10-20 + author + + + ]]> + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..0874556 --- /dev/null +++ b/pom.xml @@ -0,0 +1,18 @@ + + + 4.0.0 + + + com.fr.plugin + starter + 10.0 + + jar + demo-simple-config + + + ${project.basedir}/../webroot/WEB-INF/plugins/plugin-com.fr.conf.demo.simple-1.0/classes + + \ No newline at end of file diff --git a/src/main/java/com/fr/conf/demo/simple/PluginSimpleConfig.java b/src/main/java/com/fr/conf/demo/simple/PluginSimpleConfig.java new file mode 100644 index 0000000..7b2bc05 --- /dev/null +++ b/src/main/java/com/fr/conf/demo/simple/PluginSimpleConfig.java @@ -0,0 +1,58 @@ +package com.fr.conf.demo.simple; + +import com.fr.config.ConfigContext; +import com.fr.config.DefaultConfiguration; +import com.fr.config.Identifier; +import com.fr.config.Status; +import com.fr.config.Visualization; +import com.fr.config.holder.Conf; +import com.fr.config.holder.factory.Holders; +import com.fr.intelli.record.Focus; +import com.fr.intelli.record.Original; +import com.fr.record.analyzer.EnableMetrics; +import com.fr.stable.StringUtils; + +@Visualization(category = "Plugin") +@EnableMetrics +public class PluginSimpleConfig extends DefaultConfiguration { + + private static volatile PluginSimpleConfig config = null; + + @Focus(id="com.fr.conf.demo.simple", text = "Plugin-Config_Demo", source = Original.PLUGIN) + public static PluginSimpleConfig getInstance() { + if (config == null) { + config = ConfigContext.getConfigInstance(PluginSimpleConfig.class); + } + return config; + } + + @Identifier(value = "text", name = "Plugin-Config_Property_Text", description = "Plugin-Config_Property_Text_Description", group = "Plugin", 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) + private Conf count = Holders.simple(100); + + public String getText() { + return text.get(); + } + + public void setText(String text) { + this.text.set(text); + } + + public int getCount() { + return count.get(); + } + + public void setCount(int count) { + this.count.set(count); + } + + @Override + public Object clone() throws CloneNotSupportedException { + PluginSimpleConfig cloned = (PluginSimpleConfig) super.clone(); + cloned.text = (Conf) text.clone(); + cloned.count = (Conf) count.clone(); + return cloned; + } +}