Browse Source

feat:插件中的方法用finekit替换

pull/12/head
zjz1993 5 years ago
parent
commit
ca6ab47d7e
  1. 2
      src/main/java/com/fr/plugin/db/redis/RedisConnectionImpl.java
  2. 4
      src/main/java/com/fr/plugin/db/redis/RedisScriptTableDataDefine.java
  3. 99
      src/main/java/com/fr/plugin/db/redis/conf/ShellConfigManager.java
  4. 12
      src/main/java/com/fr/plugin/db/redis/conf/ShellConfigManagerProvider.java
  5. 8
      src/main/java/com/fr/plugin/db/redis/core/DataWrapper.java
  6. 21
      src/main/java/com/fr/plugin/db/redis/core/RedisDatabaseConnection.java
  7. 19
      src/main/java/com/fr/plugin/db/redis/core/RedisNode.java
  8. 6
      src/main/java/com/fr/plugin/db/redis/core/RedisPool.java
  9. 35
      src/main/java/com/fr/plugin/db/redis/core/RedisScriptTableData.java
  10. 40
      src/main/java/com/fr/plugin/db/redis/core/RedisTableData.java
  11. 2
      src/main/java/com/fr/plugin/db/redis/core/RedisTableDataModel.java
  12. 6
      src/main/java/com/fr/plugin/db/redis/core/order/OrderValue.java
  13. 14
      src/main/java/com/fr/plugin/db/redis/core/order/impl/FormulaOrderValue.java
  14. 2
      src/main/java/com/fr/plugin/db/redis/core/order/impl/NumberOrderValue.java
  15. 33
      src/main/java/com/fr/plugin/db/redis/core/pool/RedisConnectionPoolConfig.java
  16. 31
      src/main/java/com/fr/plugin/db/redis/core/pool/RedisConnectionProxyConfig.java
  17. 2
      src/main/java/com/fr/plugin/db/redis/core/visit/AbstractVisitor.java
  18. 2
      src/main/java/com/fr/plugin/db/redis/core/visit/Visitor.java
  19. 2
      src/main/java/com/fr/plugin/db/redis/core/visit/VisitorFactory.java
  20. 2
      src/main/java/com/fr/plugin/db/redis/core/visit/impl/GetVisitor.java
  21. 2
      src/main/java/com/fr/plugin/db/redis/core/visit/impl/HashGetVisitor.java
  22. 2
      src/main/java/com/fr/plugin/db/redis/core/visit/impl/HashKeysVisitor.java
  23. 2
      src/main/java/com/fr/plugin/db/redis/core/visit/impl/HashMGetVisitor.java
  24. 2
      src/main/java/com/fr/plugin/db/redis/core/visit/impl/HashVisitor.java
  25. 2
      src/main/java/com/fr/plugin/db/redis/core/visit/impl/KeysVisitor.java
  26. 2
      src/main/java/com/fr/plugin/db/redis/core/visit/impl/ListVisitor.java
  27. 2
      src/main/java/com/fr/plugin/db/redis/core/visit/impl/MGetVisitor.java
  28. 2
      src/main/java/com/fr/plugin/db/redis/core/visit/impl/SetVisitor.java
  29. 2
      src/main/java/com/fr/plugin/db/redis/core/visit/impl/ZRangeVisitor.java
  30. 9
      src/main/java/com/fr/plugin/db/redis/help/Files.java
  31. 24
      src/main/java/com/fr/plugin/db/redis/ui/RedisBaseTableDataPane.java
  32. 43
      src/main/java/com/fr/plugin/db/redis/ui/RedisConnectionPane.java
  33. 25
      src/main/java/com/fr/plugin/db/redis/ui/RedisDBConnectionChosePane.java
  34. 36
      src/main/java/com/fr/plugin/db/redis/ui/RedisQueryPane.java
  35. 26
      src/main/java/com/fr/plugin/db/redis/ui/RedisScriptPane.java
  36. 2
      src/main/java/com/fr/plugin/db/redis/ui/RedisScriptTableDataPane.java
  37. 6
      src/main/java/com/fr/plugin/db/redis/ui/RedisTableDataPane.java
  38. 32
      src/main/java/com/fr/plugin/db/redis/ui/pool/RedisConnectionPoolConfigPane.java
  39. 40
      src/main/java/com/fr/plugin/db/redis/ui/proxy/RedisConnectionProxyConfigPane.java
  40. 10
      src/main/java/com/fr/plugin/db/redis/ui/value/FormulaEditor.java
  41. 6
      src/main/java/com/fr/plugin/db/redis/ui/value/IndexValuePaneFactory.java
  42. 10
      src/main/java/com/fr/plugin/db/redis/ui/value/IntegerEditor.java
  43. 8
      src/main/java/com/fr/plugin/db/redis/util/RedisDesignUtils.java
  44. 6
      src/main/java/com/fr/plugin/db/redis/util/RedisUtils.java

2
src/main/java/com/fr/plugin/db/redis/RedisConnectionImpl.java

@ -1,7 +1,7 @@
package com.fr.plugin.db.redis; package com.fr.plugin.db.redis;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fr.design.beans.BasicBeanPane; import com.fanruan.api.design.ui.container.BasicBeanPane;
import com.fr.design.fun.impl.AbstractConnectionProvider; import com.fr.design.fun.impl.AbstractConnectionProvider;
import com.fr.plugin.db.redis.core.RedisDatabaseConnection; import com.fr.plugin.db.redis.core.RedisDatabaseConnection;
import com.fr.plugin.db.redis.ui.RedisConnectionPane; import com.fr.plugin.db.redis.ui.RedisConnectionPane;

4
src/main/java/com/fr/plugin/db/redis/RedisScriptTableDataDefine.java

@ -6,7 +6,7 @@ import com.fr.design.fun.ServerTableDataDefineProvider;
import com.fr.design.fun.impl.AbstractTableDataDefineProvider; import com.fr.design.fun.impl.AbstractTableDataDefineProvider;
import com.fr.plugin.db.redis.core.RedisScriptTableData; import com.fr.plugin.db.redis.core.RedisScriptTableData;
import com.fr.plugin.db.redis.ui.RedisScriptTableDataPane; import com.fr.plugin.db.redis.ui.RedisScriptTableDataPane;
import com.fanruan.api.i18n.I18nKit; import com.fanruan.api.design.util.I18nDesignKit;
/** /**
* @author richie * @author richie
@ -37,7 +37,7 @@ public class RedisScriptTableDataDefine extends AbstractTableDataDefineProvider
@Override @Override
public String nameForTableData() { public String nameForTableData() {
return I18nKit.getLocText("Plugin-Redis_Script_Table_Data"); return I18nDesignKit.i18nText("Plugin-Redis_Script_Table_Data");
} }
@Override @Override

99
src/main/java/com/fr/plugin/db/redis/conf/ShellConfigManager.java

@ -1,99 +0,0 @@
package com.fr.plugin.db.redis.conf;
import com.fanruan.api.xml.XmlKit;
import com.fanruan.api.xml.comopnent.XMLFileManager;
import com.fr.general.GeneralContext;
import com.fr.stable.EnvChangedListener;
import com.fanruan.api.util.StringKit;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLTools;
import com.fr.stable.xml.XMLableReader;
import java.io.InputStream;
/**
* Created by richie on 2017/6/5.
*/
public class ShellConfigManager extends XMLFileManager implements ShellConfigManagerProvider {
private static final String XML_TAG = "ShellConfigManager";
private static ShellConfigManagerProvider shellManager = null;
public synchronized static ShellConfigManager getInstance() {
return (ShellConfigManager) getProviderInstance();
}
public synchronized static ShellConfigManagerProvider getProviderInstance() {
if (shellManager == null) {
if (isClusterMember()) {
return shellManager;
}
shellManager.readXMLFile();
}
return shellManager;
}
private synchronized static boolean isClusterMember() {
return false;
}
static {
GeneralContext.addEnvChangedListener(new EnvChangedListener() {
public void envChanged() {
ShellConfigManager.envChanged();
}
});
}
private synchronized static void envChanged() {
shellManager = null;
}
private String shellText;
@Override
public String getShellText() {
return shellText;
}
public void setShellText(String shellText) {
this.shellText = shellText;
}
@Override
public void readXML(XMLableReader reader) {
if (reader.isAttr()) {
shellText = reader.getAttrAsString("shell", StringKit.EMPTY);
}
}
@Override
public void writeXML(XMLPrintWriter writer) {
writer.startTAG(XML_TAG);
writer.attr("shell", shellText);
writer.end();
}
@Override
public String fileName() {
return "redis.xml";
}
@Override
public void readFromInputStream(InputStream input) throws Exception {
// 服务器端新建一个对象
ShellConfigManager manager = new ShellConfigManager();
// 从客户端传过来的inputstream中读取对象属性
XMLTools.readInputStreamXML(manager, input);
// 赋值给当前服务器端对象
shellManager = manager;
}
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
}

12
src/main/java/com/fr/plugin/db/redis/conf/ShellConfigManagerProvider.java

@ -1,12 +0,0 @@
package com.fr.plugin.db.redis.conf;
import com.fr.stable.FCloneable;
import com.fr.stable.file.RemoteXMLFileManagerProvider;
/**
* Created by richie on 2017/6/5.
*/
public interface ShellConfigManagerProvider extends RemoteXMLFileManagerProvider, java.io.Serializable, FCloneable {
String getShellText();
}

8
src/main/java/com/fr/plugin/db/redis/core/DataWrapper.java

