commit a08102422f6fdf90f4ca5f3d4951e69b6fc19e5d Author: richie Date: Thu Nov 22 14:06:01 2018 +0800 提供配置示例 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; + } +}