Skip to content

Commit 0a20f87

Browse files
author
吴炳亨
authored
Merge pull request #286 from NigelWu95/dev
Dev
2 parents 5d9063e + 17ca15c commit 0a20f87

17 files changed

+267
-158
lines changed

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -340,11 +340,12 @@ rm-fields 可选择持久化结果中去除某些字段,未设置的情况下
340340

341341
详细配置说明见 [持久化配置](docs/resultsave.md)
342342

343-
### 7 超时设置
344-
多数数据源或者操作涉及网络请求,因此提供超时时间设置,默认的超时时间一般能够满足要求,特殊需要的情况下可以修改各超时时间
343+
### 7 网络设置
344+
多数数据源或者操作涉及网络请求,因此提供超时时间和协议设置,默认设置一般能够满足要求,特殊需要的情况下可以修改各超时时间和协议
345345
`connect-timeout=60` 网络连接超时时间,程序默认 60s
346346
`read-timeout=120` socket 读取超时时间,程序默认 120s
347347
`request-timeout=60` 网络请求超时时间,程序默认 60s
348+
`config-https=true/false` 对数据源或 process 涉及的公共 api 是否使用 https 来请求,七牛云/华为云数据源或者七牛的 process 均默认使用 https
348349

349350
### 8 错误及异常
350351
1、一般情况下,终端输出异常信息如 socket timeout 超时为正常现象,如:
@@ -353,7 +354,7 @@ list prefix:<prefix> retrying...
353354
...
354355
java.net.SocketTimeoutException: timeout
355356
```
356-
程序会自动重试,如果比较频繁则可以修改[超时配置](#7-超时设置)重新运行程序,超过重试次数或者其他非预期异常发生时程序会退出,可以将异常信息反馈在
357+
程序会自动重试,如果比较频繁则可以修改[超时配置](#7-网络设置)重新运行程序,超过重试次数或者其他非预期异常发生时程序会退出,可以将异常信息反馈在
357358
[ISSUE列表](https://github.com/NigelWu95/qiniu-suits-java/issues) 中。
358359
2、常见错误信息:
359360
(1)java.lang.UnsupportedClassVersionError: Unsupported major.minor version ...

docs/datamigration.md

+13
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,20 @@ qiniu-sk=
178178
to-bucket=
179179
# region 可以不设置则自动判断,如选择自行指定则使用 qiniu-region,便于和数据源的 region 区分开
180180
# qiniu-region=z0/z1/qvm-z0/...
181+
```
182+
183+
##### 七牛云私有存储
184+
按需要增加如下参数设置 API 的域名即可:
181185
```
186+
rsf-domain=rsf-z0.qiniu.com
187+
#rsf-domain=rsf-z1.qiniu.com
188+
rs-domain=rs-z0.qiniu.com
189+
#rs-domain=rs-z1.qiniu.com
190+
api-domain=api.qiniu.com
191+
#api-domain=api-z1.qiniu.com
192+
#是否使用 https 对上述设置的域名进行请求
193+
config-https=true/false
194+
```
182195

183196
#### 8. 本地文件列表
184197
```

docs/datasource.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -309,14 +309,17 @@ threads=300
309309
prefixes=
310310
#region=
311311
```
312-
**使用七牛数据源除了可以自行指定 region(建议您自行指定 region 较好),也可以单独指定 rsf,rs,api 域名(一般不需要用到),如**
312+
**使用七牛数据源除了可以自行指定 region(建议您自行指定 region 较好),也可以单独指定 rsf,rs,api 域名(一般不需要用到),如下所示,一般可用在七
313+
牛私有存储的场景中**
313314
```
314315
rsf-domain=rsf-z0.qiniu.com
315316
#rsf-domain=rsf-z1.qiniu.com
316317
rs-domain=rs-z0.qiniu.com
317318
#rs-domain=rs-z1.qiniu.com
318319
api-domain=api.qiniu.com
319320
#api-domain=api-z1.qiniu.com
321+
#是否使用 https 对上述设置的域名进行请求
322+
config-https=true/false
320323
```
321324

322325
### 2 腾讯云存储