@ -2,8 +2,8 @@ package com.fr.plugin.db.redis.core;
import com.fanruan.api.util.GeneralKit; import com.fanruan.api.util.GeneralKit;
import com.fanruan.api.log.LogKit; import com.fanruan.api.log.LogKit;
import com.fr.general.IOUtils; import com.fanruan.api.util.IOKit;
import com.fr.script.ScriptFactory; import com.fanruan.api.script.ScriptKit;
import com.fanruan.api.util.StringKit; import com.fanruan.api.util.StringKit;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
@ -53,14 +53,14 @@ public class DataWrapper<T> {
if (script.startsWith("file:///")) { if (script.startsWith("file:///")) {
try { try {
FileInputStream in = new FileInputStream(new File(readAndRenderScriptFile(script))); FileInputStream in = new FileInputStream(new File(readAndRenderScriptFile(script)));
scriptText = IOUtils.inputStream2String(in); scriptText = IOKit.inputStream2String(in);
} catch (Exception e) { } catch (Exception e) {
LogKit.error(e.getMessage(), e); LogKit.error(e.getMessage(), e);
} }
} else { } else {
scriptText = String.format("(function(){%s})()", script); scriptText = String.format("(function(){%s})()", script);
} }
ScriptEngine scriptEngine = ScriptFactory.newScriptEngine(); ScriptEngine scriptEngine = ScriptKit.newScriptEngine();
scriptEngine.put("$content", data); scriptEngine.put("$content", data);
scriptEngine.put("$column", columnNames); scriptEngine.put("$column", columnNames);
Object r = scriptEngine.eval(scriptText); Object r = scriptEngine.eval(scriptText);

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

@ -1,11 +1,10 @@
package com.fr.plugin.db.redis.core; package com.fr.plugin.db.redis.core;
import com.fr.config.holder.Conf; import cpm.fanruan.api.conf.HolderKit;
import com.fr.config.holder.factory.Holders;
import com.fr.config.holder.impl.ColConf; import com.fr.config.holder.impl.ColConf;
import com.fr.data.impl.AbstractDatabaseConnection; import com.fr.data.impl.AbstractDatabaseConnection;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fanruan.api.i18n.I18nKit; import com.fanruan.api.design.util.I18nDesignKit;
import com.fr.plugin.db.redis.core.emb.Redis; import com.fr.plugin.db.redis.core.emb.Redis;
import com.fanruan.api.security.SecurityKit; import com.fanruan.api.security.SecurityKit;
import com.fanruan.api.util.ArrayKit; import com.fanruan.api.util.ArrayKit;
@ -24,9 +23,9 @@ public class RedisDatabaseConnection extends AbstractDatabaseConnection {
private static final int DEFAULT_REDIS_PORT = 6379; private static final int DEFAULT_REDIS_PORT = 6379;
private Conf<String> host = Holders.simple(StringKit.EMPTY); private HolderKit.Conf<String> host = HolderKit.simple(StringKit.EMPTY);
private Conf<Integer> port = Holders.simple(DEFAULT_REDIS_PORT); private HolderKit.Conf<Integer> port = HolderKit.simple(DEFAULT_REDIS_PORT);
private Conf<String> password = Holders.simple(StringKit.EMPTY); private HolderKit.Conf<String> password = HolderKit.simple(StringKit.EMPTY);
public RedisDatabaseConnection() { public RedisDatabaseConnection() {
@ -96,9 +95,9 @@ public class RedisDatabaseConnection extends AbstractDatabaseConnection {
@Override @Override
public String connectMessage(boolean status) { public String connectMessage(boolean status) {
if (status) { if (status) {
return I18nKit.getLocText("Plugin-Redis_Connection_Successfully") + "!"; return I18nDesignKit.i18nText("Plugin-Redis_Connection_Successfully") + "!";
} else { } else {
return I18nKit.getLocText("Plugin-Redis_Connection_Failed") + "!"; return I18nDesignKit.i18nText("Plugin-Redis_Connection_Failed") + "!";
} }
} }
@ -168,9 +167,9 @@ public class RedisDatabaseConnection extends AbstractDatabaseConnection {
@Override @Override
public Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
com.fr.plugin.db.redis.core.RedisDatabaseConnection cloned = (com.fr.plugin.db.redis.core.RedisDatabaseConnection) super.clone(); com.fr.plugin.db.redis.core.RedisDatabaseConnection cloned = (com.fr.plugin.db.redis.core.RedisDatabaseConnection) super.clone();
cloned.host = (Conf<String>) host.clone(); cloned.host = (HolderKit.Conf<String>) host.clone();
cloned.port = (Conf<Integer>) port.clone(); cloned.port = (HolderKit.Conf<Integer>) port.clone();
cloned.password = (Conf<String>) password.clone(); cloned.password = (HolderKit.Conf<String>) password.clone();
return cloned; return cloned;
} }
} }

19
src/main/java/com/fr/plugin/db/redis/core/RedisNode.java

@ -1,8 +1,7 @@
package com.fr.plugin.db.redis.core; package com.fr.plugin.db.redis.core;
import com.fr.config.holder.Conf; import com.fanruan.api.conf.HolderKit;
import com.fr.config.holder.factory.Holders; import com.fanruan.api.conf.BaseUniqueKey;
import com.fr.config.utils.UniqueKey;
import com.fanruan.api.util.AssistKit; import com.fanruan.api.util.AssistKit;
import com.fanruan.api.util.StringKit; import com.fanruan.api.util.StringKit;
@ -11,13 +10,13 @@ import com.fanruan.api.util.StringKit;
* @version 10.0 * @version 10.0
* Created by richie on 2019-03-22 * Created by richie on 2019-03-22
*/ */
public class RedisNode extends UniqueKey { public class RedisNode extends BaseUniqueKey {
public static final int DEFAULT_REDIS_PORT = 6379; public static final int DEFAULT_REDIS_PORT = 6379;
private Conf<String> host = Holders.simple(StringKit.EMPTY); private HolderKit.Conf<String> host = HolderKit.simple(StringKit.EMPTY);
private Conf<Integer> port = Holders.simple(DEFAULT_REDIS_PORT); private HolderKit.Conf<Integer> port = HolderKit.simple(DEFAULT_REDIS_PORT);
private Conf<String> password = Holders.simple(StringKit.EMPTY); private HolderKit.Conf<String> password = HolderKit.simple(StringKit.EMPTY);
public RedisNode(String host, int port, String password) { public RedisNode(String host, int port, String password) {
this.setHost(host); this.setHost(host);
@ -65,9 +64,9 @@ public class RedisNode extends UniqueKey {
@Override @Override
public Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
RedisNode cloned = (RedisNode) super.clone(); RedisNode cloned = (RedisNode) super.clone();
cloned.host = (Conf<String>) host.clone(); cloned.host = (HolderKit.Conf<String>) host.clone();
cloned.port = (Conf<Integer>) port.clone(); cloned.port = (HolderKit.Conf<Integer>) port.clone();
cloned.password = (Conf<String>) password.clone(); cloned.password = (HolderKit.Conf<String>) password.clone();
return cloned; return cloned;
} }
} }

6
src/main/java/com/fr/plugin/db/redis/core/RedisPool.java

@ -13,10 +13,8 @@ import com.fr.ssh.jsch.JSchException;
import com.fr.ssh.jsch.Session; import com.fr.ssh.jsch.Session;
import com.fanruan.api.util.StringKit; import com.fanruan.api.util.StringKit;
import com.fr.third.redis.clients.jedis.Jedis; import com.fr.third.redis.clients.jedis.Jedis;
import com.fr.third.redis.clients.jedis.JedisCluster; import com.fanruan.api.redis.pool.JedisPool;
import com.fr.third.redis.clients.jedis.JedisPool; import com.fanruan.api.redis.pool.JedisPoolConfig;
import com.fr.third.redis.clients.jedis.JedisPoolConfig;
import com.fr.transaction.Configurations;
import com.fr.transaction.ValidateProxy; import com.fr.transaction.ValidateProxy;
import java.util.Map; import java.util.Map;

35
src/main/java/com/fr/plugin/db/redis/core/RedisScriptTableData.java

@ -1,17 +1,16 @@
package com.fr.plugin.db.redis.core; package com.fr.plugin.db.redis.core;
import com.fr.base.Parameter; import com.fr.stable.ParameterProvider;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.config.holder.Conf; import com.fanruan.api.conf.HolderKit;
import com.fr.config.holder.factory.Holders;
import com.fr.config.holder.factory.XmlHolders; import com.fr.config.holder.factory.XmlHolders;
import com.fr.data.AbstractParameterTableData; import com.fr.data.AbstractParameterTableData;
import com.fr.data.core.DataCoreXmlUtils; import com.fanruan.api.database.DatabaseKit;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fr.data.impl.NameDatabaseConnection; import com.fanruan.api.database.nameDatabase.NameDatabaseConnection;
import com.fr.file.DatasourceManager; import com.fanruan.api.data.ConnectionKit;
import com.fr.general.data.DataModel; import com.fr.general.data.DataModel;
import com.fr.general.xml.GeneralXMLTools; import com.fanruan.api.xml.XmlKit;
import com.fr.intelli.record.Focus; import com.fr.intelli.record.Focus;
import com.fanruan.api.log.LogKit; import com.fanruan.api.log.LogKit;
import com.fr.plugin.db.redis.core.order.OrderValue; import com.fr.plugin.db.redis.core.order.OrderValue;
@ -34,9 +33,9 @@ public class RedisScriptTableData extends AbstractParameterTableData {
private static final long serialVersionUID = 1525853354993816818L; private static final long serialVersionUID = 1525853354993816818L;
private Conf<Connection> database = Holders.obj(null, Connection.class); private HolderKit.Conf<Connection> database = HolderKit.obj(null, Connection.class);
private Conf<OrderValue> dbIndex = XmlHolders.obj(new NumberOrderValue(0), OrderValue.class, OrderValue.XML_TAG); private HolderKit.Conf<OrderValue> dbIndex = XmlHolders.obj(new NumberOrderValue(0), OrderValue.class, OrderValue.XML_TAG);
private Conf<String> script = Holders.simple(StringKit.EMPTY); private HolderKit.Conf<String> script = HolderKit.simple(StringKit.EMPTY);
public void setDatabase(Connection c) { public void setDatabase(Connection c) {
this.database.set(c); this.database.set(c);
@ -79,7 +78,7 @@ public class RedisScriptTableData extends AbstractParameterTableData {
Connection connection = database.get(); Connection connection = database.get();
if (connection instanceof NameDatabaseConnection) { if (connection instanceof NameDatabaseConnection) {
String name = ((NameDatabaseConnection) connection).getName(); String name = ((NameDatabaseConnection) connection).getName();
RedisDatabaseConnection rc = DatasourceManager.getProviderInstance().getConnection(name, RedisDatabaseConnection.class); RedisDatabaseConnection rc = ConnectionKit.getConnection(name, RedisDatabaseConnection.class);
if (rc != null) { if (rc != null) {
OrderValue orderValue = dbIndex.get(); OrderValue orderValue = dbIndex.get();
DataModel model = new RedisScriptTableDataModel(rc, DataModel model = new RedisScriptTableDataModel(rc,
@ -101,13 +100,13 @@ public class RedisScriptTableData extends AbstractParameterTableData {
String tmpVal; String tmpVal;
if (OrderValue.XML_TAG.equals(tmpName)) { if (OrderValue.XML_TAG.equals(tmpName)) {
OrderValue orderValue = (OrderValue) GeneralXMLTools.readXMLable(reader); OrderValue orderValue = (OrderValue) XmlKit.readXMLable(reader);
if (orderValue != null) { if (orderValue != null) {
setOrderValue(orderValue); setOrderValue(orderValue);
} }
} else if (com.fr.data.impl.Connection.XML_TAG.equals(tmpName)) { } else if (com.fr.data.impl.Connection.XML_TAG.equals(tmpName)) {
if (reader.getAttrAsString("class", null) != null) { if (reader.getAttrAsString("class", null) != null) {
com.fr.data.impl.Connection con = DataCoreXmlUtils.readXMLConnection(reader); com.fr.data.impl.Connection con = DatabaseKit.readXMLConnection(reader);
this.setDatabase(con); this.setDatabase(con);
} }
} else if ("Script".equals(tmpName)) { } else if ("Script".equals(tmpName)) {
@ -122,9 +121,9 @@ public class RedisScriptTableData extends AbstractParameterTableData {
@Override @Override
public void writeXML(XMLPrintWriter writer) { public void writeXML(XMLPrintWriter writer) {
super.writeXML(writer); super.writeXML(writer);
GeneralXMLTools.writeXMLable(writer, dbIndex.get(), OrderValue.XML_TAG); XmlKit.writeXMLable(writer, dbIndex.get(), OrderValue.XML_TAG);
if (this.database.get() != null) { if (this.database.get() != null) {
DataCoreXmlUtils.writeXMLConnection(writer, this.database.get()); DatabaseKit.writeXMLConnection(writer, this.database.get());
} }
writer.startTAG("Script").textNode(getScript()).end(); writer.startTAG("Script").textNode(getScript()).end();
} }
@ -136,9 +135,9 @@ public class RedisScriptTableData extends AbstractParameterTableData {
@Override @Override
public Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
RedisScriptTableData cloned = (RedisScriptTableData) super.clone(); RedisScriptTableData cloned = (RedisScriptTableData) super.clone();
cloned.database = (Conf<Connection>) database.clone(); cloned.database = (HolderKit.Conf<Connection>) database.clone();
cloned.script = (Conf<String>) script.clone(); cloned.script = (HolderKit.Conf<String>) script.clone();
cloned.dbIndex = (Conf<OrderValue>) dbIndex.clone(); cloned.dbIndex = (HolderKit.Conf<OrderValue>) dbIndex.clone();
return cloned; return cloned;
} }
} }

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

@ -1,18 +1,16 @@
package com.fr.plugin.db.redis.core; package com.fr.plugin.db.redis.core;
import com.fr.base.Parameter; import com.fr.stable.ParameterProvider;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.base.TemplateUtils; import com.fanruan.api.conf.HolderKit;
import com.fr.config.holder.Conf;
import com.fr.config.holder.factory.Holders;
import com.fr.config.holder.factory.XmlHolders; import com.fr.config.holder.factory.XmlHolders;
import com.fr.data.AbstractParameterTableData; import com.fr.data.AbstractParameterTableData;
import com.fr.data.core.DataCoreXmlUtils; import com.fanruan.api.database.DatabaseKit;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fr.data.impl.NameDatabaseConnection; import com.fanruan.api.database.nameDatabase.NameDatabaseConnection;
import com.fr.file.DatasourceManager; import com.fanruan.api.data.ConnectionKit;
import com.fr.general.data.DataModel; import com.fr.general.data.DataModel;
import com.fr.general.xml.GeneralXMLTools; import com.fanruan.api.xml.XmlKit;
import com.fr.intelli.record.Focus; import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original; import com.fr.intelli.record.Original;
import com.fanruan.api.log.LogKit; import com.fanruan.api.log.LogKit;
@ -35,10 +33,10 @@ import java.util.Map;
public class RedisTableData extends AbstractParameterTableData { public class RedisTableData extends AbstractParameterTableData {
private static final long serialVersionUID = 7017455818551800001L; private static final long serialVersionUID = 7017455818551800001L;
private Conf<Connection> database = Holders.obj(null, Connection.class); private HolderKit.Conf<Connection> database = HolderKit.obj(null, Connection.class);
private Conf<OrderValue> dbIndex = XmlHolders.obj(new NumberOrderValue(0), OrderValue.class, OrderValue.XML_TAG); private HolderKit.Conf<OrderValue> dbIndex = XmlHolders.obj(new NumberOrderValue(0), OrderValue.class, OrderValue.XML_TAG);
private Conf<String> query = Holders.simple(StringKit.EMPTY); private HolderKit.Conf<String> query = HolderKit.simple(StringKit.EMPTY);
private Conf<String> script = Holders.simple(StringKit.EMPTY); private HolderKit.Conf<String> script = HolderKit.simple(StringKit.EMPTY);
public void setDatabase(Connection c) { public void setDatabase(Connection c) {
this.database.set(c); this.database.set(c);
@ -89,7 +87,7 @@ public class RedisTableData extends AbstractParameterTableData {
Connection connection = database.get(); Connection connection = database.get();
if (connection instanceof NameDatabaseConnection) { if (connection instanceof NameDatabaseConnection) {
String name = ((NameDatabaseConnection) connection).getName(); String name = ((NameDatabaseConnection) connection).getName();
RedisDatabaseConnection rc = DatasourceManager.getProviderInstance().getConnection(name, RedisDatabaseConnection.class); RedisDatabaseConnection rc = ConnectionKit.getConnection(name, RedisDatabaseConnection.class);
if (rc != null) { if (rc != null) {
OrderValue orderValue = dbIndex.get(); OrderValue orderValue = dbIndex.get();
DataModel model = new RedisTableDataModel(calculator, ps, rc, DataModel model = new RedisTableDataModel(calculator, ps, rc,
@ -114,13 +112,13 @@ public class RedisTableData extends AbstractParameterTableData {
String tmpVal; String tmpVal;
if (OrderValue.XML_TAG.equals(tmpName)) { if (OrderValue.XML_TAG.equals(tmpName)) {
OrderValue orderValue = (OrderValue) GeneralXMLTools.readXMLable(reader); OrderValue orderValue = (OrderValue) XmlKit.readXMLable(reader);
if (orderValue != null) { if (orderValue != null) {
setOrderValue(orderValue); setOrderValue(orderValue);
} }
} else if (com.fr.data.impl.Connection.XML_TAG.equals(tmpName)) { } else if (com.fr.data.impl.Connection.XML_TAG.equals(tmpName)) {
if (reader.getAttrAsString("class", null) != null) { if (reader.getAttrAsString("class", null) != null) {
com.fr.data.impl.Connection con = DataCoreXmlUtils.readXMLConnection(reader); com.fr.data.impl.Connection con = DatabaseKit.readXMLConnection(reader);
this.setDatabase(con); this.setDatabase(con);
} }
} else if ("Query".equals(tmpName)) { } else if ("Query".equals(tmpName)) {
@ -140,9 +138,9 @@ public class RedisTableData extends AbstractParameterTableData {
@Override @Override
public void writeXML(XMLPrintWriter writer) { public void writeXML(XMLPrintWriter writer) {
super.writeXML(writer); super.writeXML(writer);
GeneralXMLTools.writeXMLable(writer, dbIndex.get(), OrderValue.XML_TAG); XmlKit.writeXMLable(writer, dbIndex.get(), OrderValue.XML_TAG);
if (this.database.get() != null) { if (this.database.get() != null) {
DataCoreXmlUtils.writeXMLConnection(writer, this.database.get()); DatabaseKit.writeXMLConnection(writer, this.database.get());
} }
writer.startTAG("Query").textNode(getQuery()).end(); writer.startTAG("Query").textNode(getQuery()).end();
writer.startTAG("Script").textNode(getScript()).end(); writer.startTAG("Script").textNode(getScript()).end();
@ -155,10 +153,10 @@ public class RedisTableData extends AbstractParameterTableData {
@Override @Override
public Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
RedisTableData cloned = (RedisTableData) super.clone(); RedisTableData cloned = (RedisTableData) super.clone();
cloned.database = (Conf<Connection>) database.clone(); cloned.database = (HolderKit.Conf<Connection>) database.clone();
cloned.query = (Conf<String>) query.clone(); cloned.query = (HolderKit.Conf<String>) query.clone();
cloned.script = (Conf<String>) script.clone(); cloned.script = (HolderKit.Conf<String>) script.clone();
cloned.dbIndex = (Conf<OrderValue>) dbIndex.clone(); cloned.dbIndex = (HolderKit.Conf<OrderValue>) dbIndex.clone();
return cloned; return cloned;
} }
} }

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

@ -1,6 +1,6 @@
package com.fr.plugin.db.redis.core; package com.fr.plugin.db.redis.core;
import com.fr.base.Parameter; import com.fr.stable.ParameterProvider;
import com.fr.data.AbstractDataModel; import com.fr.data.AbstractDataModel;
import com.fanruan.api.log.LogKit; import com.fanruan.api.log.LogKit;
import com.fr.plugin.PluginLicense; import com.fr.plugin.PluginLicense;

6
src/main/java/com/fr/plugin/db/redis/core/order/OrderValue.java

@ -1,7 +1,7 @@
package com.fr.plugin.db.redis.core.order; package com.fr.plugin.db.redis.core.order;
import com.fr.base.Parameter; import com.fr.stable.ParameterProvider;
import com.fr.config.utils.UniqueKey; import com.fanruan.api.conf.BaseUniqueKey;
import com.fanruan.api.util.GeneralKit; import com.fanruan.api.util.GeneralKit;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
@ -9,7 +9,7 @@ import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLable; import com.fr.stable.xml.XMLable;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
public abstract class OrderValue extends UniqueKey implements XMLable { public abstract class OrderValue extends BaseUniqueKey implements XMLable {
private static final long serialVersionUID = -5421898153556627638L; private static final long serialVersionUID = -5421898153556627638L;

14
src/main/java/com/fr/plugin/db/redis/core/order/impl/FormulaOrderValue.java

@ -1,9 +1,9 @@
package com.fr.plugin.db.redis.core.order.impl; package com.fr.plugin.db.redis.core.order.impl;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.base.Parameter; import com.fanruan.api.cal.FormulaKit;
import com.fr.base.ParameterHelper; import com.fr.stable.ParameterProvider;
import com.fr.base.ParameterMapNameSpace; import com.fanruan.api.cal.ParameterKit;
import com.fanruan.api.util.GeneralKit; import com.fanruan.api.util.GeneralKit;
import com.fanruan.api.log.LogKit; import com.fanruan.api.log.LogKit;
import com.fr.plugin.db.redis.core.order.OrderValue; import com.fr.plugin.db.redis.core.order.OrderValue;
@ -11,7 +11,7 @@ import com.fr.script.Calculator;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import com.fanruan.api.util.StringKit; import com.fanruan.api.util.StringKit;
import com.fanruan.api.cal.ParameterKit; import com.fanruan.api.cal.ParameterKit;
import com.fr.stable.UtilEvalError; import com.fanruan.api.util.err.UtilEvalError;
import com.fr.stable.script.NameSpace; import com.fr.stable.script.NameSpace;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
@ -38,7 +38,7 @@ public class FormulaOrderValue extends OrderValue {
@Override @Override
public int toIndex(Calculator cal, Parameter[] ps) { public int toIndex(Calculator cal, Parameter[] ps) {
NameSpace nameSpace = ParameterMapNameSpace.create(ps); NameSpace nameSpace = ParameterKit.createParameterProvider(ps);
cal.pushNameSpace(nameSpace); cal.pushNameSpace(nameSpace);
try { try {
return GeneralKit.objectToNumber(formula.eval(cal)).intValue(); return GeneralKit.objectToNumber(formula.eval(cal)).intValue();
@ -55,12 +55,12 @@ public class FormulaOrderValue extends OrderValue {
if (formula == null) { if (formula == null) {
return new ParameterProvider[0]; return new ParameterProvider[0];
} }
return ParameterHelper.analyze4ParametersFromFormula(formula.getContent()); return ParameterKit.analyze4ParametersFromFormula(formula.getContent());
} }
@Override @Override
public void readValue(XMLableReader reader) { public void readValue(XMLableReader reader) {
this.formula = BaseFormula.createFormulaBuilder().build(reader.getAttrAsString("value", StringKit.EMPTY)); this.formula = FormulaKit.newFormula(reader.getAttrAsString("value", StringKit.EMPTY));
} }
@Override @Override

2
src/main/java/com/fr/plugin/db/redis/core/order/impl/NumberOrderValue.java

@ -1,6 +1,6 @@
package com.fr.plugin.db.redis.core.order.impl; package com.fr.plugin.db.redis.core.order.impl;
import com.fr.base.Parameter; import com.fr.stable.ParameterProvider;
import com.fr.plugin.db.redis.core.order.OrderValue; import com.fr.plugin.db.redis.core.order.OrderValue;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;

33
src/main/java/com/fr/plugin/db/redis/core/pool/RedisConnectionPoolConfig.java

@ -1,16 +1,17 @@
package com.fr.plugin.db.redis.core.pool; package com.fr.plugin.db.redis.core.pool;
import com.fr.config.ConfigContext; import com.fr.config.ConfigContext;
import com.fr.config.DefaultConfiguration; import com.fanruan.api.conf.BaseConfiguration;
import com.fr.config.holder.Conf; import com.fanruan.api.conf.HolderKit;
import com.fr.config.holder.factory.Holders;
import javax.xml.ws.Holder;
/** /**
* @author richie * @author richie
* @version 10.0 * @version 10.0
* Created by richie on 2019-03-21 * Created by richie on 2019-03-21
*/ */
public class RedisConnectionPoolConfig extends DefaultConfiguration { public class RedisConnectionPoolConfig extends BaseConfiguration {
private static volatile RedisConnectionPoolConfig instance = null; private static volatile RedisConnectionPoolConfig instance = null;
@ -26,12 +27,12 @@ public class RedisConnectionPoolConfig extends DefaultConfiguration {
private static final int MAX_WAIT = -1; private static final int MAX_WAIT = -1;
private static final int TIME_OUT = 100 * 1000; private static final int TIME_OUT = 100 * 1000;
private Conf<Integer> maxTotal = Holders.simple(MAX_TOTAL); private HolderKit.Conf<Integer> maxTotal = HolderKit.simple(MAX_TOTAL);
private Conf<Integer> maxWait = Holders.simple(MAX_WAIT); private HolderKit.Conf<Integer> maxWait = HolderKit.simple(MAX_WAIT);
private Conf<Integer> maxIdle = Holders.simple(MAX_IDLE); private HolderKit.Conf<Integer> maxIdle = HolderKit.simple(MAX_IDLE);
private Conf<Boolean> blockWhenExhausted = Holders.simple(true); private HolderKit.Conf<Boolean> blockWhenExhausted = HolderKit.simple(true);
private Conf<Boolean> lifo = Holders.simple(true); private HolderKit.Conf<Boolean> lifo = HolderKit.simple(true);
private Conf<Integer> timeout = Holders.simple(TIME_OUT); private HolderKit.Conf<Integer> timeout = HolderKit.simple(TIME_OUT);
public int getMaxTotal() { public int getMaxTotal() {
return maxTotal.get(); return maxTotal.get();
@ -84,12 +85,12 @@ public class RedisConnectionPoolConfig extends DefaultConfiguration {
@Override @Override
public Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
RedisConnectionPoolConfig cloned = (RedisConnectionPoolConfig) super.clone(); RedisConnectionPoolConfig cloned = (RedisConnectionPoolConfig) super.clone();
cloned.maxTotal = (Conf<Integer>) maxTotal.clone(); cloned.maxTotal = (HolderKit.Conf<Integer>) maxTotal.clone();
cloned.maxWait = (Conf<Integer>) maxWait.clone(); cloned.maxWait = (HolderKit.Conf<Integer>) maxWait.clone();
cloned.maxIdle = (Conf<Integer>) maxIdle.clone(); cloned.maxIdle = (HolderKit.Conf<Integer>) maxIdle.clone();
cloned.blockWhenExhausted = (Conf<Boolean>) blockWhenExhausted.clone(); cloned.blockWhenExhausted = (HolderKit.Conf<Boolean>) blockWhenExhausted.clone();
cloned.lifo = (Conf<Boolean>) lifo.clone(); cloned.lifo = (HolderKit.Conf<Boolean>) lifo.clone();
cloned.timeout = (Conf<Integer>) timeout.clone(); cloned.timeout = (HolderKit.Conf<Integer>) timeout.clone();
return cloned; return cloned;
} }
} }

31
src/main/java/com/fr/plugin/db/redis/core/pool/RedisConnectionProxyConfig.java

@ -1,9 +1,8 @@
package com.fr.plugin.db.redis.core.pool; package com.fr.plugin.db.redis.core.pool;
import com.fr.config.ConfigContext; import com.fr.config.ConfigContext;
import com.fr.config.DefaultConfiguration; import com.fanruan.api.conf.BaseConfiguration;
import com.fr.config.holder.Conf; import com.fanruan.api.conf.HolderKit;
import com.fr.config.holder.factory.Holders;
import com.fanruan.api.security.SecurityKit; import com.fanruan.api.security.SecurityKit;
import com.fanruan.api.util.StringKit; import com.fanruan.api.util.StringKit;
@ -12,7 +11,7 @@ import com.fanruan.api.util.StringKit;
* @version 10.0 * @version 10.0
* Created by richie on 2019-03-21 * Created by richie on 2019-03-21
*/ */
public class RedisConnectionProxyConfig extends DefaultConfiguration { public class RedisConnectionProxyConfig extends BaseConfiguration {
private static volatile RedisConnectionProxyConfig instance = null; private static volatile RedisConnectionProxyConfig instance = null;
@ -23,17 +22,17 @@ public class RedisConnectionProxyConfig extends DefaultConfiguration {
return instance; return instance;
} }
private Conf<Boolean> open = Holders.simple(false); private HolderKit.Conf<Boolean> open = HolderKit.simple(false);
private Conf<String> host = Holders.simple(StringKit.EMPTY); private HolderKit.Conf<String> host = HolderKit.simple(StringKit.EMPTY);
private Conf<Integer> port = Holders.simple(22); private HolderKit.Conf<Integer> port = HolderKit.simple(22);
private Conf<String> username = Holders.simple(StringKit.EMPTY); private HolderKit.Conf<String> username = HolderKit.simple(StringKit.EMPTY);
private Conf<String> password = Holders.simple(StringKit.EMPTY); private HolderKit.Conf<String> password = HolderKit.simple(StringKit.EMPTY);
private Conf<String> privateKeyPath = Holders.simple(StringKit.EMPTY); private HolderKit.Conf<String> privateKeyPath = HolderKit.simple(StringKit.EMPTY);
public boolean isOpen() { public boolean isOpen() {
@ -88,12 +87,12 @@ public class RedisConnectionProxyConfig extends DefaultConfiguration {
@Override @Override
public Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
RedisConnectionProxyConfig cloned = (RedisConnectionProxyConfig) super.clone(); RedisConnectionProxyConfig cloned = (RedisConnectionProxyConfig) super.clone();
cloned.open = (Conf<Boolean>) open.clone(); cloned.open = (HolderKit.Conf<Boolean>) open.clone();
cloned.host = (Conf<String>) host.clone(); cloned.host = (HolderKit.Conf<String>) host.clone();
cloned.port = (Conf<Integer>) port.clone(); cloned.port = (HolderKit.Conf<Integer>) port.clone();
cloned.username = (Conf<String>) username.clone(); cloned.username = (HolderKit.Conf<String>) username.clone();
cloned.password = (Conf<String>) password.clone(); cloned.password = (HolderKit.Conf<String>) password.clone();
cloned.privateKeyPath = (Conf<String>) privateKeyPath.clone(); cloned.privateKeyPath = (HolderKit.Conf<String>) privateKeyPath.clone();
return cloned; return cloned;
} }
} }

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

@ -1,6 +1,6 @@
package com.fr.plugin.db.redis.core.visit; package com.fr.plugin.db.redis.core.visit;
import com.fr.base.Parameter; import com.fr.stable.ParameterProvider;
import com.fr.plugin.db.redis.core.DataWrapper; import com.fr.plugin.db.redis.core.DataWrapper;
import com.fr.plugin.db.redis.core.RedisConstants; import com.fr.plugin.db.redis.core.RedisConstants;
import com.fr.script.Calculator; import com.fr.script.Calculator;

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

@ -1,6 +1,6 @@
package com.fr.plugin.db.redis.core.visit; package com.fr.plugin.db.redis.core.visit;
import com.fr.base.Parameter; import com.fr.stable.ParameterProvider;
import com.fr.plugin.db.redis.core.DataWrapper; import com.fr.plugin.db.redis.core.DataWrapper;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import com.fr.third.redis.clients.jedis.Jedis; import com.fr.third.redis.clients.jedis.Jedis;

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

@ -1,6 +1,6 @@
package com.fr.plugin.db.redis.core.visit; package com.fr.plugin.db.redis.core.visit;
import com.fr.base.Parameter; import com.fr.stable.ParameterProvider;
import com.fr.plugin.db.redis.core.DataWrapper; import com.fr.plugin.db.redis.core.DataWrapper;
import com.fr.plugin.db.redis.core.visit.impl.*; import com.fr.plugin.db.redis.core.visit.impl.*;
import com.fr.script.Calculator; import com.fr.script.Calculator;

2
src/main/java/com/fr/plugin/db/redis/core/visit/impl/GetVisitor.java

@ -1,6 +1,6 @@
package com.fr.plugin.db.redis.core.visit.impl; package com.fr.plugin.db.redis.core.visit.impl;
import com.fr.base.Parameter; import com.fr.stable.ParameterProvider;
import com.fr.plugin.db.redis.core.visit.AbstractVisitor; import com.fr.plugin.db.redis.core.visit.AbstractVisitor;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import com.fr.third.redis.clients.jedis.Jedis; import com.fr.third.redis.clients.jedis.Jedis;

2
src/main/java/com/fr/plugin/db/redis/core/visit/impl/HashGetVisitor.java

@ -1,6 +1,6 @@
package com.fr.plugin.db.redis.core.visit.impl; package com.fr.plugin.db.redis.core.visit.impl;
import com.fr.base.Parameter; import com.fr.stable.ParameterProvider;
import com.fr.plugin.db.redis.core.visit.AbstractVisitor; import com.fr.plugin.db.redis.core.visit.AbstractVisitor;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import com.fr.third.redis.clients.jedis.Jedis; import com.fr.third.redis.clients.jedis.Jedis;

2
src/main/java/com/fr/plugin/db/redis/core/visit/impl/HashKeysVisitor.java

@ -1,6 +1,6 @@
package com.fr.plugin.db.redis.core.visit.impl; package com.fr.plugin.db.redis.core.visit.impl;
import com.fr.base.Parameter; import com.fr.stable.ParameterProvider;
import com.fr.plugin.db.redis.core.visit.AbstractVisitor; import com.fr.plugin.db.redis.core.visit.AbstractVisitor;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import com.fr.third.redis.clients.jedis.Jedis; import com.fr.third.redis.clients.jedis.Jedis;

2
src/main/java/com/fr/plugin/db/redis/core/visit/impl/HashMGetVisitor.java

@ -1,6 +1,6 @@
package com.fr.plugin.db.redis.core.visit.impl; package com.fr.plugin.db.redis.core.visit.impl;
import com.fr.base.Parameter; import com.fr.stable.ParameterProvider;
import com.fr.plugin.db.redis.core.visit.AbstractVisitor; import com.fr.plugin.db.redis.core.visit.AbstractVisitor;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import com.fr.third.redis.clients.jedis.Jedis; import com.fr.third.redis.clients.jedis.Jedis;

2
src/main/java/com/fr/plugin/db/redis/core/visit/impl/HashVisitor.java

@ -1,6 +1,6 @@
package com.fr.plugin.db.redis.core.visit.impl; package com.fr.plugin.db.redis.core.visit.impl;
import com.fr.base.Parameter; import com.fr.stable.ParameterProvider;
import com.fr.plugin.db.redis.core.visit.AbstractVisitor; import com.fr.plugin.db.redis.core.visit.AbstractVisitor;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import com.fr.third.redis.clients.jedis.Jedis; import com.fr.third.redis.clients.jedis.Jedis;

2
src/main/java/com/fr/plugin/db/redis/core/visit/impl/KeysVisitor.java

@ -1,6 +1,6 @@
package com.fr.plugin.db.redis.core.visit.impl; package com.fr.plugin.db.redis.core.visit.impl;
import com.fr.base.Parameter; import com.fr.stable.ParameterProvider;
import com.fr.plugin.db.redis.core.visit.AbstractVisitor; import com.fr.plugin.db.redis.core.visit.AbstractVisitor;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import com.fr.third.redis.clients.jedis.Jedis; import com.fr.third.redis.clients.jedis.Jedis;

2
src/main/java/com/fr/plugin/db/redis/core/visit/impl/ListVisitor.java

@ -1,6 +1,6 @@
package com.fr.plugin.db.redis.core.visit.impl; package com.fr.plugin.db.redis.core.visit.impl;
import com.fr.base.Parameter; import com.fr.stable.ParameterProvider;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.plugin.db.redis.core.visit.AbstractVisitor; import com.fr.plugin.db.redis.core.visit.AbstractVisitor;
import com.fr.script.Calculator; import com.fr.script.Calculator;

2
src/main/java/com/fr/plugin/db/redis/core/visit/impl/MGetVisitor.java

@ -1,6 +1,6 @@
package com.fr.plugin.db.redis.core.visit.impl; package com.fr.plugin.db.redis.core.visit.impl;
import com.fr.base.Parameter; import com.fr.stable.ParameterProvider;
import com.fr.plugin.db.redis.core.visit.AbstractVisitor; import com.fr.plugin.db.redis.core.visit.AbstractVisitor;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import com.fanruan.api.util.ArrayKit; import com.fanruan.api.util.ArrayKit;

2
src/main/java/com/fr/plugin/db/redis/core/visit/impl/SetVisitor.java

@ -1,6 +1,6 @@
package com.fr.plugin.db.redis.core.visit.impl; package com.fr.plugin.db.redis.core.visit.impl;
import com.fr.base.Parameter; import com.fr.stable.ParameterProvider;
import com.fr.plugin.db.redis.core.visit.AbstractVisitor; import com.fr.plugin.db.redis.core.visit.AbstractVisitor;
import com.fr.script.Calculator; import com.fr.script.Calculator;
import com.fr.third.redis.clients.jedis.Jedis; import com.fr.third.redis.clients.jedis.Jedis;

2
src/main/java/com/fr/plugin/db/redis/core/visit/impl/ZRangeVisitor.java

@ -1,6 +1,6 @@
package com.fr.plugin.db.redis.core.visit.impl; package com.fr.plugin.db.redis.core.visit.impl;
import com.fr.base.Parameter; import com.fr.stable.ParameterProvider;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.plugin.db.redis.core.visit.AbstractVisitor; import com.fr.plugin.db.redis.core.visit.AbstractVisitor;
import com.fr.script.Calculator; import com.fr.script.Calculator;

9
src/main/java/com/fr/plugin/db/redis/help/Files.java

@ -1,9 +1,8 @@
package com.fr.plugin.db.redis.help; package com.fr.plugin.db.redis.help;
import com.eclipsesource.v8.V8; import com.eclipsesource.v8.V8;
import com.fr.general.IOUtils; import com.fanruan.api.util.IOKit;
import com.fr.io.utils.ResourceIOUtils; import com.fanruan.api.consts.EncodeConstantsKit;
import com.fr.stable.EncodeConstants;
import java.io.InputStream; import java.io.InputStream;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
@ -23,10 +22,10 @@ public class Files {
@ScriptBridge @ScriptBridge
public void require(String filePath) { public void require(String filePath) {
InputStream in = ResourceIOUtils.read(filePath); InputStream in = IOKit.read(filePath);
if (in != null) { if (in != null) {
try { try {
v8.executeVoidScript(IOUtils.inputStream2String(in, EncodeConstants.ENCODING_UTF_8)); v8.executeVoidScript(IOKit.inputStream2String(in, EncodeConstantsKit.ENCODING_UTF_8));
} catch (UnsupportedEncodingException ignore) { } catch (UnsupportedEncodingException ignore) {
} }

24
src/main/java/com/fr/plugin/db/redis/ui/RedisBaseTableDataPane.java

@ -3,15 +3,15 @@ package com.fr.plugin.db.redis.ui;
import com.fanruan.api.util.IOKit; import com.fanruan.api.util.IOKit;
import com.fanruan.api.cal.ParameterKit; import com.fanruan.api.cal.ParameterKit;
import com.fanruan.api.design.ui.action.UpdateAction; import com.fanruan.api.design.ui.action.UpdateAction;
import com.fr.base.ParameterHelper; import com.fanruan.api.cal.ParameterKit;
import com.fr.base.TableData; import com.fr.base.TableData;
import com.fr.design.data.datapane.preview.PreviewTablePane; import com.fanruan.api.design.DesignKit;
import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane; import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane;
import com.fr.design.gui.itableeditorpane.ParameterTableModel; import com.fanruan.api.design.ui.component.table.model.ParameterTableModel;
import com.fr.design.gui.itableeditorpane.UITableEditAction; import com.fanruan.api.design.ui.component.table.action.UITableEditAction;
import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fanruan.api.design.ui.component.table.UITableEditorPane;
import com.fr.design.gui.itoolbar.UIToolbar; import com.fanruan.api.design.ui.component.UIToolbar;
import com.fr.design.i18n.Toolkit; import com.fanruan.api.design.DesignKit;
import com.fr.design.menu.ToolBarDef; import com.fr.design.menu.ToolBarDef;
import com.fr.plugin.db.redis.core.order.OrderValue; import com.fr.plugin.db.redis.core.order.OrderValue;
import com.fanruan.api.util.ArrayKit; import com.fanruan.api.util.ArrayKit;
@ -29,8 +29,8 @@ import java.util.ArrayList;
*/ */
public abstract class RedisBaseTableDataPane<T extends TableData> extends AbstractTableDataPane<T> { public abstract class RedisBaseTableDataPane<T extends TableData> extends AbstractTableDataPane<T> {
private static final String PREVIEW_BUTTON = Toolkit.i18nText("Plugin-Redis_Preview"); private static final String PREVIEW_BUTTON = DesignKit.i18nText("Plugin-Redis_Preview");
private static final String REFRESH_BUTTON = Toolkit.i18nText("Plugin-Redis_Refresh"); private static final String REFRESH_BUTTON = DesignKit.i18nText("Plugin-Redis_Refresh");
protected RedisDBConnectionChosePane chosePane; protected RedisDBConnectionChosePane chosePane;
@ -82,7 +82,7 @@ public abstract class RedisBaseTableDataPane<T extends TableData> extends Abstra
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Toolkit.i18nText("Plugin-Redis_Query"); return DesignKit.i18nText("Plugin-Redis_Query");
} }
protected abstract JComponent createQueryPane(); protected abstract JComponent createQueryPane();
@ -106,7 +106,7 @@ public abstract class RedisBaseTableDataPane<T extends TableData> extends Abstra
private void checkParameter() { private void checkParameter() {
String[] paramTexts = paramTexts(); String[] paramTexts = paramTexts();
ParameterProvider[] parameters = ParameterHelper.analyze4Parameters(paramTexts, false); ParameterProvider[] parameters = ParameterKit.analyze4Parameters(paramTexts, false);
parameters = ArrayKit.addAll(parameters, getOrderValue().analyze4Parameters()); parameters = ArrayKit.addAll(parameters, getOrderValue().analyze4Parameters());
if (parameters.length < 1 && editorPane.update().size() < 1) { if (parameters.length < 1 && editorPane.update().size() < 1) {
@ -140,7 +140,7 @@ public abstract class RedisBaseTableDataPane<T extends TableData> extends Abstra
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
checkParameter(); checkParameter();
PreviewTablePane.previewTableData(RedisBaseTableDataPane.this.updateBean()); DesignKit.previewTableData(RedisBaseTableDataPane.this.updateBean());
} }
} }

43
src/main/java/com/fr/plugin/db/redis/ui/RedisConnectionPane.java

@ -1,20 +1,19 @@
package com.fr.plugin.db.redis.ui; package com.fr.plugin.db.redis.ui;
import com.fr.design.border.UITitledBorder; import com.fr.design.border.UITitledBorder;
import com.fr.design.data.datapane.connect.DatabaseConnectionPane; import com.fanruan.api.design.ui.container.DatabaseConnectionPane;
import com.fr.design.dialog.BasicDialog; import com.fanruan.api.design.ui.container.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fanruan.api.design.ui.container.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIPasswordField; import com.fanruan.api.design.ui.component.UIPasswordField;
import com.fr.design.gui.ilable.ActionLabel; import com.fanruan.api.design.component.UIActionLabel;
import com.fr.design.gui.ilable.UILabel; import com.fanruan.api.design.ui.component.UILabel;
import com.fr.design.gui.itextfield.UIIntNumberField; import com.fanruan.api.design.ui.component.UIIntNumberField;
import com.fr.design.gui.itextfield.UINumberField; import com.fanruan.api.design.ui.component.UINumberField;
import com.fr.design.gui.itextfield.UITextField; import com.fanruan.api.design.ui.component.UITextField;
import com.fr.design.i18n.Toolkit; import com.fanruan.api.design.DesignKit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout; import com.fanruan.api.design.ui.layout.TableLayoutKit;
import com.fr.design.layout.TableLayoutHelper; import com.fanruan.api.design.util.GUICoreKit;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.plugin.db.redis.core.RedisDatabaseConnection; import com.fr.plugin.db.redis.core.RedisDatabaseConnection;
import com.fr.plugin.db.redis.core.pool.RedisConnectionPoolConfig; import com.fr.plugin.db.redis.core.pool.RedisConnectionPoolConfig;
import com.fr.plugin.db.redis.core.pool.RedisConnectionProxyConfig; import com.fr.plugin.db.redis.core.pool.RedisConnectionProxyConfig;
@ -51,14 +50,14 @@ public class RedisConnectionPane extends DatabaseConnectionPane<com.fr.plugin.db
globalConfigPane.setLayout(gridLayout); globalConfigPane.setLayout(gridLayout);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
{new UILabel(Toolkit.i18nText("Plugin-Redis_Host") + ":"), hostTextField}, {new UILabel(DesignKit.i18nText("Plugin-Redis_Host") + ":"), hostTextField},
{new UILabel(Toolkit.i18nText("Plugin-Redis_Port") + ":"), portNumberField}, {new UILabel(DesignKit.i18nText("Plugin-Redis_Port") + ":"), portNumberField},
{new UILabel(Toolkit.i18nText("Plugin-Redis_Password") + ":"), passwordTextField}, {new UILabel(DesignKit.i18nText("Plugin-Redis_Password") + ":"), passwordTextField},
{null, globalConfigPane} {null, globalConfigPane}
}; };
ActionLabel poolConfigLabel = new ActionLabel(Toolkit.i18nText("Plugin-Redis_Pool_Config")); UIActionLabel poolConfigLabel = new UIActionLabel(DesignKit.i18nText("Plugin-Redis_Pool_Config"));
ActionLabel proxyConfigLabel = new ActionLabel(Toolkit.i18nText("Plugin-Redis_Proxy_Config")); UIActionLabel proxyConfigLabel = new UIActionLabel(DesignKit.i18nText("Plugin-Redis_Proxy_Config"));
poolConfigLabel.addActionListener(new ActionListener() { poolConfigLabel.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -99,14 +98,14 @@ public class RedisConnectionPane extends DatabaseConnectionPane<com.fr.plugin.db
dialog.setVisible(true); dialog.setVisible(true);
} }
}); });
globalConfigPane.add(GUICoreUtils.createFlowPane(poolConfigLabel, FlowLayout.LEFT)); globalConfigPane.add(GUICoreKit.createFlowPane(poolConfigLabel, FlowLayout.LEFT));
globalConfigPane.add(GUICoreUtils.createFlowPane(proxyConfigLabel, FlowLayout.LEFT)); globalConfigPane.add(GUICoreKit.createFlowPane(proxyConfigLabel, FlowLayout.LEFT));
double p = TableLayout.PREFERRED; double p = TableLayoutKit.PREFERRED;
double[] rowSize = new double[]{p, p, p, p, p}; double[] rowSize = new double[]{p, p, p, p, p};
double[] columnSize = new double[]{p, 400}; double[] columnSize = new double[]{p, 400};
JPanel settingsUI = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel settingsUI = TableLayoutKit.createTableLayoutPane(components, rowSize, columnSize);
settingsUI.setBorder(UITitledBorder.createBorderWithTitle("Redis")); settingsUI.setBorder(UITitledBorder.createBorderWithTitle("Redis"));
JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); JPanel centerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();

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

@ -2,19 +2,18 @@ package com.fr.plugin.db.redis.ui;
import com.fr.data.impl.Connection; import com.fr.data.impl.Connection;
import com.fr.data.operator.DataOperator; import com.fr.data.operator.DataOperator;
import com.fr.design.data.datapane.connect.ConnectionComboBoxPanel; import com.fanruan.api.design.ui.container.ConnectionComboBoxPanel;
import com.fr.design.gui.ibutton.UIButton; import com.fanruan.api.design.ui.component.UIButton;
import com.fr.design.gui.itextfield.PlaceholderTextField; import com.fanruan.api.design.ui.component.UIPlaceholderTextField;
import com.fr.design.i18n.Toolkit; import com.fanruan.api.design.DesignKit;
import com.fr.file.DatasourceManager; import com.fanruan.api.data.ConnectionKit;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.db.redis.core.RedisDatabaseConnection; import com.fr.plugin.db.redis.core.RedisDatabaseConnection;
import com.fr.plugin.db.redis.ui.event.DataLoadedListener; import com.fr.plugin.db.redis.ui.event.DataLoadedListener;
import com.fanruan.api.util.ArrayKit; import com.fanruan.api.util.ArrayKit;
import com.fanruan.api.util.StringKit; import com.fanruan.api.util.StringKit;
import com.fanruan.api.log.LogKit; import com.fanruan.api.log.LogKit;
import com.fanruan.api.design.ui.container.BasicPane; import com.fanruan.api.design.ui.container.BasicPane;
import com.fanruan.api.design.DesignKit; import com.fanruan.api.design.util.GUICoreKit;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -29,7 +28,7 @@ public class RedisDBConnectionChosePane extends BasicPane {
private ConnectionComboBoxPanel connectionComboBoxPanel; private ConnectionComboBoxPanel connectionComboBoxPanel;
private DefaultListModel listModel = new DefaultListModel(); private DefaultListModel listModel = new DefaultListModel();
private List<DataLoadedListener> listeners = new ArrayList<DataLoadedListener>(); private List<DataLoadedListener> listeners = new ArrayList<DataLoadedListener>();
private PlaceholderTextField keysPatternTextField; private UIPlaceholderTextField keysPatternTextField;
public RedisDBConnectionChosePane() { public RedisDBConnectionChosePane() {
setLayout(new BorderLayout(4, 4)); setLayout(new BorderLayout(4, 4));
@ -49,12 +48,12 @@ public class RedisDBConnectionChosePane extends BasicPane {
}); });
JList list = new JList(listModel); JList list = new JList(listModel);
keysPatternTextField = new PlaceholderTextField(10); keysPatternTextField = new UIPlaceholderTextField(10);
keysPatternTextField.setPlaceholder(Toolkit.i18nText("Plugin-Redis_Keys_Pattern")); keysPatternTextField.setPlaceholder(DesignKit.i18nText("Plugin-Redis_Keys_Pattern"));
JPanel centerPane = new JPanel(new BorderLayout()); JPanel centerPane = new JPanel(new BorderLayout());
UIButton searchButton = new UIButton(Toolkit.i18nText("Plugin-Redis_Keys_Pattern_Search")); UIButton searchButton = new UIButton(DesignKit.i18nText("Plugin-Redis_Keys_Pattern_Search"));
searchButton.addActionListener(new ActionListener() { searchButton.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -62,7 +61,7 @@ public class RedisDBConnectionChosePane extends BasicPane {
} }
}); });
centerPane.add(DesignKit.createBorderLayoutPane( centerPane.add(GUICoreKit.createBorderLayoutPane(
keysPatternTextField, BorderLayout.CENTER, keysPatternTextField, BorderLayout.CENTER,
searchButton, BorderLayout.EAST), BorderLayout.NORTH); searchButton, BorderLayout.EAST), BorderLayout.NORTH);
@ -78,7 +77,7 @@ public class RedisDBConnectionChosePane extends BasicPane {
fireDataLoaded(ArrayKit.EMPTY_STRING_ARRAY); fireDataLoaded(ArrayKit.EMPTY_STRING_ARRAY);
return; return;
} }
RedisDatabaseConnection connection = DatasourceManager.getProviderInstance().getConnection(name, RedisDatabaseConnection.class); RedisDatabaseConnection connection = ConnectionKit.getConnection(name, RedisDatabaseConnection.class);
if (connection != null) { if (connection != null) {
listMatchedPatternKeys(connection); listMatchedPatternKeys(connection);
} }

36
src/main/java/com/fr/plugin/db/redis/ui/RedisQueryPane.java

@ -1,17 +1,17 @@
package com.fr.plugin.db.redis.ui; package com.fr.plugin.db.redis.ui;
import com.fanruan.api.design.ui.container.BasicPane; import com.fanruan.api.design.ui.container.BasicPane;
import com.fanruan.api.layout.LayoutKit; import com.fanruan.api.layout.TableLayoutKit;
import com.fanruan.api.design.DesignKit; import com.fanruan.api.design.util.GUICoreKit;
import com.fanruan.api.log.LogKit; import com.fanruan.api.log.LogKit;
import com.fr.design.data.datapane.sqlpane.SQLEditPane; import com.fanruan.api.design.container.SQLEditPane;
import com.fr.design.editor.ValueEditorPane; import com.fanruan.api.design.ui.editor.ValueEditorPane;
import com.fr.design.gui.ilable.ActionLabel; import com.fanruan.api.design.component.UIActionLabel;
import com.fr.design.gui.ilable.UILabel; import com.fanruan.api.design.ui.component.UILabel;
import com.fr.design.gui.itextarea.DescriptionTextArea; import com.fr.design.gui.itextarea.DescriptionTextArea;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea; import com.fanruan.api.design.ui.component.code.UISyntaxTextArea;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; import com.fanruan.api.design.ui.component.code.SyntaxConstants;
import com.fr.design.i18n.Toolkit; import com.fanruan.api.design.DesignKit;
import com.fr.general.SiteCenter; import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.plugin.db.redis.core.order.OrderValue; import com.fr.plugin.db.redis.core.order.OrderValue;
@ -29,18 +29,18 @@ public class RedisQueryPane extends BasicPane {
private SQLEditPane sqlTextPane; private SQLEditPane sqlTextPane;
private ValueEditorPane dbIndexEditor; private ValueEditorPane dbIndexEditor;
private RSyntaxTextArea scriptTextPane; private UISyntaxTextArea scriptTextPane;
public RedisQueryPane() { public RedisQueryPane() {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
sqlTextPane = new SQLEditPane(); sqlTextPane = new SQLEditPane();
scriptTextPane = new RSyntaxTextArea(); scriptTextPane = new UISyntaxTextArea();
dbIndexEditor = IndexValuePaneFactory.createValueEditorPane(); dbIndexEditor = IndexValuePaneFactory.createValueEditorPane();
ActionLabel helpLabel = new ActionLabel(Toolkit.i18nText("Plugin-Redis_Help")); UIActionLabel helpLabel = new UIActionLabel(DesignKit.i18nText("Plugin-Redis_Help"));
helpLabel.addActionListener(new ActionListener() { helpLabel.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -56,11 +56,11 @@ public class RedisQueryPane extends BasicPane {
descriptionArea.setWrapStyleWord(true); descriptionArea.setWrapStyleWord(true);
descriptionArea.setLineWrap(true); descriptionArea.setLineWrap(true);
descriptionArea.setText(Toolkit.i18nText("Plugin-Redis_Script_Text_Description")); descriptionArea.setText(DesignKit.i18nText("Plugin-Redis_Script_Text_Description"));
Component[][] coms = new Component[][]{ Component[][] coms = new Component[][]{
{new UILabel(Toolkit.i18nText("Plugin-Redis_DB_Index") + ":"), dbIndexEditor}, {new UILabel(DesignKit.i18nText("Plugin-Redis_DB_Index") + ":"), dbIndexEditor},
{DesignKit.createBorderLayoutPane(new UILabel(Toolkit.i18nText("Plugin-Redis_Query_Condition") + ":"), BorderLayout.NORTH), {GUICoreKit.createBorderLayoutPane(new UILabel(DesignKit.i18nText("Plugin-Redis_Query_Condition") + ":"), BorderLayout.NORTH),
RedisDesignUtils.createConditionTextPane(sqlTextPane, SyntaxConstants.SYNTAX_STYLE_SQL, 300)} RedisDesignUtils.createConditionTextPane(sqlTextPane, SyntaxConstants.SYNTAX_STYLE_SQL, 300)}
}; };
@ -68,13 +68,13 @@ public class RedisQueryPane extends BasicPane {
// RedisDesignUtils.createConditionTextPane(scriptTextPane, SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT, 200) // RedisDesignUtils.createConditionTextPane(scriptTextPane, SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT, 200)
// } // }
double p = LayoutKit.PREFERRED; double p = TableLayoutKit.PREFERRED;
double f = LayoutKit.FILL; double f = TableLayoutKit.FILL;
double[] rowSize = {p, p}; double[] rowSize = {p, p};
double[] columnSize = {p, f}; double[] columnSize = {p, f};
add(DesignKit.createTableLayoutPane(coms, rowSize, columnSize)); add(GUICoreKit.createTableLayoutPane(coms, rowSize, columnSize));
} }

26
src/main/java/com/fr/plugin/db/redis/ui/RedisScriptPane.java

@ -1,13 +1,13 @@
package com.fr.plugin.db.redis.ui; package com.fr.plugin.db.redis.ui;
import com.fanruan.api.design.ui.container.BasicPane; import com.fanruan.api.design.ui.container.BasicPane;
import com.fanruan.api.design.util.GUICoreKit;
import com.fanruan.api.layout.TableLayoutKit;
import com.fanruan.api.design.ui.editor.ValueEditorPane;
import com.fanruan.api.design.ui.component.UILabel;
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.fanruan.api.design.DesignKit;
import com.fanruan.api.layout.LayoutKit;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.db.redis.core.order.OrderValue; import com.fr.plugin.db.redis.core.order.OrderValue;
import com.fr.plugin.db.redis.ui.value.IndexValuePaneFactory; import com.fr.plugin.db.redis.ui.value.IndexValuePaneFactory;
import com.fr.plugin.db.redis.util.RedisDesignUtils; import com.fr.plugin.db.redis.util.RedisDesignUtils;
@ -22,29 +22,29 @@ import java.awt.*;
public class RedisScriptPane extends BasicPane { public class RedisScriptPane extends BasicPane {
private ValueEditorPane dbIndexEditor; private ValueEditorPane dbIndexEditor;
private RSyntaxTextArea scriptTextPane; private UISyntaxTextArea scriptTextPane;
public RedisScriptPane() { public RedisScriptPane() {
setLayout(new BorderLayout()); setLayout(new BorderLayout());
scriptTextPane = new RSyntaxTextArea(); scriptTextPane = new UISyntaxTextArea();
dbIndexEditor = IndexValuePaneFactory.createValueEditorPane(); dbIndexEditor = IndexValuePaneFactory.createValueEditorPane();
Component[][] coms = new Component[][]{ Component[][] coms = new Component[][]{
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Plugin-Redis_DB_Index") + ":"), dbIndexEditor}, {new UILabel(DesignKit.i18nText("Plugin-Redis_DB_Index") + ":"), dbIndexEditor},
{new UILabel(Toolkit.i18nText("Plugin-Redis_Script_Query_Text") + ":"), {new UILabel(DesignKit.i18nText("Plugin-Redis_Script_Query_Text") + ":"),
RedisDesignUtils.createConditionTextPane(scriptTextPane, SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT, 350)}, RedisDesignUtils.createConditionTextPane(scriptTextPane, SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT, 350)},
}; };
double p = LayoutKit.PREFERRED; double p = TableLayoutKit.PREFERRED;
double f = LayoutKit.FILL; double f = TableLayoutKit.FILL;
double[] rowSize = {p, p, p}; double[] rowSize = {p, p, p};
double[] columnSize = {p, f}; double[] columnSize = {p, f};
add(DesignKit.createTableLayoutPane(coms, rowSize, columnSize)); add(GUICoreKit.createTableLayoutPane(coms, rowSize, columnSize));
} }

2
src/main/java/com/fr/plugin/db/redis/ui/RedisScriptTableDataPane.java

@ -1,6 +1,6 @@
package com.fr.plugin.db.redis.ui; package com.fr.plugin.db.redis.ui;
import com.fr.data.impl.NameDatabaseConnection; import com.fanruan.api.database.nameDatabase.NameDatabaseConnection;
import com.fr.plugin.db.redis.core.RedisScriptTableData; import com.fr.plugin.db.redis.core.RedisScriptTableData;
import com.fr.plugin.db.redis.core.order.OrderValue; import com.fr.plugin.db.redis.core.order.OrderValue;
import com.fr.script.Calculator; import com.fr.script.Calculator;

6
src/main/java/com/fr/plugin/db/redis/ui/RedisTableDataPane.java

@ -1,7 +1,7 @@
package com.fr.plugin.db.redis.ui; package com.fr.plugin.db.redis.ui;
import com.fr.data.impl.NameDatabaseConnection; import com.fanruan.api.design.DesignKit;
import com.fr.design.i18n.Toolkit; import com.fanruan.api.database.nameDatabase.NameDatabaseConnection;
import com.fr.plugin.db.redis.core.RedisTableData; import com.fr.plugin.db.redis.core.RedisTableData;
import com.fr.plugin.db.redis.core.order.OrderValue; import com.fr.plugin.db.redis.core.order.OrderValue;
import com.fr.script.Calculator; import com.fr.script.Calculator;
@ -24,7 +24,7 @@ public class RedisTableDataPane extends RedisBaseTableDataPane<RedisTableData> {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Toolkit.i18nText("Plugin-Redis_Query"); return DesignKit.i18nText("Plugin-Redis_Query");
} }
protected JComponent createQueryPane() { protected JComponent createQueryPane() {

32
src/main/java/com/fr/plugin/db/redis/ui/pool/RedisConnectionPoolConfigPane.java

@ -1,13 +1,13 @@
package com.fr.plugin.db.redis.ui.pool; package com.fr.plugin.db.redis.ui.pool;
import com.fanruan.api.design.ui.container.BasicPane; import com.fanruan.api.design.ui.container.BasicPane;
import com.fanruan.api.layout.LayoutKit; import com.fanruan.api.layout.TableLayoutKit;
import com.fanruan.api.design.util.GUICoreKit;
import com.fanruan.api.design.ui.component.UICheckBox;
import com.fanruan.api.design.ui.component.UILabel;
import com.fanruan.api.design.ui.component.UIIntNumberField;
import com.fanruan.api.design.ui.component.UINumberField;
import com.fanruan.api.design.DesignKit; import com.fanruan.api.design.DesignKit;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UIIntNumberField;
import com.fr.design.gui.itextfield.UINumberField;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.db.redis.core.pool.RedisConnectionPoolConfig; import com.fr.plugin.db.redis.core.pool.RedisConnectionPoolConfig;
import javax.swing.*; import javax.swing.*;
@ -43,24 +43,24 @@ public class RedisConnectionPoolConfigPane extends BasicPane {
timeoutNumberField = new UIIntNumberField(); timeoutNumberField = new UIIntNumberField();
JComponent[][] comps = new JComponent[][]{ JComponent[][] comps = new JComponent[][]{
{new UILabel(Toolkit.i18nText("Plugin-Redis_Pool_Max_Total") + ":"), maxTotalNumberFiled}, {new UILabel(DesignKit.i18nText("Plugin-Redis_Pool_Max_Total") + ":"), maxTotalNumberFiled},
{new UILabel(Toolkit.i18nText("Plugin-Redis_Pool_Max_Wait") + ":"), maxWaitNumberField}, {new UILabel(DesignKit.i18nText("Plugin-Redis_Pool_Max_Wait") + ":"), maxWaitNumberField},
{new UILabel(Toolkit.i18nText("Plugin-Redis_Pool_Max_Idle") + ":"), maxIdleNumberField}, {new UILabel(DesignKit.i18nText("Plugin-Redis_Pool_Max_Idle") + ":"), maxIdleNumberField},
{new UILabel(Toolkit.i18nText("Plugin-Redis_Pool_Block_When_Exhausted") + ":"), blockWhenExhaustedCheckBox}, {new UILabel(DesignKit.i18nText("Plugin-Redis_Pool_Block_When_Exhausted") + ":"), blockWhenExhaustedCheckBox},
{new UILabel(Toolkit.i18nText("Plugin-Redis_Pool_Lifo") + ":"), lifoCheckBox}, {new UILabel(DesignKit.i18nText("Plugin-Redis_Pool_Lifo") + ":"), lifoCheckBox},
{new UILabel(Toolkit.i18nText("Plugin-Redis_Pool_Timeout") + ":"), timeoutNumberField} {new UILabel(DesignKit.i18nText("Plugin-Redis_Pool_Timeout") + ":"), timeoutNumberField}
}; };
double p = LayoutKit.PREFERRED; double p = TableLayoutKit.PREFERRED;
double f = LayoutKit.FILL; double f = TableLayoutKit.FILL;
double[] rowSize = new double[]{p, p, p, p, p, p}; double[] rowSize = new double[]{p, p, p, p, p, p};
double[] columnSize = new double[]{p, f}; double[] columnSize = new double[]{p, f};
add(DesignKit.createTableLayoutPane(comps, rowSize, columnSize), BorderLayout.CENTER); add(GUICoreKit.createTableLayoutPane(comps, rowSize, columnSize), BorderLayout.CENTER);
} }
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Toolkit.i18nText("Plugin-Redis_Pool_Config"); return DesignKit.i18nText("Plugin-Redis_Pool_Config");
} }
public void populate(RedisConnectionPoolConfig config) { public void populate(RedisConnectionPoolConfig config) {

40
src/main/java/com/fr/plugin/db/redis/ui/proxy/RedisConnectionProxyConfigPane.java

@ -1,15 +1,15 @@
package com.fr.plugin.db.redis.ui.proxy; package com.fr.plugin.db.redis.ui.proxy;
import com.fanruan.api.design.ui.container.BasicPane; import com.fanruan.api.design.ui.container.BasicPane;
import com.fanruan.api.layout.LayoutKit; import com.fanruan.api.layout.TableLayoutKit;
import com.fanruan.api.design.util.GUICoreKit;
import com.fanruan.api.design.ui.component.UIButton;
import com.fanruan.api.design.ui.component.UICheckBox;
import com.fanruan.api.design.ui.component.UILabel;
import com.fanruan.api.design.ui.component.UIPassWordField;
import com.fanruan.api.design.ui.component.UIIntNumberField;
import com.fanruan.api.design.ui.component.UITextField;
import com.fanruan.api.design.DesignKit; import com.fanruan.api.design.DesignKit;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ipasswordfield.UIPassWordField;
import com.fr.design.gui.itextfield.UIIntNumberField;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.plugin.db.redis.core.pool.RedisConnectionProxyConfig; import com.fr.plugin.db.redis.core.pool.RedisConnectionProxyConfig;
import javax.swing.*; import javax.swing.*;
@ -46,22 +46,22 @@ public class RedisConnectionProxyConfigPane extends BasicPane {
passwordTextField = new UIPassWordField(); passwordTextField = new UIPassWordField();
privateKeyPathTextField = new UITextField(); privateKeyPathTextField = new UITextField();
privateKeyPathTextField.setPlaceholder(Toolkit.i18nText("Plugin-Redis_Proxy_Private_Key_Tip")); privateKeyPathTextField.setPlaceholder(DesignKit.i18nText("Plugin-Redis_Proxy_Private_Key_Tip"));
UIButton fileSelectButton = new UIButton("..."); UIButton fileSelectButton = new UIButton("...");
UILabel description = new UILabel(Toolkit.i18nText("Plugin-Redis_Proxy_Description"), SwingConstants.CENTER); UILabel description = new UILabel(DesignKit.i18nText("Plugin-Redis_Proxy_Description"), SwingConstants.CENTER);
JComponent[][] comps = new JComponent[][]{ JComponent[][] comps = new JComponent[][]{
{new UILabel(Toolkit.i18nText("Plugin-Redis_Proxy_Open") + ":"), DesignKit.createBorderLayoutPane( {new UILabel(DesignKit.i18nText("Plugin-Redis_Proxy_Open") + ":"), GUICoreKit.createBorderLayoutPane(
openCheckBox, BorderLayout.WEST, openCheckBox, BorderLayout.WEST,
description, BorderLayout.CENTER description, BorderLayout.CENTER
)}, )},
{new UILabel(Toolkit.i18nText("Plugin-Redis_Proxy_Host") + ":"), hostTextField}, {new UILabel(DesignKit.i18nText("Plugin-Redis_Proxy_Host") + ":"), hostTextField},
{new UILabel(Toolkit.i18nText("Plugin-Redis_Proxy_Port") + ":"), portNumberField}, {new UILabel(DesignKit.i18nText("Plugin-Redis_Proxy_Port") + ":"), portNumberField},
{new UILabel(Toolkit.i18nText("Plugin-Redis_Proxy_Username") + ":"), usernameTextField}, {new UILabel(DesignKit.i18nText("Plugin-Redis_Proxy_Username") + ":"), usernameTextField},
{new UILabel(Toolkit.i18nText("Plugin-Redis_Proxy_Password") + ":"), passwordTextField}, {new UILabel(DesignKit.i18nText("Plugin-Redis_Proxy_Password") + ":"), passwordTextField},
{new UILabel(Toolkit.i18nText("Plugin-Redis_Proxy_Private_Key_Path") + ":"), DesignKit.createBorderLayoutPane( {new UILabel(DesignKit.i18nText("Plugin-Redis_Proxy_Private_Key_Path") + ":"), GUICoreKit.createBorderLayoutPane(
privateKeyPathTextField, BorderLayout.CENTER, privateKeyPathTextField, BorderLayout.CENTER,
fileSelectButton, BorderLayout.EAST fileSelectButton, BorderLayout.EAST
)}, )},
@ -78,18 +78,18 @@ public class RedisConnectionProxyConfigPane extends BasicPane {
} }
}); });
double p = LayoutKit.PREFERRED; double p = TableLayoutKit.PREFERRED;
double f = LayoutKit.FILL; double f = TableLayoutKit.FILL;
double[] rowSize = new double[]{p, p, p, p, p, p}; double[] rowSize = new double[]{p, p, p, p, p, p};
double[] columnSize = new double[]{p, f}; double[] columnSize = new double[]{p, f};
add(DesignKit.createTableLayoutPane(comps, rowSize, columnSize), BorderLayout.CENTER); add(GUICoreKit.createTableLayoutPane(comps, rowSize, columnSize), BorderLayout.CENTER);
} }
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return Toolkit.i18nText("Plugin-Redis_Proxy_Config"); return DesignKit.i18nText("Plugin-Redis_Proxy_Config");
} }
public void populate(RedisConnectionProxyConfig config) { public void populate(RedisConnectionProxyConfig config) {

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

@ -1,12 +1,12 @@
package com.fr.plugin.db.redis.ui.value; package com.fr.plugin.db.redis.ui.value;
import com.fr.base.BaseFormula; import com.fr.base.BaseFormula;
import com.fr.design.dialog.DialogActionAdapter; import com.fanruan.api.design.ui.container.DialogActionAdapter;
import com.fr.design.editor.editor.Editor; import com.fanruan.api.design.ui.editor.Editor;
import com.fr.design.formula.FormulaFactory; import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.UIFormula; import com.fr.design.formula.UIFormula;
import com.fr.design.gui.itextfield.UITextField; import com.fanruan.api.design.ui.component.UITextField;
import com.fr.design.i18n.Toolkit; import com.fanruan.api.design.DesignKit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.plugin.db.redis.core.order.impl.FormulaOrderValue; import com.fr.plugin.db.redis.core.order.impl.FormulaOrderValue;
@ -27,7 +27,7 @@ public class FormulaEditor extends Editor<FormulaOrderValue> {
* Constructor. * Constructor.
*/ */
public FormulaEditor() { public FormulaEditor() {
this(Toolkit.i18nText("Plugin-Redis_Formula")); this(DesignKit.i18nText("Plugin-Redis_Formula"));
} }
public FormulaEditor(String name) { public FormulaEditor(String name) {

6
src/main/java/com/fr/plugin/db/redis/ui/value/IndexValuePaneFactory.java

@ -1,8 +1,8 @@
package com.fr.plugin.db.redis.ui.value; package com.fr.plugin.db.redis.ui.value;
import com.fr.design.editor.ValueEditorPane; import com.fanruan.api.design.ui.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory; import com.fanruan.api.design.ui.editor.ValueEditorPane;
import com.fr.design.editor.editor.Editor; import com.fanruan.api.design.ui.editor.Editor;
public class IndexValuePaneFactory { public class IndexValuePaneFactory {

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

@ -1,9 +1,9 @@
package com.fr.plugin.db.redis.ui.value; package com.fr.plugin.db.redis.ui.value;
import com.fr.base.Utils; import com.fanruan.api.util.GeneralKit;
import com.fr.design.editor.editor.Editor; import com.fanruan.api.design.ui.editor.Editor;
import com.fr.design.gui.itextfield.UIIntNumberField; import com.fanruan.api.design.ui.component.UIIntNumberField;
import com.fr.design.gui.itextfield.UITextField; import com.fanruan.api.design.ui.component.UITextField;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.plugin.db.redis.core.order.impl.NumberOrderValue; import com.fr.plugin.db.redis.core.order.impl.NumberOrderValue;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -101,7 +101,7 @@ public class IntegerEditor extends Editor<NumberOrderValue> {
value = new NumberOrderValue(0); value = new NumberOrderValue(0);
} }
this.numberField.setValue(value.getValue()); this.numberField.setValue(value.getValue());
oldValue = Utils.objectToString(value); oldValue = GeneralKit.objectToString(value);
} }

8
src/main/java/com/fr/plugin/db/redis/util/RedisDesignUtils.java

@ -2,8 +2,8 @@ package com.fr.plugin.db.redis.util;
import com.fr.design.border.UIRoundedBorder; import com.fr.design.border.UIRoundedBorder;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.syntax.ui.rsyntaxtextarea.RSyntaxTextArea; import com.fanruan.api.design.ui.component.code.UISyntaxTextArea;
import com.fr.design.gui.syntax.ui.rtextarea.RTextScrollPane; import com.fanruan.api.design.ui.component.code.UISyntaxTextScrollPane;
import java.awt.*; import java.awt.*;
@ -13,9 +13,9 @@ import java.awt.*;
* Created by richie on 2019-03-18 * Created by richie on 2019-03-18
*/ */
public class RedisDesignUtils { public class RedisDesignUtils {
public static RTextScrollPane createConditionTextPane(RSyntaxTextArea editorPane, String type, int height) { public static UISyntaxTextScrollPane createConditionTextPane(UISyntaxTextArea editorPane, String type, int height) {
editorPane.setSyntaxEditingStyle(type); editorPane.setSyntaxEditingStyle(type);
RTextScrollPane sqlTextScrollPane = new RTextScrollPane(editorPane); UISyntaxTextScrollPane sqlTextScrollPane = new UISyntaxTextScrollPane(editorPane);
sqlTextScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC)); sqlTextScrollPane.setBorder(new UIRoundedBorder(UIConstants.LINE_COLOR, 1, UIConstants.ARC));
sqlTextScrollPane.setPreferredSize(new Dimension(680, height)); sqlTextScrollPane.setPreferredSize(new Dimension(680, height));
sqlTextScrollPane.setLineNumbersEnabled(false); sqlTextScrollPane.setLineNumbersEnabled(false);

6
src/main/java/com/fr/plugin/db/redis/util/RedisUtils.java

@ -1,8 +1,8 @@
package com.fr.plugin.db.redis.util; package com.fr.plugin.db.redis.util;
import com.eclipsesource.v8.V8Object; import com.eclipsesource.v8.V8Object;
import com.fr.base.Parameter; import com.fr.stable.ParameterProvider;
import com.fr.base.TemplateUtils; import com.fanruan.api.util.RenderKit;
import com.fr.plugin.db.redis.help.ScriptBridge; import com.fr.plugin.db.redis.help.ScriptBridge;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.third.redis.clients.jedis.Jedis; import com.fr.third.redis.clients.jedis.Jedis;
@ -35,7 +35,7 @@ public class RedisUtils {
map.put(p.getName(), p.getValue()); map.put(p.getName(), p.getValue());
} }
try { try {
return TemplateUtils.renderParameter4Tpl(query, map); return RenderKit.renderParameter4Tpl(query, map);
} catch (Exception e) { } catch (Exception e) {
return query; return query;
} }

Loading…
Cancel
Save