From 62ddc9a4e2ab6fc98d35a5a8e3586b9bf7cea0d6 Mon Sep 17 00:00:00 2001 From: zjz1993 <1429595365@qq.com> Date: Fri, 30 Aug 2019 16:16:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E4=B8=80=E4=BA=9B=E8=A1=A5=E5=85=85?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/fr/plugin/db/redis/core/DataWrapper.java | 3 ++- .../fr/plugin/db/redis/core/RedisDatabaseConnection.java | 4 ++-- .../com/fr/plugin/db/redis/core/RedisScriptTableData.java | 6 +++--- .../java/com/fr/plugin/db/redis/core/RedisTableData.java | 6 +++--- .../com/fr/plugin/db/redis/core/RedisTableDataModel.java | 6 ++---- .../db/redis/core/pool/RedisConnectionPoolConfig.java | 1 - src/main/java/com/fr/plugin/db/redis/help/Files.java | 4 ++-- .../com/fr/plugin/db/redis/ui/RedisBaseTableDataPane.java | 1 + src/main/java/com/fr/plugin/db/redis/ui/RedisQueryPane.java | 4 ++-- .../com/fr/plugin/db/redis/ui/RedisScriptTableDataPane.java | 4 ++-- .../java/com/fr/plugin/db/redis/ui/RedisTableDataPane.java | 4 ++-- .../java/com/fr/plugin/db/redis/ui/value/IntegerEditor.java | 4 ++-- 12 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/fr/plugin/db/redis/core/DataWrapper.java b/src/main/java/com/fr/plugin/db/redis/core/DataWrapper.java index 27a0e6a..95694f5 100644 --- a/src/main/java/com/fr/plugin/db/redis/core/DataWrapper.java +++ b/src/main/java/com/fr/plugin/db/redis/core/DataWrapper.java @@ -6,6 +6,7 @@ import com.fanruan.api.util.IOKit; import com.fanruan.api.script.ScriptKit; import com.fanruan.api.util.StringKit; import com.fr.workspace.WorkContext; +import com.fanruan.api.runtime.EnvKit; import javax.script.ScriptEngine; import javax.script.ScriptException; @@ -98,6 +99,6 @@ public class DataWrapper { } private String readAndRenderScriptFile(String filePath) { - return filePath.replaceFirst("\\$ENV_HOME", WorkContext.getCurrent().getPath()); + return filePath.replaceFirst("\\$ENV_HOME", EnvKit.getCurrent().getPath()); } } diff --git a/src/main/java/com/fr/plugin/db/redis/core/RedisDatabaseConnection.java b/src/main/java/com/fr/plugin/db/redis/core/RedisDatabaseConnection.java index 265c4d0..672973b 100755 --- a/src/main/java/com/fr/plugin/db/redis/core/RedisDatabaseConnection.java +++ b/src/main/java/com/fr/plugin/db/redis/core/RedisDatabaseConnection.java @@ -8,7 +8,7 @@ import com.fanruan.api.i18n.I18nKit; import com.fr.plugin.db.redis.core.emb.Redis; import com.fanruan.api.security.SecurityKit; import com.fanruan.api.util.ArrayKit; -import com.fanruan.api.util.ReflectKit; +import com.fanruan.api.util.TypeKit; import com.fanruan.api.util.StringKit; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLableReader; @@ -105,7 +105,7 @@ public class RedisDatabaseConnection extends AbstractDatabaseConnection { @Override public void addConnection(List list, String connectionName, Class[] acceptTypes) { for (Class accept : acceptTypes) { - if (ReflectKit.classInstanceOf(getClass(), accept)) { + if (TypeKit.classInstanceOf(getClass(), accept)) { list.add(connectionName); break; } diff --git a/src/main/java/com/fr/plugin/db/redis/core/RedisScriptTableData.java b/src/main/java/com/fr/plugin/db/redis/core/RedisScriptTableData.java index f1529f8..26d9702 100644 --- a/src/main/java/com/fr/plugin/db/redis/core/RedisScriptTableData.java +++ b/src/main/java/com/fr/plugin/db/redis/core/RedisScriptTableData.java @@ -7,7 +7,7 @@ import com.fr.config.holder.factory.XmlHolders; import com.fr.data.AbstractParameterTableData; import com.fanruan.api.xml.XmlKit; import com.fr.data.impl.Connection; -import com.fanruan.api.database.nameDatabase.NameDatabaseConnection; +import com.fanruan.api.database.nameDatabase.NameReference; import com.fanruan.api.data.ConnectionKit; import com.fr.general.data.DataModel; import com.fanruan.api.xml.XmlKit; @@ -77,8 +77,8 @@ public class RedisScriptTableData extends AbstractParameterTableData { long start = System.currentTimeMillis(); Parameter[] ps = Parameter.providers2Parameter(getParameters(calculator)); Connection connection = database.get(); - if (connection instanceof NameDatabaseConnection) { - String name = ((NameDatabaseConnection) connection).getName(); + if (connection instanceof NameReference) { + String name = ((NameReference) connection).getName(); RedisDatabaseConnection rc = ConnectionKit.getConnection(name, RedisDatabaseConnection.class); if (rc != null) { OrderValue orderValue = dbIndex.get(); diff --git a/src/main/java/com/fr/plugin/db/redis/core/RedisTableData.java b/src/main/java/com/fr/plugin/db/redis/core/RedisTableData.java index 6d120ab..02b9f1d 100644 --- a/src/main/java/com/fr/plugin/db/redis/core/RedisTableData.java +++ b/src/main/java/com/fr/plugin/db/redis/core/RedisTableData.java @@ -7,7 +7,7 @@ import com.fr.config.holder.factory.XmlHolders; import com.fr.data.AbstractParameterTableData; import com.fanruan.api.xml.XmlKit; import com.fr.data.impl.Connection; -import com.fanruan.api.database.nameDatabase.NameDatabaseConnection; +import com.fanruan.api.database.nameDatabase.NameReference; import com.fanruan.api.data.ConnectionKit; import com.fr.general.data.DataModel; import com.fanruan.api.xml.XmlKit; @@ -87,8 +87,8 @@ public class RedisTableData extends AbstractParameterTableData { long start = System.currentTimeMillis(); Parameter[] ps = Parameter.providers2Parameter(getParameters(calculator)); Connection connection = database.get(); - if (connection instanceof NameDatabaseConnection) { - String name = ((NameDatabaseConnection) connection).getName(); + if (connection instanceof NameReference) { + String name = ((NameReference) connection).getName(); RedisDatabaseConnection rc = ConnectionKit.getConnection(name, RedisDatabaseConnection.class); if (rc != null) { OrderValue orderValue = dbIndex.get(); diff --git a/src/main/java/com/fr/plugin/db/redis/core/RedisTableDataModel.java b/src/main/java/com/fr/plugin/db/redis/core/RedisTableDataModel.java index a703cd3..1f4a306 100755 --- a/src/main/java/com/fr/plugin/db/redis/core/RedisTableDataModel.java +++ b/src/main/java/com/fr/plugin/db/redis/core/RedisTableDataModel.java @@ -3,8 +3,7 @@ package com.fr.plugin.db.redis.core; import com.fr.stable.ParameterProvider; import com.fr.data.AbstractDataModel; import com.fanruan.api.log.LogKit; -import com.fr.plugin.PluginLicense; -import com.fr.plugin.PluginLicenseManager; +import com.fanruan.api.runtime.PluginKit; import com.fr.plugin.db.redis.core.emb.Redis; import com.fr.plugin.db.redis.core.visit.VisitorFactory; import com.fr.plugin.db.redis.util.RedisUtils; @@ -19,8 +18,7 @@ public class RedisTableDataModel extends AbstractDataModel { private List> data; public RedisTableDataModel(Calculator calculator, Parameter[] ps, RedisDatabaseConnection mc, int dbIndex, String query, String script, int rowCount) { - PluginLicense pluginLicense = PluginLicenseManager.getInstance().getPluginLicenseByID(RedisConstants.PLUGIN_ID); - if (pluginLicense.isAvailable()) { + if (PluginKit.isCurrentPluginAvailable()) { initRedisData(calculator, ps, mc, dbIndex, query, script, rowCount); } else { throw new RuntimeException("Redis Plugin License Expired!"); diff --git a/src/main/java/com/fr/plugin/db/redis/core/pool/RedisConnectionPoolConfig.java b/src/main/java/com/fr/plugin/db/redis/core/pool/RedisConnectionPoolConfig.java index ed8ab16..bcabc7c 100644 --- a/src/main/java/com/fr/plugin/db/redis/core/pool/RedisConnectionPoolConfig.java +++ b/src/main/java/com/fr/plugin/db/redis/core/pool/RedisConnectionPoolConfig.java @@ -5,7 +5,6 @@ import com.fanruan.api.conf.BaseConfiguration; import com.fanruan.api.conf.HolderKit; import com.fr.config.holder.Conf; -import javax.xml.ws.Holder; /** * @author richie diff --git a/src/main/java/com/fr/plugin/db/redis/help/Files.java b/src/main/java/com/fr/plugin/db/redis/help/Files.java index d4d21e2..9f3fa12 100644 --- a/src/main/java/com/fr/plugin/db/redis/help/Files.java +++ b/src/main/java/com/fr/plugin/db/redis/help/Files.java @@ -2,7 +2,7 @@ package com.fr.plugin.db.redis.help; import com.eclipsesource.v8.V8; import com.fanruan.api.util.IOKit; -import com.fanruan.api.consts.EncodeConstantsKit; +import com.fanruan.api.macro.EncodeConstants; import java.io.InputStream; import java.io.UnsupportedEncodingException; @@ -25,7 +25,7 @@ public class Files { InputStream in = IOKit.read(filePath); if (in != null) { try { - v8.executeVoidScript(IOKit.inputStream2String(in, EncodeConstantsKit.ENCODING_UTF_8)); + v8.executeVoidScript(IOKit.inputStream2String(in, EncodeConstants.ENCODING_UTF_8)); } catch (UnsupportedEncodingException ignore) { } diff --git a/src/main/java/com/fr/plugin/db/redis/ui/RedisBaseTableDataPane.java b/src/main/java/com/fr/plugin/db/redis/ui/RedisBaseTableDataPane.java index a5382a8..4456a57 100644 --- a/src/main/java/com/fr/plugin/db/redis/ui/RedisBaseTableDataPane.java +++ b/src/main/java/com/fr/plugin/db/redis/ui/RedisBaseTableDataPane.java @@ -13,6 +13,7 @@ import com.fanruan.api.design.ui.component.table.UITableEditorPane; import com.fanruan.api.design.ui.component.UIToolbar; import com.fanruan.api.design.DesignKit; import com.fr.design.menu.ToolBarDef; +import com.fanruan.api.design.ui.toolbar.ToolBarDef; import com.fr.plugin.db.redis.core.order.OrderValue; import com.fanruan.api.util.ArrayKit; import com.fr.stable.ParameterProvider; diff --git a/src/main/java/com/fr/plugin/db/redis/ui/RedisQueryPane.java b/src/main/java/com/fr/plugin/db/redis/ui/RedisQueryPane.java index 21733f8..e86fa50 100755 --- a/src/main/java/com/fr/plugin/db/redis/ui/RedisQueryPane.java +++ b/src/main/java/com/fr/plugin/db/redis/ui/RedisQueryPane.java @@ -12,7 +12,7 @@ import com.fr.design.gui.itextarea.DescriptionTextArea; import com.fanruan.api.design.ui.component.code.UISyntaxTextArea; import com.fanruan.api.design.ui.component.code.SyntaxConstants; import com.fanruan.api.design.DesignKit; -import com.fr.general.SiteCenter; +import com.fanruan.api.net.CloudKit; import com.fr.plugin.db.redis.core.order.OrderValue; import com.fr.plugin.db.redis.ui.value.IndexValuePaneFactory; import com.fr.plugin.db.redis.util.RedisDesignUtils; @@ -44,7 +44,7 @@ public class RedisQueryPane extends BasicPane { @Override public void actionPerformed(ActionEvent e) { try { - Desktop.getDesktop().browse(URI.create(SiteCenter.getInstance().acquireUrlByKind("help.redis"))); + Desktop.getDesktop().browse(URI.create(CloudKit.acquireUrlByKind("help.redis"))); } catch (IOException e1) { LogKit.error(e1.getMessage(), e1); } diff --git a/src/main/java/com/fr/plugin/db/redis/ui/RedisScriptTableDataPane.java b/src/main/java/com/fr/plugin/db/redis/ui/RedisScriptTableDataPane.java index 34b814e..3a91645 100644 --- a/src/main/java/com/fr/plugin/db/redis/ui/RedisScriptTableDataPane.java +++ b/src/main/java/com/fr/plugin/db/redis/ui/RedisScriptTableDataPane.java @@ -1,6 +1,6 @@ package com.fr.plugin.db.redis.ui; -import com.fanruan.api.database.nameDatabase.NameDatabaseConnection; +import com.fanruan.api.database.nameDatabase.NameReference; import com.fr.plugin.db.redis.core.RedisScriptTableData; import com.fr.plugin.db.redis.core.order.OrderValue; import com.fr.script.Calculator; @@ -62,7 +62,7 @@ public class RedisScriptTableDataPane extends RedisBaseTableDataPane parameterList = editorPane.update(); ParameterProvider[] parameters = parameterList.toArray(new ParameterProvider[parameterList.size()]); diff --git a/src/main/java/com/fr/plugin/db/redis/ui/RedisTableDataPane.java b/src/main/java/com/fr/plugin/db/redis/ui/RedisTableDataPane.java index 0a2c691..8fb843f 100755 --- a/src/main/java/com/fr/plugin/db/redis/ui/RedisTableDataPane.java +++ b/src/main/java/com/fr/plugin/db/redis/ui/RedisTableDataPane.java @@ -1,7 +1,7 @@ package com.fr.plugin.db.redis.ui; import com.fanruan.api.design.DesignKit; -import com.fanruan.api.database.nameDatabase.NameDatabaseConnection; +import com.fanruan.api.database.nameDatabase.NameReference; import com.fr.plugin.db.redis.core.RedisTableData; import com.fr.plugin.db.redis.core.order.OrderValue; import com.fr.script.Calculator; @@ -69,7 +69,7 @@ public class RedisTableDataPane extends RedisBaseTableDataPane { String connectionName = chosePane.getSelectRedisConnectionName(); if (StringKit.isNotEmpty(connectionName)) { - tableData.setDatabase(new NameDatabaseConnection(connectionName)); + tableData.setDatabase(new NameReference(connectionName)); } List parameterList = editorPane.update(); diff --git a/src/main/java/com/fr/plugin/db/redis/ui/value/IntegerEditor.java b/src/main/java/com/fr/plugin/db/redis/ui/value/IntegerEditor.java index 38536b3..46f7b2b 100644 --- a/src/main/java/com/fr/plugin/db/redis/ui/value/IntegerEditor.java +++ b/src/main/java/com/fr/plugin/db/redis/ui/value/IntegerEditor.java @@ -6,7 +6,7 @@ import com.fanruan.api.design.ui.component.UIIntNumberField; import com.fanruan.api.design.ui.component.UITextField; import com.fanruan.api.design.util.GUICoreKit; import com.fr.plugin.db.redis.core.order.impl.NumberOrderValue; -import com.fr.stable.StringUtils; +import com.fanruan.api.util.StringKit; import java.awt.*; import java.awt.event.KeyAdapter; @@ -19,7 +19,7 @@ public class IntegerEditor extends Editor { private static final long serialVersionUID = 1L; protected UIIntNumberField numberField; // text field. - protected String oldValue = StringUtils.EMPTY; + protected String oldValue = StringKit.EMPTY; /** * Constructor.