Browse Source

update: 将holderKit.Conf还原为Conf

paid
zjz1993 5 years ago
parent
commit
774b52ab2f
  1. 13
      src/main/java/com/fr/plugin/db/redis/core/RedisDatabaseConnection.java
  2. 13
      src/main/java/com/fr/plugin/db/redis/core/RedisNode.java
  3. 13
      src/main/java/com/fr/plugin/db/redis/core/RedisScriptTableData.java
  4. 18
      src/main/java/com/fr/plugin/db/redis/core/RedisTableData.java
  5. 25
      src/main/java/com/fr/plugin/db/redis/core/pool/RedisConnectionPoolConfig.java
  6. 25
      src/main/java/com/fr/plugin/db/redis/core/pool/RedisConnectionProxyConfig.java

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

@ -13,6 +13,7 @@ import com.fanruan.api.util.StringKit;
import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import com.fr.third.redis.clients.jedis.Jedis; import com.fr.third.redis.clients.jedis.Jedis;
import com.fr.config.holder.Conf;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
@ -23,9 +24,9 @@ public class RedisDatabaseConnection extends AbstractDatabaseConnection {
private static final int DEFAULT_REDIS_PORT = 6379; private static final int DEFAULT_REDIS_PORT = 6379;
private HolderKit.Conf<String> host = HolderKit.simple(StringKit.EMPTY); private Conf<String> host = HolderKit.simple(StringKit.EMPTY);
private HolderKit.Conf<Integer> port = HolderKit.simple(DEFAULT_REDIS_PORT); private Conf<Integer> port = HolderKit.simple(DEFAULT_REDIS_PORT);
private HolderKit.Conf<String> password = HolderKit.simple(StringKit.EMPTY); private Conf<String> password = HolderKit.simple(StringKit.EMPTY);
public RedisDatabaseConnection() { public RedisDatabaseConnection() {
@ -167,9 +168,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 = (HolderKit.Conf<String>) host.clone(); cloned.host = (Conf<String>) host.clone();
cloned.port = (HolderKit.Conf<Integer>) port.clone(); cloned.port = (Conf<Integer>) port.clone();
cloned.password = (HolderKit.Conf<String>) password.clone(); cloned.password = (Conf<String>) password.clone();
return cloned; return cloned;
} }
} }

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

