reformat some code
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
package me.chanjar.weixin.cp.api;
|
package me.chanjar.weixin.cp.api;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import me.chanjar.weixin.common.bean.WxAccessToken;
|
import me.chanjar.weixin.common.bean.WxAccessToken;
|
||||||
import me.chanjar.weixin.common.util.http.ApacheHttpClientBuilder;
|
import me.chanjar.weixin.common.util.http.ApacheHttpClientBuilder;
|
||||||
import redis.clients.jedis.Jedis;
|
import redis.clients.jedis.Jedis;
|
||||||
import redis.clients.jedis.JedisPool;
|
import redis.clients.jedis.JedisPool;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Jedis client implementor for wechat config storage
|
* Jedis client implementor for wechat config storage
|
||||||
*
|
*
|
||||||
@@ -19,34 +19,26 @@ public class WxCpJedisConfigStorage implements WxCpConfigStorage {
|
|||||||
private static final String ACCESS_TOKEN_EXPIRES_TIME_KEY = "WX_CP_ACCESS_TOKEN_EXPIRES_TIME";
|
private static final String ACCESS_TOKEN_EXPIRES_TIME_KEY = "WX_CP_ACCESS_TOKEN_EXPIRES_TIME";
|
||||||
private static final String JS_API_TICKET_KEY = "WX_CP_JS_API_TICKET";
|
private static final String JS_API_TICKET_KEY = "WX_CP_JS_API_TICKET";
|
||||||
private static final String JS_API_TICKET_EXPIRES_TIME_KEY = "WX_CP_JS_API_TICKET_EXPIRES_TIME";
|
private static final String JS_API_TICKET_EXPIRES_TIME_KEY = "WX_CP_JS_API_TICKET_EXPIRES_TIME";
|
||||||
|
/* Redis clients pool */
|
||||||
|
private final JedisPool jedisPool;
|
||||||
private volatile String corpId;
|
private volatile String corpId;
|
||||||
private volatile String corpSecret;
|
private volatile String corpSecret;
|
||||||
|
|
||||||
private volatile String token;
|
private volatile String token;
|
||||||
private volatile String aesKey;
|
private volatile String aesKey;
|
||||||
private volatile Integer agentId;
|
private volatile Integer agentId;
|
||||||
|
|
||||||
private volatile String oauth2redirectUri;
|
private volatile String oauth2redirectUri;
|
||||||
|
|
||||||
private volatile String httpProxyHost;
|
private volatile String httpProxyHost;
|
||||||
private volatile int httpProxyPort;
|
private volatile int httpProxyPort;
|
||||||
private volatile String httpProxyUsername;
|
private volatile String httpProxyUsername;
|
||||||
private volatile String httpProxyPassword;
|
private volatile String httpProxyPassword;
|
||||||
|
|
||||||
private volatile File tmpDirFile;
|
private volatile File tmpDirFile;
|
||||||
|
|
||||||
private volatile ApacheHttpClientBuilder apacheHttpClientBuilder;
|
private volatile ApacheHttpClientBuilder apacheHttpClientBuilder;
|
||||||
|
|
||||||
/* Redis clients pool */
|
|
||||||
private final JedisPool jedisPool;
|
|
||||||
|
|
||||||
public WxCpJedisConfigStorage(String host, int port) {
|
public WxCpJedisConfigStorage(String host, int port) {
|
||||||
this.jedisPool = new JedisPool(host, port);
|
this.jedisPool = new JedisPool(host, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* This method will be destroy jedis pool
|
* This method will be destroy jedis pool
|
||||||
*/
|
*/
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
@@ -144,26 +136,46 @@ public class WxCpJedisConfigStorage implements WxCpConfigStorage {
|
|||||||
return this.corpId;
|
return this.corpId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCorpId(String corpId) {
|
||||||
|
this.corpId = corpId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getCorpSecret() {
|
public String getCorpSecret() {
|
||||||
return this.corpSecret;
|
return this.corpSecret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCorpSecret(String corpSecret) {
|
||||||
|
this.corpSecret = corpSecret;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer getAgentId() {
|
public Integer getAgentId() {
|
||||||
return this.agentId;
|
return this.agentId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAgentId(Integer agentId) {
|
||||||
|
this.agentId = agentId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getToken() {
|
public String getToken() {
|
||||||
return this.token;
|
return this.token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setToken(String token) {
|
||||||
|
this.token = token;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getAesKey() {
|
public String getAesKey() {
|
||||||
return this.aesKey;
|
return this.aesKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAesKey(String aesKey) {
|
||||||
|
this.aesKey = aesKey;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getExpiresTime() {
|
public long getExpiresTime() {
|
||||||
try (Jedis jedis = this.jedisPool.getResource()) {
|
try (Jedis jedis = this.jedisPool.getResource()) {
|
||||||
@@ -184,82 +196,62 @@ public class WxCpJedisConfigStorage implements WxCpConfigStorage {
|
|||||||
return this.oauth2redirectUri;
|
return this.oauth2redirectUri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setOauth2redirectUri(String oauth2redirectUri) {
|
||||||
|
this.oauth2redirectUri = oauth2redirectUri;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getHttpProxyHost() {
|
public String getHttpProxyHost() {
|
||||||
return this.httpProxyHost;
|
return this.httpProxyHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setHttpProxyHost(String httpProxyHost) {
|
||||||
|
this.httpProxyHost = httpProxyHost;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getHttpProxyPort() {
|
public int getHttpProxyPort() {
|
||||||
return this.httpProxyPort;
|
return this.httpProxyPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setHttpProxyPort(int httpProxyPort) {
|
||||||
|
this.httpProxyPort = httpProxyPort;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getHttpProxyUsername() {
|
public String getHttpProxyUsername() {
|
||||||
return this.httpProxyUsername;
|
return this.httpProxyUsername;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ============================ Setters below
|
||||||
|
|
||||||
|
public void setHttpProxyUsername(String httpProxyUsername) {
|
||||||
|
this.httpProxyUsername = httpProxyUsername;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getHttpProxyPassword() {
|
public String getHttpProxyPassword() {
|
||||||
return this.httpProxyPassword;
|
return this.httpProxyPassword;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setHttpProxyPassword(String httpProxyPassword) {
|
||||||
|
this.httpProxyPassword = httpProxyPassword;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File getTmpDirFile() {
|
public File getTmpDirFile() {
|
||||||
return this.tmpDirFile;
|
return this.tmpDirFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTmpDirFile(File tmpDirFile) {
|
||||||
|
this.tmpDirFile = tmpDirFile;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApacheHttpClientBuilder getApacheHttpClientBuilder() {
|
public ApacheHttpClientBuilder getApacheHttpClientBuilder() {
|
||||||
return this.apacheHttpClientBuilder;
|
return this.apacheHttpClientBuilder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCorpId(String corpId) {
|
|
||||||
this.corpId = corpId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCorpSecret(String corpSecret) {
|
|
||||||
this.corpSecret = corpSecret;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setToken(String token) {
|
|
||||||
this.token = token;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAesKey(String aesKey) {
|
|
||||||
this.aesKey = aesKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAgentId(Integer agentId) {
|
|
||||||
this.agentId = agentId;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ============================ Setters below
|
|
||||||
|
|
||||||
public void setOauth2redirectUri(String oauth2redirectUri) {
|
|
||||||
this.oauth2redirectUri = oauth2redirectUri;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHttpProxyHost(String httpProxyHost) {
|
|
||||||
this.httpProxyHost = httpProxyHost;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHttpProxyPort(int httpProxyPort) {
|
|
||||||
this.httpProxyPort = httpProxyPort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHttpProxyUsername(String httpProxyUsername) {
|
|
||||||
this.httpProxyUsername = httpProxyUsername;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHttpProxyPassword(String httpProxyPassword) {
|
|
||||||
this.httpProxyPassword = httpProxyPassword;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTmpDirFile(File tmpDirFile) {
|
|
||||||
this.tmpDirFile = tmpDirFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setApacheHttpClientBuilder(ApacheHttpClientBuilder apacheHttpClientBuilder) {
|
public void setApacheHttpClientBuilder(ApacheHttpClientBuilder apacheHttpClientBuilder) {
|
||||||
this.apacheHttpClientBuilder = apacheHttpClientBuilder;
|
this.apacheHttpClientBuilder = apacheHttpClientBuilder;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user