diff --git a/plugin.xml b/plugin.xml index 08c4e6a..fde589c 100755 --- a/plugin.xml +++ b/plugin.xml @@ -9,7 +9,7 @@ richie + [2019-03-21]现在可以通过跳板服务连接redis。
[2019-03-18]修复连接没有释放的问题。
[2019-03-18]增加程序数据集,可以使用javascript进行取数,需要2019-03-01之后的版本。
[2019-02-15]结果集可以通过JavaScript脚本进行转换。
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 c82aab8..8a8e095 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 @@ -2,6 +2,7 @@ package com.fr.plugin.db.redis.core; import com.fr.config.holder.Conf; import com.fr.config.holder.factory.Holders; +import com.fr.config.holder.impl.ColConf; import com.fr.data.impl.AbstractDatabaseConnection; import com.fr.data.impl.Connection; import com.fr.locale.InterProviderFactory; @@ -14,6 +15,8 @@ import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLableReader; import com.fr.third.redis.clients.jedis.Jedis; +import java.util.ArrayList; +import java.util.Collection; import java.util.List; import java.util.Set; diff --git a/src/main/java/com/fr/plugin/db/redis/core/RedisNode.java b/src/main/java/com/fr/plugin/db/redis/core/RedisNode.java new file mode 100644 index 0000000..52cba15 --- /dev/null +++ b/src/main/java/com/fr/plugin/db/redis/core/RedisNode.java @@ -0,0 +1,73 @@ +package com.fr.plugin.db.redis.core; + +import com.fr.config.holder.Conf; +import com.fr.config.holder.factory.Holders; +import com.fr.config.utils.UniqueKey; +import com.fr.stable.AssistUtils; +import com.fr.stable.StringUtils; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-03-22 + */ +public class RedisNode extends UniqueKey { + + public static final int DEFAULT_REDIS_PORT = 6379; + + private Conf host = Holders.simple(StringUtils.EMPTY); + private Conf port = Holders.simple(DEFAULT_REDIS_PORT); + private Conf password = Holders.simple(StringUtils.EMPTY); + + public RedisNode(String host, int port, String password) { + this.setHost(host); + this.setPort(port); + this.setPassword(password); + } + + public String getHost() { + return host.get(); + } + + public void setHost(String host) { + this.host.set(host); + } + + public int getPort() { + return port.get(); + } + + public void setPort(int port) { + this.port.set(port); + } + + public String getPassword() { + return password.get(); + } + + public void setPassword(String password) { + this.password.set(password); + } + + @Override + public boolean equals(Object obj) { + return obj instanceof RedisNode + && AssistUtils.equals(((RedisNode) obj).getHost(), getHost()) + && ((RedisNode) obj).getPort() == getPort() + && AssistUtils.equals(((RedisNode) obj).getPassword(), getPassword()); + } + + @Override + public int hashCode() { + return AssistUtils.hashCode(getHost(), getPort(), getPassword()); + } + + @Override + public Object clone() throws CloneNotSupportedException { + RedisNode cloned = (RedisNode) super.clone(); + cloned.host = (Conf) host.clone(); + cloned.port = (Conf) port.clone(); + cloned.password = (Conf) password.clone(); + return cloned; + } +} diff --git a/src/main/java/com/fr/plugin/db/redis/core/RedisPool.java b/src/main/java/com/fr/plugin/db/redis/core/RedisPool.java index 926b854..f4caebb 100644 --- a/src/main/java/com/fr/plugin/db/redis/core/RedisPool.java +++ b/src/main/java/com/fr/plugin/db/redis/core/RedisPool.java @@ -13,6 +13,7 @@ import com.fr.ssh.jsch.JSchException; import com.fr.ssh.jsch.Session; import com.fr.stable.StringUtils; import com.fr.third.redis.clients.jedis.Jedis; +import com.fr.third.redis.clients.jedis.JedisCluster; import com.fr.third.redis.clients.jedis.JedisPool; import com.fr.third.redis.clients.jedis.JedisPoolConfig; import com.fr.transaction.Configurations; 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 08557d9..c1f78f1 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 @@ -61,16 +61,17 @@ public class RedisQueryPane extends BasicPane { Component[][] coms = new Component[][]{ {new UILabel(Toolkit.i18nText("Plugin-Redis_DB_Index") + ":"), dbIndexEditor}, {GUICoreUtils.createBorderLayoutPane(new UILabel(Toolkit.i18nText("Plugin-Redis_Query_Condition") + ":"), BorderLayout.NORTH), - RedisDesignUtils.createConditionTextPane(sqlTextPane, SyntaxConstants.SYNTAX_STYLE_SQL, 100)}, - {GUICoreUtils.createBorderLayoutPane(new UILabel(Toolkit.i18nText("Plugin-Redis_Script_Text") + ":"), BorderLayout.NORTH), - RedisDesignUtils.createConditionTextPane(scriptTextPane, SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT, 200) - }, + RedisDesignUtils.createConditionTextPane(sqlTextPane, SyntaxConstants.SYNTAX_STYLE_SQL, 300)} }; +// {GUICoreUtils.createBorderLayoutPane(new UILabel(Toolkit.i18nText("Plugin-Redis_Script_Text") + ":"), BorderLayout.NORTH), +// RedisDesignUtils.createConditionTextPane(scriptTextPane, SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT, 200) +// } + double p = TableLayout.PREFERRED; double f = TableLayout.FILL; - double[] rowSize = {p, p, p}; + double[] rowSize = {p, p}; double[] columnSize = {p, f}; add(TableLayoutHelper.createTableLayoutPane(coms, rowSize, columnSize)); 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 8a76a0e..e8362c4 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,31 +1,14 @@ package com.fr.plugin.db.redis.ui; -import com.fr.base.BaseUtils; -import com.fr.base.ParameterHelper; import com.fr.data.impl.NameDatabaseConnection; -import com.fr.design.actions.UpdateAction; -import com.fr.design.data.datapane.preview.PreviewTablePane; -import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane; -import com.fr.design.gui.itableeditorpane.ParameterTableModel; -import com.fr.design.gui.itableeditorpane.UITableEditAction; -import com.fr.design.gui.itableeditorpane.UITableEditorPane; -import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.i18n.Toolkit; -import com.fr.design.menu.ToolBarDef; -import com.fr.general.ComparatorUtils; -import com.fr.general.Inter; import com.fr.plugin.db.redis.core.RedisTableData; import com.fr.plugin.db.redis.core.order.OrderValue; import com.fr.script.Calculator; -import com.fr.stable.ArrayUtils; import com.fr.stable.ParameterProvider; import com.fr.stable.StringUtils; import javax.swing.*; -import java.awt.*; -import java.awt.event.ActionEvent; -import java.awt.event.FocusEvent; -import java.util.ArrayList; import java.util.List;