@ -4,6 +4,7 @@ import com.fanruan.api.conf.HolderKit;
import com.fanruan.api.conf.BaseUniqueKey; import com.fanruan.api.conf.BaseUniqueKey;
import com.fanruan.api.util.AssistKit; import com.fanruan.api.util.AssistKit;
import com.fanruan.api.util.StringKit; import com.fanruan.api.util.StringKit;
import com.fr.config.holder.Conf;
/** /**
* @author richie * @author richie
@ -14,9 +15,9 @@ public class RedisNode extends BaseUniqueKey {
public static final int DEFAULT_REDIS_PORT = 6379; public static final int DEFAULT_REDIS_PORT = 6379;
private HolderKit.Conf<String> host = HolderKit.simple(StringKit.EMPTY); private Conf<String> host = HolderKit.simple(StringKit.EMPTY);
private HolderKit.Conf<Integer> port = HolderKit.simple(DEFAULT_REDIS_PORT); private Conf<Integer> port = HolderKit.simple(DEFAULT_REDIS_PORT);
private HolderKit.Conf<String> password = HolderKit.simple(StringKit.EMPTY); private 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);
@ -64,9 +65,9 @@ public class RedisNode extends BaseUniqueKey {
@Override @Override
public Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
RedisNode cloned = (RedisNode) super.clone(); RedisNode cloned = (RedisNode) super.clone();
cloned.host = (HolderKit.Conf<String>) host.clone(); cloned.host = (Conf<String>) host.clone();
cloned.port = (HolderKit.Conf<Integer>) port.clone(); cloned.port = (Conf<Integer>) port.clone();
cloned.password = (HolderKit.Conf<String>) password.clone(); cloned.password = (Conf<String>) password.clone();
return cloned; return cloned;
} }
} }

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

@ -22,6 +22,7 @@ import com.fr.stable.ParameterProvider;
import com.fanruan.api.util.StringKit; import com.fanruan.api.util.StringKit;
import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import com.fr.config.holder.Conf;
/** /**
* @author richie * @author richie
@ -33,9 +34,9 @@ public class RedisScriptTableData extends AbstractParameterTableData {
private static final long serialVersionUID = 1525853354993816818L; private static final long serialVersionUID = 1525853354993816818L;
private HolderKit.Conf<Connection> database = HolderKit.obj(null, Connection.class); private Conf<Connection> database = HolderKit.obj(null, Connection.class);
private HolderKit.Conf<OrderValue> dbIndex = XmlHolders.obj(new NumberOrderValue(0), OrderValue.class, OrderValue.XML_TAG); private Conf<OrderValue> dbIndex = XmlHolders.obj(new NumberOrderValue(0), OrderValue.class, OrderValue.XML_TAG);
private HolderKit.Conf<String> script = HolderKit.simple(StringKit.EMPTY); private 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);
@ -135,9 +136,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 = (HolderKit.Conf<Connection>) database.clone(); cloned.database = (Conf<Connection>) database.clone();
cloned.script = (HolderKit.Conf<String>) script.clone(); cloned.script = (Conf<String>) script.clone();
cloned.dbIndex = (HolderKit.Conf<OrderValue>) dbIndex.clone(); cloned.dbIndex = (Conf<OrderValue>) dbIndex.clone();
return cloned; return cloned;
} }
} }

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

@ -24,6 +24,8 @@ import com.fanruan.api.util.StringKit;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader; import com.fr.stable.xml.XMLableReader;
import com.fr.config.holder.Conf;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -33,10 +35,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 HolderKit.Conf<Connection> database = HolderKit.obj(null, Connection.class); private Conf<Connection> database = HolderKit.obj(null, Connection.class);
private HolderKit.Conf<OrderValue> dbIndex = XmlHolders.obj(new NumberOrderValue(0), OrderValue.class, OrderValue.XML_TAG); private Conf<OrderValue> dbIndex = XmlHolders.obj(new NumberOrderValue(0), OrderValue.class, OrderValue.XML_TAG);
private HolderKit.Conf<String> query = HolderKit.simple(StringKit.EMPTY); private Conf<String> query = HolderKit.simple(StringKit.EMPTY);
private HolderKit.Conf<String> script = HolderKit.simple(StringKit.EMPTY); private 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);
@ -153,10 +155,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 = (HolderKit.Conf<Connection>) database.clone(); cloned.database = (Conf<Connection>) database.clone();
cloned.query = (HolderKit.Conf<String>) query.clone(); cloned.query = (Conf<String>) query.clone();
cloned.script = (HolderKit.Conf<String>) script.clone(); cloned.script = (Conf<String>) script.clone();
cloned.dbIndex = (HolderKit.Conf<OrderValue>) dbIndex.clone(); cloned.dbIndex = (Conf<OrderValue>) dbIndex.clone();
return cloned; return cloned;
} }
} }

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

@ -3,6 +3,7 @@ package com.fr.plugin.db.redis.core.pool;
import com.fr.config.ConfigContext; import com.fr.config.ConfigContext;
import com.fanruan.api.conf.BaseConfiguration; import com.fanruan.api.conf.BaseConfiguration;
import com.fanruan.api.conf.HolderKit; import com.fanruan.api.conf.HolderKit;
import com.fr.config.holder.Conf;
import javax.xml.ws.Holder; import javax.xml.ws.Holder;
@ -27,12 +28,12 @@ public class RedisConnectionPoolConfig extends BaseConfiguration {
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 HolderKit.Conf<Integer> maxTotal = HolderKit.simple(MAX_TOTAL); private Conf<Integer> maxTotal = HolderKit.simple(MAX_TOTAL);
private HolderKit.Conf<Integer> maxWait = HolderKit.simple(MAX_WAIT); private Conf<Integer> maxWait = HolderKit.simple(MAX_WAIT);
private HolderKit.Conf<Integer> maxIdle = HolderKit.simple(MAX_IDLE); private Conf<Integer> maxIdle = HolderKit.simple(MAX_IDLE);
private HolderKit.Conf<Boolean> blockWhenExhausted = HolderKit.simple(true); private Conf<Boolean> blockWhenExhausted = HolderKit.simple(true);
private HolderKit.Conf<Boolean> lifo = HolderKit.simple(true); private Conf<Boolean> lifo = HolderKit.simple(true);
private HolderKit.Conf<Integer> timeout = HolderKit.simple(TIME_OUT); private Conf<Integer> timeout = HolderKit.simple(TIME_OUT);
public int getMaxTotal() { public int getMaxTotal() {
return maxTotal.get(); return maxTotal.get();
@ -85,12 +86,12 @@ public class RedisConnectionPoolConfig extends BaseConfiguration {
@Override @Override
public Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
RedisConnectionPoolConfig cloned = (RedisConnectionPoolConfig) super.clone(); RedisConnectionPoolConfig cloned = (RedisConnectionPoolConfig) super.clone();
cloned.maxTotal = (HolderKit.Conf<Integer>) maxTotal.clone(); cloned.maxTotal = (Conf<Integer>) maxTotal.clone();
cloned.maxWait = (HolderKit.Conf<Integer>) maxWait.clone(); cloned.maxWait = (Conf<Integer>) maxWait.clone();
cloned.maxIdle = (HolderKit.Conf<Integer>) maxIdle.clone(); cloned.maxIdle = (Conf<Integer>) maxIdle.clone();
cloned.blockWhenExhausted = (HolderKit.Conf<Boolean>) blockWhenExhausted.clone(); cloned.blockWhenExhausted = (Conf<Boolean>) blockWhenExhausted.clone();
cloned.lifo = (HolderKit.Conf<Boolean>) lifo.clone(); cloned.lifo = (Conf<Boolean>) lifo.clone();
cloned.timeout = (HolderKit.Conf<Integer>) timeout.clone(); cloned.timeout = (Conf<Integer>) timeout.clone();
return cloned; return cloned;
} }
} }

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

@ -5,6 +5,7 @@ import com.fanruan.api.conf.BaseConfiguration;
import com.fanruan.api.conf.HolderKit; import com.fanruan.api.conf.HolderKit;
import com.fanruan.api.security.SecurityKit; import com.fanruan.api.security.SecurityKit;
import com.fanruan.api.util.StringKit; import com.fanruan.api.util.StringKit;
import com.fr.config.holder.Conf;
/** /**
* @author richie * @author richie
@ -22,17 +23,17 @@ public class RedisConnectionProxyConfig extends BaseConfiguration {
return instance; return instance;
} }
private HolderKit.Conf<Boolean> open = HolderKit.simple(false); private Conf<Boolean> open = HolderKit.simple(false);
private HolderKit.Conf<String> host = HolderKit.simple(StringKit.EMPTY); private Conf<String> host = HolderKit.simple(StringKit.EMPTY);
private HolderKit.Conf<Integer> port = HolderKit.simple(22); private Conf<Integer> port = HolderKit.simple(22);
private HolderKit.Conf<String> username = HolderKit.simple(StringKit.EMPTY); private Conf<String> username = HolderKit.simple(StringKit.EMPTY);
private HolderKit.Conf<String> password = HolderKit.simple(StringKit.EMPTY); private Conf<String> password = HolderKit.simple(StringKit.EMPTY);
private HolderKit.Conf<String> privateKeyPath = HolderKit.simple(StringKit.EMPTY); private Conf<String> privateKeyPath = HolderKit.simple(StringKit.EMPTY);
public boolean isOpen() { public boolean isOpen() {
@ -87,12 +88,12 @@ public class RedisConnectionProxyConfig extends BaseConfiguration {
@Override @Override
public Object clone() throws CloneNotSupportedException { public Object clone() throws CloneNotSupportedException {
RedisConnectionProxyConfig cloned = (RedisConnectionProxyConfig) super.clone(); RedisConnectionProxyConfig cloned = (RedisConnectionProxyConfig) super.clone();
cloned.open = (HolderKit.Conf<Boolean>) open.clone(); cloned.open = (Conf<Boolean>) open.clone();
cloned.host = (HolderKit.Conf<String>) host.clone(); cloned.host = (Conf<String>) host.clone();
cloned.port = (HolderKit.Conf<Integer>) port.clone(); cloned.port = (Conf<Integer>) port.clone();
cloned.username = (HolderKit.Conf<String>) username.clone(); cloned.username = (Conf<String>) username.clone();
cloned.password = (HolderKit.Conf<String>) password.clone(); cloned.password = (Conf<String>) password.clone();
cloned.privateKeyPath = (HolderKit.Conf<String>) privateKeyPath.clone(); cloned.privateKeyPath = (Conf<String>) privateKeyPath.clone();
return cloned; return cloned;
} }
} }

Loading…
Cancel
Save