You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
2.7 KiB
100 lines
2.7 KiB
package com.fr.plugin.db.redis.core.pool; |
|
|
|
import com.fanruan.api.conf.BaseConfiguration; |
|
import com.fanruan.api.conf.HolderKit; |
|
import com.fanruan.api.security.SecurityKit; |
|
import com.fanruan.api.util.StringKit; |
|
import com.fr.config.holder.Conf; |
|
import com.fr.third.fasterxml.jackson.annotation.JsonIgnoreProperties; |
|
|
|
/** |
|
* @author richie |
|
* @version 10.0 |
|
* Created by richie on 2019-03-21 |
|
*/ |
|
@JsonIgnoreProperties("nameSpace") |
|
public class RedisConnectionProxyConfig extends BaseConfiguration { |
|
|
|
private static volatile RedisConnectionProxyConfig instance = null; |
|
|
|
public static RedisConnectionProxyConfig getInstance() { |
|
if (instance == null) { |
|
instance = getConfigInstance(RedisConnectionProxyConfig.class); |
|
} |
|
return instance; |
|
} |
|
|
|
private Conf<Boolean> open = HolderKit.simple(false); |
|
|
|
private Conf<String> host = HolderKit.simple(StringKit.EMPTY); |
|
|
|
private Conf<Integer> port = HolderKit.simple(22); |
|
|
|
private Conf<String> username = HolderKit.simple(StringKit.EMPTY); |
|
|
|
private Conf<String> password = HolderKit.simple(StringKit.EMPTY); |
|
|
|
private Conf<String> privateKeyPath = HolderKit.simple(StringKit.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 SecurityKit.decrypt(text); |
|
} |
|
|
|
public void setPassword(String password) { |
|
this.password.set(SecurityKit.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; |
|
} |
|
}
|
|
|