Browse Source

非JDBC不影响JDBC连接

paid
richie 6 years ago
parent
commit
54189a85a6
  1. 5
      plugin.xml
  2. 15
      src/main/java/com/fr/plugin/db/redis/core/RedisDatabaseConnection.java
  3. 2
      src/main/java/com/fr/plugin/db/redis/core/RedisTableData.java
  4. 10
      src/main/java/com/fr/plugin/db/redis/ui/RedisDBConnectionChosePane.java

5
plugin.xml

@ -3,12 +3,13 @@
<id>com.fr.solution.plugin.db.redis.v10</id>
<name><![CDATA[Redis数据集]]></name>
<active>yes</active>
<version>4.0</version>
<version>4.1</version>
<env-version>10.0</env-version>
<jartime>2018-08-20</jartime>
<jartime>2018-11-30</jartime>
<vendor>richie</vendor>
<description><![CDATA[可以连接Redis数据库,支持哈希表、列表、集合以及有序集合]]></description>
<change-notes><![CDATA[
[2018-11-30]解决远程设计时无法查询key列表的问题。<br/>
[2018-11-26]解决10.0版本中服务器数据集无法保存的问题。<br/>
[2018-09-12]适配10.0版本。<br/>
[2018-05-12]增加了keys、hget、hmget、hkeys查询。<br/>

15
src/main/java/com/fr/plugin/db/redis/core/RedisDatabaseConnection.java

@ -6,6 +6,7 @@ import com.fr.data.impl.AbstractDatabaseConnection;
import com.fr.data.impl.Connection;
import com.fr.general.Inter;
import com.fr.security.SecurityToolbox;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.xml.XMLPrintWriter;
@ -13,6 +14,7 @@ import com.fr.stable.xml.XMLableReader;
import redis.clients.jedis.Jedis;
import java.util.List;
import java.util.Set;
public class RedisDatabaseConnection extends AbstractDatabaseConnection {
@ -51,6 +53,7 @@ public class RedisDatabaseConnection extends AbstractDatabaseConnection {
}
@Override
public void testConnection() throws Exception {
Jedis client = createRedisClient();
@ -75,7 +78,17 @@ public class RedisDatabaseConnection extends AbstractDatabaseConnection {
@Override
public java.sql.Connection createConnection() throws Exception {
return null;
return Connection.IGNORE;
}
@Override
public String[] summary(String... args) {
if (ArrayUtils.isEmpty(args)) {
return ArrayUtils.EMPTY_STRING_ARRAY;
} else {
Set<String> keys = createRedisClient().keys(args[0]);
return keys.toArray(new String[0]);
}
}
@Override

2
src/main/java/com/fr/plugin/db/redis/core/RedisTableData.java

@ -33,7 +33,7 @@ import java.util.Map;
public class RedisTableData extends AbstractParameterTableData {
private Conf<Connection> database = Holders.obj(null, Connection.class);
private Conf<OrderValue> dbIndex = XmlHolders.obj(new NumberOrderValue(0), OrderValue.class);
private Conf<OrderValue> dbIndex = XmlHolders.obj(new NumberOrderValue(0), OrderValue.class, OrderValue.XML_TAG);
private Conf<String> query = Holders.simple(StringUtils.EMPTY);
public void setDatabase(Connection c) {

10
src/main/java/com/fr/plugin/db/redis/ui/RedisDBConnectionChosePane.java

@ -1,7 +1,7 @@
package com.fr.plugin.db.redis.ui;
import com.fr.base.FRContext;
import com.fr.data.impl.Connection;
import com.fr.data.operator.DataOperator;
import com.fr.design.data.datapane.connect.ConnectionComboBoxPanel;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.UIButton;
@ -9,10 +9,9 @@ import com.fr.design.gui.itextfield.PlaceholderTextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.file.DatasourceManager;
import com.fr.general.Inter;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.db.redis.ui.event.DataLoadedListener;
import com.fr.plugin.db.redis.core.RedisDatabaseConnection;
import com.fr.plugin.db.redis.ui.event.DataLoadedListener;
import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils;
@ -22,8 +21,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ExecutionException;
public class RedisDBConnectionChosePane extends BasicPane {
@ -100,8 +97,7 @@ public class RedisDBConnectionChosePane extends BasicPane {
if (StringUtils.isEmpty(keysPattern)) {
return ArrayUtils.EMPTY_STRING_ARRAY;
} else {
Set<String> keys = connection.createRedisClient().keys(keysPattern);
return keys.toArray(new String[keys.size()]);
return DataOperator.getInstance().getTableSummary(connection, keysPattern);
}
}

Loading…
Cancel
Save