Skip to content

Commit ddad162

Browse files
author
吴炳亨
authored
Merge pull request #293 from NigelWu95/dev
add notifyURL and force parameters for qiniu pfop process and release…
2 parents 2989b9a + 65569f6 commit ddad162

File tree

7 files changed

+33
-21
lines changed

7 files changed

+33
-21
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version=8.3.15
1+
version=8.3.16
22

33
package_no_test:
44
mvn package -Dmaven.test.skip=true

docs/pfop.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ sk=
1515
bucket=
1616
indexes=
1717
pipeline=
18+
notifyURL=
19+
force=
1820
force-public=
1921
fops-index=
2022
pfop-config=
@@ -28,7 +30,9 @@ pfop-config=
2830
|bucket| 字符串| 操作的资源原空间,当数据源为 qiniu 时无需再设置|
2931
|indexes|字符串| 设置输入行中 key 字段的下标(有默认值),参考[数据源 indexes 设置](datasource.md#1-公共参数)|
3032
|pipeline| 字符串| 进行持久化数据处理的队列名称|
31-
|force-public| true/false| 是否强制使用共有队列(会有性能影响)|
33+
|notifyURL| URL 字符串| 进行持久化结果回调的服务器通知地址,接受七牛的 POST 回调请求|
34+
|force| true/false| 持久化生成的文件名如果空间中已存在是否进行强制覆盖,默认为 false|
35+
|force-public| true/false| 是否强制使用共有队列(会有性能影响),未指定 pipeline 的情况需要设置为 true|
3236
|fops-index| 字符串| 转码命令索引(下标),pfop 操作时指定,明确指定文件名对应的转码命令,建议命令中携带 saveas 重命名指令否则使用默认名|
3337
|pfop-config| 文件路径字符串| 进行转码和另存规则设置的 json 配置文件路径,可设置多个转码条件和指令,该配置会覆盖 fops-index 设置的转码命令,[配置写法](#pfop-config-配置文件)|
3438
|cmd| 字符串| pfop 命令,如 avthumb/mp4,和 pfop-config 中的 cmd 相同,如果不想设置 pfop-config 配置文件则可采用 cmd + saveas 设置的方式|

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.15</version>
9+
<version>8.3.16</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/QSuitsEntry.java

+8-5
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ private ILineProcess<Map<String, String>> getPfopCommand(Map<String, String> ind
689689
String size = entryParam.getValue("size", "false").trim();
690690
ParamsUtils.checked(size, "size", "(true|false)");
691691
String combine = entryParam.getValue("combine", "true").trim();
692-
ParamsUtils.checked(size, "combine", "(true|false)");
692+
ParamsUtils.checked(combine, "combine", "(true|false)");
693693
String configJson = entryParam.getValue("pfop-config", "").trim();
694694
List<JsonObject> pfopConfigs = commonParams.getPfopConfigs();
695695
return single ? new PfopCommand(getNewQiniuConfig(), avinfoIndex, Boolean.parseBoolean(duration), Boolean.parseBoolean(size),
@@ -700,6 +700,9 @@ private ILineProcess<Map<String, String>> getPfopCommand(Map<String, String> ind
700700

701701
private ILineProcess<Map<String, String>> getPfop(Map<String, String> indexMap, boolean single) throws IOException {
702702
String pipeline = entryParam.getValue("pipeline", "").trim();
703+
String notifyURL = entryParam.getValue("notifyURL", "").trim();
704+
String force = entryParam.getValue("force", "false").trim();
705+
ParamsUtils.checked(force, "force", "(true|false)");
703706
String forcePublic = entryParam.getValue("force-public", "false").trim();
704707
if (pipeline.isEmpty() && !"true".equals(forcePublic)) {
705708
throw new IOException("please set pipeline, if you don't want to use" +
@@ -708,10 +711,10 @@ private ILineProcess<Map<String, String>> getPfop(Map<String, String> indexMap,
708711
String configJson = entryParam.getValue("pfop-config", "").trim();
709712
List<JsonObject> pfopConfigs = commonParams.getPfopConfigs();
710713
String fopsIndex = indexMap.containsValue("fops") ? "fops" : null;
711-
return single ? new QiniuPfop(qiniuAccessKey, qiniuSecretKey, getQiniuConfig(), bucket, pipeline, configJson,
712-
pfopConfigs, fopsIndex)
713-
: new QiniuPfop(qiniuAccessKey, qiniuSecretKey, getQiniuConfig(), bucket, pipeline, configJson, pfopConfigs,
714-
fopsIndex, savePath);
714+
return single ? new QiniuPfop(qiniuAccessKey, qiniuSecretKey, getQiniuConfig(), bucket, pipeline, notifyURL,
715+
Boolean.parseBoolean(force), configJson, pfopConfigs, fopsIndex)
716+
: new QiniuPfop(qiniuAccessKey, qiniuSecretKey, getQiniuConfig(), bucket, pipeline, notifyURL,
717+
Boolean.parseBoolean(force), configJson, pfopConfigs, fopsIndex, savePath);
715718
}
716719

717720
private ILineProcess<Map<String, String>> getPfopResult(Map<String, String> indexMap, boolean single) throws IOException {

src/main/java/com/qiniu/process/qiniu/QiniuPfop.java

+16-11
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,37 @@ public class QiniuPfop extends Base<Map<String, String>> {
2323
private OperationManager operationManager;
2424

2525
public QiniuPfop(String accessKey, String secretKey, Configuration configuration, String bucket, String pipeline,
26-
String pfopJsonPath, List<JsonObject> pfopConfigs, String fopsIndex) throws IOException {
26+
String notifyURL, boolean force, String pfopJsonPath, List<JsonObject> pfopConfigs,
27+
String fopsIndex) throws IOException {
2728
super("pfop", accessKey, secretKey, bucket);
28-
set(configuration, pipeline, pfopJsonPath, pfopConfigs, fopsIndex);
29+
set(configuration, pipeline, notifyURL, force, pfopJsonPath, pfopConfigs, fopsIndex);
2930
this.operationManager = new OperationManager(Auth.create(accessKey, secretKey), configuration.clone());
3031
CloudApiUtils.checkQiniu(accessKey, secretKey, configuration, bucket);
3132
}
3233

3334
public QiniuPfop(String accessKey, String secretKey, Configuration configuration, String bucket, String pipeline,
34-
String pfopJsonPath, List<JsonObject> pfopConfigs, String fopsIndex, String savePath,
35-
int saveIndex) throws IOException {
35+
String notifyURL, boolean force, String pfopJsonPath, List<JsonObject> pfopConfigs,
36+
String fopsIndex, String savePath, int saveIndex) throws IOException {
3637
super("pfop", accessKey, secretKey, bucket, savePath, saveIndex);
37-
set(configuration, pipeline, pfopJsonPath, pfopConfigs, fopsIndex);
38+
set(configuration, pipeline, notifyURL, force, pfopJsonPath, pfopConfigs, fopsIndex);
3839
this.operationManager = new OperationManager(Auth.create(accessKey, secretKey), configuration.clone());
3940
CloudApiUtils.checkQiniu(accessKey, secretKey, configuration, bucket);
4041
}
4142

4243
public QiniuPfop(String accessKey, String secretKey, Configuration configuration, String bucket, String pipeline,
43-
String pfopJsonPath, List<JsonObject> pfopConfigs, String fopsIndex, String savePath)
44-
throws IOException {
45-
this(accessKey, secretKey, configuration, bucket, pipeline, pfopJsonPath, pfopConfigs, fopsIndex, savePath, 0);
44+
String notifyURL, boolean force, String pfopJsonPath, List<JsonObject> pfopConfigs,
45+
String fopsIndex, String savePath) throws IOException {
46+
this(accessKey, secretKey, configuration, bucket, pipeline, notifyURL, force, pfopJsonPath, pfopConfigs,
47+
fopsIndex, savePath, 0);
4648
}
4749

48-
private void set(Configuration configuration, String pipeline, String pfopJsonPath, List<JsonObject> pfopConfigs,
49-
String fopsIndex) throws IOException {
50+
private void set(Configuration configuration, String pipeline, String notifyURL, boolean force, String pfopJsonPath,
51+
List<JsonObject> pfopConfigs, String fopsIndex) throws IOException {
5052
this.configuration = configuration;
51-
this.pfopParams = new StringMap().putNotEmpty("pipeline", pipeline);
53+
this.pfopParams = new StringMap()
54+
.putNotEmpty("pipeline", pipeline)
55+
.putNotEmpty("notifyURL", notifyURL)
56+
.putWhen("force", 1, force);
5257
if (pfopConfigs != null && pfopConfigs.size() > 0) {
5358
this.pfopConfigs = pfopConfigs;
5459
} else if (pfopJsonPath != null && !"".equals(pfopJsonPath)) {

src/test/java/com/qiniu/process/qiniu/ProcessTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public void init() throws IOException {
2525
// propertiesFile.getValue("bucket");
2626
moveFile = new MoveFile(accessKey, secretKey, new Configuration(), bucket, bucket, "to-key", null, null, true);
2727
statFile = new StatFile(accessKey, secretKey, new Configuration(), bucket, "tab", "\t", null);
28-
qiniuPfop = new QiniuPfop(accessKey, secretKey, new Configuration(), bucket, null, null, null, "1");
28+
qiniuPfop = new QiniuPfop(accessKey, secretKey, new Configuration(), bucket, null, null, false, null, null, "1");
2929
}
3030

3131
@Test

version.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version=8.3.15
1+
version=8.3.16

0 commit comments

Comments
 (0)