docs/syncupload.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ private=
4949
|private| 数据源私有类型|是否是对私有空间资源进行同步访问上传,选择对应的私有类型,参考[私有访问](#资源需要私有签名)|
5050

5151
### 超时时间
52-
timeout 参数可以通过全局的 timeout 来设置,参考:[超时设置](../README.md#7-超时设置)
52+
timeout 参数可以通过全局的 timeout 来设置,参考:[网络设置](../README.md#7-网络设置)
5353

5454
### 关于 url-index
5555
当使用 file 源且 parse=tab/csv 时 [xx-]index(ex) 设置的下标必须为整数。url-index 表示输入行含 url 形式的源文件地址,未设置的情况下则使用

docs/uploadfile.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ process=qupload
1313
path=
1414
directories=
1515
directory-config=
16+
anti-prefixes=
1617
ak=
1718
sk=
1819
bucket=
@@ -36,6 +37,7 @@ check=
3637
|path| 本地路径| path 是数据源选项,可以通过设置本地路径来指定要上传的文件,为目录时会遍历目录下(包括内层目录)除隐藏文件外的所有文件|
3738
|directories| 文件目录列表| 如果希望上传 path 下的几个目录中文件,可设置 path 路径下需要读取的目录列表,以 `,` 号分割目录名,不设置默认读取 path 下全部目录进行文件的上传|
3839
|directory-config| 配置文件路径|数据源文件目录及对应已上传的文件名配置,配置中记录已上传的文件在 path 中的位置标识,配置格式为 json,参考[ directory-config 配置文件](#directory-config-配置),该配置不需要自行编写|
40+
|anti-prefixes| 文件目录列表| 表示上传目录下文件时排除某些名称前缀的子目录,支持以 `,` 分隔的列表,特殊字符同样需要转义符|
3941
|ak、sk|长度40的字符串|七牛账号的ak、sk,通过七牛控制台个人中心获取|
4042
|bucket| 字符串| 上传到的资源原空间名称|
4143
|filepath-index| 文件路径索引| 非必填字端,当直接上传 path 路径中的文件时无需设置,如果是通过读取文本文件每一行中的路径信息则需要设置|
@@ -72,7 +74,7 @@ directory-config 中的目录名可以采取相对 path 路径下的目录名。
7274
|value| 表示数据源中某一行的内容,如 "qiniu_success_1.txt" 表示 "/Users/wubingheng/Projects/Github/test" 目录中可能存在该文件名|
7375

7476
### 上传超时时间
75-
timeout 参数可以通过全局的 timeout 来设置,参考:[超时设置](../README.md#7-超时设置)
77+
timeout 参数可以通过全局的 timeout 来设置,参考:[网络设置](../README.md#7-网络设置)
7678

7779
### 关于上传的文件路径
7880
上传文件的操作可以直接上传通过 path 指定的目录下的文件,也支持传通过文件列表中提供的 filepath 的文件,如:

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.qiniu</groupId>
88
<artifactId>qsuits</artifactId>
9-
<version>8.3.9</version>
9+
<version>8.3.10</version>
1010
<name>qsuits</name>
1111
<description>qiniu-suits is a efficient tools for qiniu api implemented by java8.</description>
1212
<url>https://github.com/NigelWu95/qiniu-suits-java</url>

src/main/java/com/qiniu/entry/CommonParams.java

+21-9
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class CommonParams {
2424
private int connectTimeout;
2525
private int readTimeout;
2626
private int requestTimeout;
27+
private boolean httpsForConfigEnabled;
2728
private String path;
2829
private String source;
2930
private boolean isStorageSource;
@@ -46,7 +47,6 @@ public class CommonParams {
4647
private String bucket;
4748
private String logFilepath;
4849
private Map<String, Map<String, String>> pathConfigMap;
49-
private List<String> antiDirectories;
5050
private List<String> antiPrefixes;
5151
private boolean prefixLeft;
5252
private boolean prefixRight;
@@ -164,6 +164,7 @@ public CommonParams(IEntryParam entryParam) throws Exception {
164164
setTimeout();
165165
path = entryParam.getValue("path", "");
166166
setSource();
167+
setHttpsConfigEnabled();
167168
accountInit();
168169
logFilepath = entryParam.getValue("log", null);
169170
if (isStorageSource) {
@@ -211,6 +212,7 @@ public CommonParams(Map<String, String> paramsMap) throws Exception {
211212
this.entryParam = new ParamsConfig(paramsMap);
212213
setTimeout();
213214
source = "terminal";
215+
setHttpsConfigEnabled();
214216
accountInit();
215217
setParse();
216218
setSeparator();
@@ -384,6 +386,16 @@ else if (!source.matches("(local|qiniu|tencent|aliyun|upyun|s3|huawei|baidu)"))
384386
isStorageSource = CloudApiUtils.isStorageSource(source);
385387
}
386388

389+
private void setHttpsConfigEnabled() throws IOException {
390+
String enabled = entryParam.getValue("config-https", "").trim();
391+
if ("".equals(enabled)) {
392+
if ("qiniu".equals(source) || "huawei".equals(source)) httpsForConfigEnabled = true;
393+
} else {
394+
ParamsUtils.checked(enabled, "config-https", "(true|false)");
395+
httpsForConfigEnabled = Boolean.parseBoolean(enabled);
396+
}
397+
}
398+
387399
private void setParse() throws IOException {
388400
parse = entryParam.getValue("parse", "tab").trim();
389401
ParamsUtils.checked(parse, "parse", "(csv|tab|json|object|file)");
@@ -1343,6 +1355,10 @@ public void setRequestTimeout(int requestTimeout) {
13431355
this.requestTimeout = requestTimeout;
13441356
}
13451357

1358+
public void setHttpsForConfigEnabled(boolean httpsForConfigEnabled) {
1359+
this.httpsForConfigEnabled = httpsForConfigEnabled;
1360+
}
1361+
13461362
public void setPath(String path) {
13471363
this.path = path;
13481364
}
@@ -1415,10 +1431,6 @@ public void setPathConfigMap(Map<String, Map<String, String>> pathConfigMap) {
14151431
this.pathConfigMap = pathConfigMap;
14161432
}
14171433

1418-
public void setAntiDirectories(List<String> antiDirectories) {
1419-
this.antiDirectories = antiDirectories;
1420-
}
1421-
14221434
public void setAntiPrefixes(List<String> antiPrefixes) {
14231435
this.antiPrefixes = antiPrefixes;
14241436
}
@@ -1543,6 +1555,10 @@ public int getRequestTimeout() {
15431555
return requestTimeout;
15441556
}
15451557

1558+
public boolean isHttpsForConfigEnabled() {
1559+
return httpsForConfigEnabled;
1560+
}
1561+
15461562
public String getPath() {
15471563
return path;
15481564
}
@@ -1615,10 +1631,6 @@ public Map<String, Map<String, String>> getPathConfigMap() {
16151631
return pathConfigMap;
16161632
}
16171633

1618-
public List<String> getAntiDirectories() {
1619-
return antiDirectories;
1620-
}
1621-
16221634
public List<String> getAntiPrefixes() {
16231635
return antiPrefixes;
16241636
}

0 commit comments

Comments
 (0)