Skip to content

Commit 2ea86ff

Browse files
support AppConn2Linkis node type.
1 parent e0b7a9f commit 2ea86ff

File tree

2 files changed

+135
-0
lines changed

2 files changed

+135
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.webank.wedatasphere.dss.standard.app.development.operation;
2+
3+
import com.webank.wedatasphere.dss.standard.app.development.ref.AppConn2LinkisResponseRef;
4+
import com.webank.wedatasphere.dss.standard.app.development.ref.RefJobContentRequestRef;
5+
import com.webank.wedatasphere.dss.standard.common.exception.operation.ExternalOperationFailedException;
6+
7+
public interface AppConn2LinkisRefExecutionOperation<K extends RefJobContentRequestRef<K>> extends RefExecutionOperation<K> {
8+
9+
/**
10+
* 该 Operation 用于通过第三方 refJob 的 jobContent 信息,生成一段可被 Linkis 某个引擎执行的代码。<br/>
11+
* 是为 AppConn2Linkis 工作流节点类型设计的一个执行类。具体可参照:AppConn2Linkis工作流节点类型开发指南。
12+
* @param requestRef 包含了第三方 refJob 信息的 requestRef
13+
* @return 包含了可被 Linkis 某个引擎执行的代码信息。
14+
* @throws ExternalOperationFailedException 如果生成代码失败,则抛出该异常
15+
*/
16+
@Override
17+
AppConn2LinkisResponseRef execute(K requestRef) throws ExternalOperationFailedException;
18+
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
package com.webank.wedatasphere.dss.standard.app.development.ref;
2+
3+
import com.webank.wedatasphere.dss.standard.common.entity.ref.ResponseRef;
4+
import com.webank.wedatasphere.dss.standard.common.entity.ref.ResponseRefBuilder;
5+
import com.webank.wedatasphere.dss.standard.common.entity.ref.ResponseRefImpl;
6+
7+
import java.util.Map;
8+
9+
public interface AppConn2LinkisResponseRef extends ResponseRef {
10+
11+
/**
12+
* 返回可被 Linkis 某个引擎执行的代码
13+
* @return 可被 Linkis 某个引擎执行的代码
14+
*/
15+
String getCode();
16+
17+
/**
18+
* Linkis Job 的 params,符合 Linkis 的 params 规范,如下:<br/>
19+
* {
20+
* "configuration": {
21+
* "special": {
22+
* "k1": "v1"
23+
* },
24+
* "runtime": {
25+
* "k2": "v2"
26+
* },
27+
* "startup": {
28+
* "k3": "v2"
29+
* }
30+
* },
31+
* "variable": {
32+
* "runDate": "2023-08-10"
33+
* }
34+
* }
35+
* @return Linkis Job 的 params
36+
*/
37+
Map<String, Object> getParams();
38+
39+
/**
40+
* 希望将 {@code getCode()} 返回的代码提交给哪个 Linkis 引擎
41+
* @return Linkis 引擎类型
42+
*/
43+
String getEngineType();
44+
45+
/**
46+
* 希望将 {@code getCode()} 返回的代码提交给哪个 Linkis 引擎的哪个代码类型
47+
* @return 代码类型
48+
*/
49+
String getRunType();
50+
51+
static AppConn2LinkisResponseRefBuilder newBuilder() {
52+
return new AppConn2LinkisResponseRefBuilder();
53+
}
54+
55+
class AppConn2LinkisResponseRefBuilder
56+
extends ResponseRefBuilder.ExternalResponseRefBuilder<AppConn2LinkisResponseRefBuilder, AppConn2LinkisResponseRef> {
57+
58+
private String code;
59+
private Map<String, Object> params;
60+
private String engineType;
61+
private String runType;
62+
63+
public AppConn2LinkisResponseRefBuilder setCode(String code) {
64+
this.code = code;
65+
return this;
66+
}
67+
68+
public AppConn2LinkisResponseRefBuilder setParams(Map<String, Object> params) {
69+
this.params = params;
70+
return this;
71+
}
72+
73+
public AppConn2LinkisResponseRefBuilder setEngineType(String engineType) {
74+
this.engineType = engineType;
75+
return this;
76+
}
77+
78+
public AppConn2LinkisResponseRefBuilder setRunType(String runType) {
79+
this.runType = runType;
80+
return this;
81+
}
82+
83+
class AppConn2LinkisResponseRefImpl extends ResponseRefImpl implements AppConn2LinkisResponseRef{
84+
public AppConn2LinkisResponseRefImpl() {
85+
super(AppConn2LinkisResponseRefBuilder.this.responseBody, AppConn2LinkisResponseRefBuilder.this.status,
86+
AppConn2LinkisResponseRefBuilder.this.errorMsg, AppConn2LinkisResponseRefBuilder.this.responseMap);
87+
}
88+
89+
@Override
90+
public String getCode() {
91+
return code;
92+
}
93+
94+
@Override
95+
public Map<String, Object> getParams() {
96+
return params;
97+
}
98+
99+
@Override
100+
public String getEngineType() {
101+
return engineType;
102+
}
103+
104+
@Override
105+
public String getRunType() {
106+
return runType;
107+
}
108+
}
109+
110+
@Override
111+
protected AppConn2LinkisResponseRef createResponseRef() {
112+
return new AppConn2LinkisResponseRefImpl();
113+
}
114+
}
115+
116+
}

0 commit comments

Comments
 (0)