|
|
|
package com.fr.plugin.db.redis.core.pool;
|
|
|
|
|
|
|
|
import com.fr.config.ConfigContext;
|
|
|
|
import com.fr.config.DefaultConfiguration;
|
|
|
|
import com.fr.config.holder.Conf;
|
|
|
|
import com.fr.config.holder.factory.Holders;
|
|
|
|
import com.fr.security.SecurityToolbox;
|
|
|
|
import com.fr.stable.StringUtils;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author richie
|
|
|
|
* @version 10.0
|
|
|
|
* Created by richie on 2019-03-21
|
|
|
|
*/
|
|
|
|
public class RedisConnectionProxyConfig extends DefaultConfiguration {
|
|
|
|
|
|
|
|
private static volatile RedisConnectionProxyConfig instance = null;
|
|
|
|
|
|
|
|
public static RedisConnectionProxyConfig getInstance() {
|
|
|
|
if (instance == null) {
|
|
|
|
instance = ConfigContext.getConfigInstance(RedisConnectionProxyConfig.class);
|
|
|
|
}
|
|
|
|
return instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
private Conf<Boolean> open = Holders.simple(false);
|
|
|
|
|
|
|
|
private Conf<String> host = Holders.simple(StringUtils.EMPTY);
|
|
|
|
|
|
|
|
private Conf<Integer> port = Holders.simple(22);
|
|
|
|
|
|
|
|
private Conf<String> username = Holders.simple(StringUtils.EMPTY);
|
|
|
|
|
|
|
|
private Conf<String> password = Holders.simple(StringUtils.EMPTY);
|
|
|
|
|
|
|
|
private Conf<String> privateKeyPath = Holders.simple(StringUtils.EMPTY);
|
|
|
|
|
|
|
|
|
|
|
|
public boolean isOpen() {
|
|
|
|
return open.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setOpen(boolean open) {
|
|
|
|
this.open.set(open);
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getHost() {
|
|
|
|
return host.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setHost(String host) {
|
|
|
|
this.host.set(host);
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getPort() {
|
|
|
|
return port.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setPort(int port) {
|
|
|
|
this.port.set(port);
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getUsername() {
|
|
|
|
return username.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setUsername(String username) {
|
|
|
|
this.username.set(username);
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getPassword() {
|
|
|
|
String text = password.get();
|
|
|
|
return SecurityToolbox.decrypt(text);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setPassword(String password) {
|
|
|
|
this.password.set(SecurityToolbox.encrypt(password));
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getPrivateKeyPath() {
|
|
|
|
return privateKeyPath.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setPrivateKeyPath(String privateKeyPath) {
|
|
|
|
this.privateKeyPath.set(privateKeyPath);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Object clone() throws CloneNotSupportedException {
|
|
|
|
RedisConnectionProxyConfig cloned = (RedisConnectionProxyConfig) super.clone();
|
|
|
|
cloned.open = (Conf<Boolean>) open.clone();
|
|
|
|
cloned.host = (Conf<String>) host.clone();
|
|
|
|
cloned.port = (Conf<Integer>) port.clone();
|
|
|
|
cloned.username = (Conf<String>) username.clone();
|
|
|
|
cloned.password = (Conf<String>) password.clone();
|
|
|
|
cloned.privateKeyPath = (Conf<String>) privateKeyPath.clone();
|
|
|
|
return cloned;
|
|
|
|
}
|
|
|
|
}
|