commit 02203de000dd4ce0790467f3bd7f1e7d67f946fc Author: richie Date: Wed Jul 3 15:39:42 2019 +0800 提交插件开发项目工程配置 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1bf50a6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +*.iml +.idea/ +/target/ +/download/ +/webroot/ +.DS_Store \ No newline at end of file diff --git a/plugin-function/build.xml b/plugin-function/build.xml new file mode 100644 index 0000000..7a6dc84 --- /dev/null +++ b/plugin-function/build.xml @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/plugin-function/lib/gson-2.3.1.jar b/plugin-function/lib/gson-2.3.1.jar new file mode 100644 index 0000000..250132c Binary files /dev/null and b/plugin-function/lib/gson-2.3.1.jar differ diff --git a/plugin-function/lib/report/.gitkeep b/plugin-function/lib/report/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/plugin-function/plugin.xml b/plugin-function/plugin.xml new file mode 100644 index 0000000..a45d02f --- /dev/null +++ b/plugin-function/plugin.xml @@ -0,0 +1,19 @@ + + com.fr.plugin.function.test + + yes + 1.0 + 10.0 + 2018-07-31 + author + + + [2018-07-31]初始化插件。
+ ]]>
+ + + + + +
\ No newline at end of file diff --git a/plugin-function/pom.xml b/plugin-function/pom.xml new file mode 100644 index 0000000..f45aea2 --- /dev/null +++ b/plugin-function/pom.xml @@ -0,0 +1,27 @@ + + + 4.0.0 + + + com.fr.plugin + starter + 10.0 + + jar + plugin-function + + + com.fr.plugin + gson + 1.0 + system + ${project.basedir}/lib/gson-2.3.1.jar + + + + + ${project.basedir}/../webroot/WEB-INF/plugins/plugin-com.fr.plugin.function.test-1.0/classes + + \ No newline at end of file diff --git a/plugin-function/src/main/java/com/fr/plugin/MyAbs.java b/plugin-function/src/main/java/com/fr/plugin/MyAbs.java new file mode 100644 index 0000000..ffddecc --- /dev/null +++ b/plugin-function/src/main/java/com/fr/plugin/MyAbs.java @@ -0,0 +1,47 @@ +package com.fr.plugin; + +import com.fr.general.FArray; +import com.fr.general.GeneralUtils; +import com.fr.intelli.record.Focus; +import com.fr.intelli.record.Original; +import com.fr.plugin.context.PluginContexts; +import com.fr.record.analyzer.EnableMetrics; +import com.fr.script.AbstractFunction; +import com.fr.stable.ArrayUtils; +import com.fr.stable.Primitive; +import com.fr.stable.fun.Authorize; + +@EnableMetrics +@Authorize(callSignKey = MyFunctionConstants.PLUGIN_ID) +public class MyAbs extends AbstractFunction { + + @Focus(id = "com.fr.plugin.function.test", text = "Plugin-Test_Function_Abs", source = Original.PLUGIN) + public Object run(Object[] args) { + if (!PluginContexts.currentContext().isAvailable()) { + return "Error:authorization is expired."; + } + int len = ArrayUtils.getLength(args); + if (len == 0) { + return Primitive.ERROR_VALUE; + } else if (len == 1) { + Object one = args[0]; + if (one instanceof FArray) { + FArray data = (FArray)one; + FArray result = new FArray(); + for (Object el : data) { + result.add(Math.abs(GeneralUtils.objectToNumber(el).doubleValue())); + } + return result; + } else { + return Math.abs(GeneralUtils.objectToNumber(one).doubleValue()); + } + } else { + FArray result = new FArray(); + for (Object arg : args) { + result.add(Math.abs(GeneralUtils.objectToNumber(arg).doubleValue())); + } + return result; + } + + } +} diff --git a/plugin-function/src/main/java/com/fr/plugin/MyFunctionConstants.java b/plugin-function/src/main/java/com/fr/plugin/MyFunctionConstants.java new file mode 100644 index 0000000..2d7d4a6 --- /dev/null +++ b/plugin-function/src/main/java/com/fr/plugin/MyFunctionConstants.java @@ -0,0 +1,6 @@ +package com.fr.plugin; + +public class MyFunctionConstants { + + public static final String PLUGIN_ID = "com.fr.plugin.function.test"; +} diff --git a/plugin-function/src/main/java/com/fr/plugin/MyLocaleFinder.java b/plugin-function/src/main/java/com/fr/plugin/MyLocaleFinder.java new file mode 100644 index 0000000..a062cd1 --- /dev/null +++ b/plugin-function/src/main/java/com/fr/plugin/MyLocaleFinder.java @@ -0,0 +1,10 @@ +package com.fr.plugin; + +import com.fr.stable.fun.impl.AbstractLocaleFinder; + +public class MyLocaleFinder extends AbstractLocaleFinder { + @Override + public String find() { + return "com/fr/plugin/demo"; + } +} diff --git a/plugin-function/src/main/resources/com/fr/plugin/demo.properties b/plugin-function/src/main/resources/com/fr/plugin/demo.properties new file mode 100644 index 0000000..9bc5f29 --- /dev/null +++ b/plugin-function/src/main/resources/com/fr/plugin/demo.properties @@ -0,0 +1 @@ +Plugin-Test_Function_Abs=Test ABS \ No newline at end of file diff --git a/plugin-function/src/main/resources/com/fr/plugin/demo_zh_CN.properties b/plugin-function/src/main/resources/com/fr/plugin/demo_zh_CN.properties new file mode 100644 index 0000000..aa910e8 --- /dev/null +++ b/plugin-function/src/main/resources/com/fr/plugin/demo_zh_CN.properties @@ -0,0 +1 @@ +Plugin-Test_Function_Abs=测试ABS函数 \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..8d66398 --- /dev/null +++ b/pom.xml @@ -0,0 +1,227 @@ + + 4.0.0 + com.fr.plugin + starter + 10.0 + pom + + 10.0-RELEASE-SNAPSHOT + ${project.basedir}/webroot/WEB-INF + + + plugin-function + + + + + com.fr.third + fine-third + ${common-version} + + + com.fr.activator + fine-activator + ${common-version} + compile + + + com.fr.core + fine-core + ${common-version} + compile + + + com.fr.webui + fine-webui + ${common-version} + compile + + + + com.fr.datasource + fine-datasource + ${common-version} + compile + + + + com.fr.decision + fine-decision + ${common-version} + compile + + + com.fr.decision + fine-decision-report + ${common-version} + compile + + + + com.fr.schedule + fine-schedule + ${common-version} + compile + + + com.fr.schedule + fine-schedule-report + ${common-version} + compile + + + + + com.fr.intelligence + fine-swift + ${common-version} + compile + + + com.fr.intelligence + fine-accumulator + ${common-version} + compile + + + + com.fr.report + fine-report-engine + ${common-version} + compile + + + + com.fr.report + fine-report-designer + ${common-version} + compile + + + + + io.socket + socket.io-client + 0.7.0 + compile + + + + + org.aspectj + aspectjrt + 1.6.9 + compile + + + + + org.swingexplorer + swexpl + 2.0 + + + org.swingexplorer + swag + 1.0 + + + + + org.apache.tomcat + tomcat-catalina + 8.5.32 + + + + + mysql + mysql-connector-java + 5.1.44 + + + + com.fr.third + jxbrowser + 6.23.1 + + + + com.fr.third + jxbrowser-mac + 6.23.1 + + + + junit + junit + 4.12 + test + + + org.easymock + easymock + 3.5.1 + test + + + + + ${web-inf-bucket}/classes + + + maven-compiler-plugin + 3.1 + + 1.6 + 1.6 + + none + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy + package + + copy-dependencies + + + + ${project.basedir}/webroot/WEB-INF/lib + + + + + + + + + + fanruan + fanruan + http://mvn.finedevelop.com/repository/maven-public/ + + true + always + warn + + + + + + fanruan + fanruan + http://mvn.finedevelop.com/repository/maven-public/ + + true + always + warn + + + + \ No newline at end of file diff --git a/src/main/java/com/fr/learn/Leaner.java b/src/main/java/com/fr/learn/Leaner.java new file mode 100644 index 0000000..c35f2ab --- /dev/null +++ b/src/main/java/com/fr/learn/Leaner.java @@ -0,0 +1,16 @@ +package com.fr.learn; + +import com.fr.start.Designer; + +public class Leaner extends Designer { + + static { + // 这段代码让插件能支持远程设计的时候的调试 + String workDir = System.getProperty("user.dir"); + System.setProperty("fine.plugin.home", workDir + "/webroot/WEB-INF/plugins"); + } + + public Leaner(String[] strings) { + super(strings); + } +} diff --git a/src/main/java/com/fr/learn/Learner4Debug.java b/src/main/java/com/fr/learn/Learner4Debug.java new file mode 100644 index 0000000..94b77f6 --- /dev/null +++ b/src/main/java/com/fr/learn/Learner4Debug.java @@ -0,0 +1,8 @@ +package com.fr.learn; + +public class Learner4Debug { + + public static void main(String... args) { + org.swingexplorer.Launcher.main(new String[]{"com.fr.start.Designer"}); + } +}