From 03562267356656c74b945178477fcdd8db6b219d Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Fri, 18 Aug 2017 09:26:15 +0800 Subject: [PATCH 1/9] fix --- designer_base/src/com/fr/design/extra/PluginHelper.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginHelper.java b/designer_base/src/com/fr/design/extra/PluginHelper.java index 613d887e7..cab0a6dbd 100644 --- a/designer_base/src/com/fr/design/extra/PluginHelper.java +++ b/designer_base/src/com/fr/design/extra/PluginHelper.java @@ -20,6 +20,7 @@ import com.fr.plugin.dependence.PluginDependenceException; import com.fr.plugin.dependence.PluginDependenceUnit; import com.fr.stable.ArrayUtils; import com.fr.stable.EncodeConstants; +import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.plugin.PluginConstants; @@ -120,7 +121,7 @@ public class PluginHelper { */ public static Plugin readPlugin(File chosenFile) throws Exception { // 需要先删除临时目录保证加压出来的文件不会和安装失败的文件混合到一起 - StableUtils.deleteFile(new File(TEMP_PATH)) + StableUtils.deleteFile(new File(TEMP_PATH)); IOUtils.unzip(chosenFile, TEMP_PATH); File pluginFileDir = getTempPluginFileDirectory(); @@ -292,7 +293,7 @@ public class PluginHelper { private static boolean isHigherEnvVersion(String envVersion) { //高于8.0 - return PluginUtils.compareVersion(envVersion, "8.0") > 0; + return PluginUtils.compareVersion(envVersion, ProductConstants.MAIN_VERSION) > 0; } /** From 5aa527e37e6ace165e5c9d6070ddbfa77a2d199c Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Fri, 18 Aug 2017 11:07:52 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E6=B7=BB=E5=8A=A0Env=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8C=BA=E9=97=B4=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/fr/design/extra/PluginHelper.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginHelper.java b/designer_base/src/com/fr/design/extra/PluginHelper.java index cab0a6dbd..e79231a3a 100644 --- a/designer_base/src/com/fr/design/extra/PluginHelper.java +++ b/designer_base/src/com/fr/design/extra/PluginHelper.java @@ -15,6 +15,8 @@ import com.fr.plugin.PluginConfigManager; import com.fr.plugin.PluginLoader; import com.fr.plugin.PluginManagerHelper; import com.fr.plugin.PluginUtils; +import com.fr.plugin.basic.Version; +import com.fr.plugin.basic.VersionIntervalFactory; import com.fr.plugin.dependence.PluginDependence; import com.fr.plugin.dependence.PluginDependenceException; import com.fr.plugin.dependence.PluginDependenceUnit; @@ -274,7 +276,7 @@ public class PluginHelper { FRLogger.getLogger().error(jarExpiredInfo); throw new com.fr.plugin.PluginVerifyException(jarExpiredInfo); } - if (isHigherEnvVersion(plugin.getEnvVersion())) { + if (!isSupportCurrentEnv(plugin.getEnvVersion())) { String envVersionNotSupport = Inter.getLocText(new String[]{"FR-Designer-Plugin_Env_Expired", ",", "FR-Designer-Plugin_Install_Failed"}); FRLogger.getLogger().error(envVersionNotSupport); throw new com.fr.plugin.PluginVerifyException(envVersionNotSupport); @@ -291,9 +293,9 @@ public class PluginHelper { } } - private static boolean isHigherEnvVersion(String envVersion) { - //高于8.0 - return PluginUtils.compareVersion(envVersion, ProductConstants.MAIN_VERSION) > 0; + private static boolean isSupportCurrentEnv(String envVersion) { + //包含8.0 + return !VersionIntervalFactory.create(envVersion).contain(Version.currentEnvVersion()); } /** From c465dc4b106ad734b52c73b738d525c377e8ae70 Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Fri, 18 Aug 2017 11:10:24 +0800 Subject: [PATCH 3/9] pmd --- designer_base/src/com/fr/design/extra/PluginHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/extra/PluginHelper.java b/designer_base/src/com/fr/design/extra/PluginHelper.java index e79231a3a..2524412c0 100644 --- a/designer_base/src/com/fr/design/extra/PluginHelper.java +++ b/designer_base/src/com/fr/design/extra/PluginHelper.java @@ -295,7 +295,7 @@ public class PluginHelper { private static boolean isSupportCurrentEnv(String envVersion) { //包含8.0 - return !VersionIntervalFactory.create(envVersion).contain(Version.currentEnvVersion()); + return VersionIntervalFactory.create(envVersion).contain(Version.currentEnvVersion()); } /** From 06fcc30d00e2e1e6bc88b1b36e8a3f2e4a46692a Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Fri, 18 Aug 2017 11:11:51 +0800 Subject: [PATCH 4/9] pmd --- designer_base/src/com/fr/design/extra/PluginHelper.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginHelper.java b/designer_base/src/com/fr/design/extra/PluginHelper.java index 2524412c0..65cd74a2c 100644 --- a/designer_base/src/com/fr/design/extra/PluginHelper.java +++ b/designer_base/src/com/fr/design/extra/PluginHelper.java @@ -14,15 +14,13 @@ import com.fr.plugin.Plugin; import com.fr.plugin.PluginConfigManager; import com.fr.plugin.PluginLoader; import com.fr.plugin.PluginManagerHelper; -import com.fr.plugin.PluginUtils; -import com.fr.plugin.basic.Version; -import com.fr.plugin.basic.VersionIntervalFactory; +import com.fr.plugin.basic.version.Version; +import com.fr.plugin.basic.version.VersionIntervalFactory; import com.fr.plugin.dependence.PluginDependence; import com.fr.plugin.dependence.PluginDependenceException; import com.fr.plugin.dependence.PluginDependenceUnit; import com.fr.stable.ArrayUtils; import com.fr.stable.EncodeConstants; -import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.plugin.PluginConstants; From 78f790501594a656cfc3a535241c1448ffcd3b1f Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Fri, 18 Aug 2017 14:11:16 +0800 Subject: [PATCH 5/9] =?UTF-8?q?PFC-607=20=E6=8F=92=E4=BB=B6=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=88=A0=E9=99=A4=E6=9B=B4=E6=96=B0=E4=B8=8D=E9=87=8D?= =?UTF-8?q?=E5=90=AF=E6=94=AF=E6=8C=81=20=E7=A7=BB=E6=A4=8D9.0=E7=9A=84?= =?UTF-8?q?=E5=8A=A0=E5=AF=86=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/start/BaseDesigner.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/designer_base/src/com/fr/start/BaseDesigner.java b/designer_base/src/com/fr/start/BaseDesigner.java index 4c98ea199..49c49d9b5 100644 --- a/designer_base/src/com/fr/start/BaseDesigner.java +++ b/designer_base/src/com/fr/start/BaseDesigner.java @@ -24,6 +24,7 @@ import com.fr.file.FILEFactory; import com.fr.file.FileFILE; import com.fr.general.*; import com.fr.plugin.PluginCollector; +import com.fr.plugin.manager.PluginManager; import com.fr.stable.*; import javax.swing.*; @@ -83,6 +84,8 @@ public abstract class BaseDesigner extends ToolBarMenuDock { DesignUtils.initLookAndFeel(); DesignUtils.creatListeningServer(getStartPort(), startFileSuffix()); + //初始化插件引擎 + PluginManager.init(); // 初始化Log Handler DesignerEnvManager.loadLogSetting(); DesignerFrame df = createDesignerFrame(); From ba2a78b8aefa1929877c9f3621c00dcaf74a7f33 Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Fri, 18 Aug 2017 14:39:39 +0800 Subject: [PATCH 6/9] pmd --- designer_base/src/com/fr/design/extra/PluginHelper.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginHelper.java b/designer_base/src/com/fr/design/extra/PluginHelper.java index 65cd74a2c..c0aeff8e7 100644 --- a/designer_base/src/com/fr/design/extra/PluginHelper.java +++ b/designer_base/src/com/fr/design/extra/PluginHelper.java @@ -20,6 +20,7 @@ import com.fr.plugin.dependence.PluginDependence; import com.fr.plugin.dependence.PluginDependenceException; import com.fr.plugin.dependence.PluginDependenceUnit; import com.fr.stable.ArrayUtils; +import com.fr.stable.AssistUtils; import com.fr.stable.EncodeConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; @@ -133,7 +134,7 @@ public class PluginHelper { File[] pluginFiles = pluginFileDir.listFiles(); if (ArrayUtils.isNotEmpty(pluginFiles)) { for (File f : pluginFiles) { - if (f.getName().equals("plugin.xml")) { + if (AssistUtils.equals(f.getName(), "plugin.xml")) { plugin = new Plugin(); InputStream inputStream = plugin.readEncryptXml(new FileInputStream(f)); XMLTools.readInputStreamXML(plugin, inputStream); @@ -323,7 +324,7 @@ public class PluginHelper { File[] files = dir.listFiles(); if (ArrayUtils.isNotEmpty(files)) { for (File f : files) { - if ("plugin.xml".equals(f.getName())) { + if (AssistUtils.equals("plugin.xml",f.getName())) { return true; } } From ba1e541f1458248b2e8365c0fbe9bca9048888d3 Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Fri, 18 Aug 2017 14:40:19 +0800 Subject: [PATCH 7/9] pmd --- designer_base/src/com/fr/design/extra/PluginHelper.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginHelper.java b/designer_base/src/com/fr/design/extra/PluginHelper.java index c0aeff8e7..dcf5a6c89 100644 --- a/designer_base/src/com/fr/design/extra/PluginHelper.java +++ b/designer_base/src/com/fr/design/extra/PluginHelper.java @@ -283,12 +283,11 @@ public class PluginHelper { File fileToCheck = getTempPluginFileDirectory(); File oldfile = new File(StableUtils.pathJoin(FRContext.getCurrentEnv().getPath(), ProjectConstants.PLUGINS_NAME, "plugin-" + plugin.getId())); - if (!PluginManagerHelper.checkLic(plugin, fileToCheck)) { - if (!PluginManagerHelper.checkLic(plugin, oldfile)) {//安装时,在安装目录下和压缩包里都没有才弹框 + if (!PluginManagerHelper.checkLic(plugin, fileToCheck) && !PluginManagerHelper.checkLic(plugin, oldfile)) { + //安装时,在安装目录下和压缩包里都没有才弹框 String checkLicFail = Inter.getLocText("FR-Designer-PluginLicense_Check_Failed"); FRLogger.getLogger().error(checkLicFail); throw new com.fr.plugin.PluginVerifyException(checkLicFail); - } } } From 2a5a2e10054f78574975f94e22794e9a32a56797 Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Fri, 18 Aug 2017 14:40:43 +0800 Subject: [PATCH 8/9] pmd --- designer_base/src/com/fr/design/extra/PluginHelper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/designer_base/src/com/fr/design/extra/PluginHelper.java b/designer_base/src/com/fr/design/extra/PluginHelper.java index dcf5a6c89..0d7bc4eac 100644 --- a/designer_base/src/com/fr/design/extra/PluginHelper.java +++ b/designer_base/src/com/fr/design/extra/PluginHelper.java @@ -307,7 +307,7 @@ public class PluginHelper { File[] files = file.listFiles(); if (ArrayUtils.isNotEmpty(files)) { for (File f : files) { - if (foundConfigFile(f)) { + if (hasFoundConfigFile(f)) { return f; } } @@ -316,7 +316,7 @@ public class PluginHelper { return null; } - private static boolean foundConfigFile(File dir) { + private static boolean hasFoundConfigFile(File dir) { if (!dir.isDirectory()) { return false; } From c9e30586ecf68c7ae092db9f19b385b0705ae78b Mon Sep 17 00:00:00 2001 From: juhaoyu <2335173323@qq.com> Date: Fri, 18 Aug 2017 14:40:58 +0800 Subject: [PATCH 9/9] pmd --- designer_base/src/com/fr/design/extra/PluginHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer_base/src/com/fr/design/extra/PluginHelper.java b/designer_base/src/com/fr/design/extra/PluginHelper.java index 0d7bc4eac..c2bb480ec 100644 --- a/designer_base/src/com/fr/design/extra/PluginHelper.java +++ b/designer_base/src/com/fr/design/extra/PluginHelper.java @@ -86,7 +86,7 @@ public class PluginHelper { } } - private static boolean invalidUser(String id, String username, String password) { + private static boolean isInvalidUser(String id, String username, String password) { if (StringUtils.isEmpty(id)) { return false; } else if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)){