|
| 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