Skip to content

Commit 31fdd7e

Browse files
committed
[KYUUBI #2668] [SUB-TASK][KPIP-4] Rewrite the rest DTO classes in java
### _Why are the changes needed?_ To close #2674 Rewrite the rest DTO classes in java, which is the preparation for kyuubi rest sdk #2643 ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate - [x] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request Closes #2668 from turboFei/client_do. Closes #2668 e2bf779 [Fei Wang] revert by reformat a23f65f [Fei Wang] address comments 6648ef9 [Fei Wang] regen the equals & hashCode without accepct subclasses as parameter to equals() 840866c [Fei Wang] add equals & hashCode for dto classes 1cc9afa [Fei Wang] return empty collections 2d49db5 [Fei Wang] return empty batch info map by defaults 1bb399c [Fei Wang] only reserve slf4j-api c6621ed [Fei Wang] fix ut e15ea9f [Fei Wang] refactor ef6dc16 [Fei Wang] add dependes into assembly ffacf68 [Fei Wang] rewrite the dto classes in java Authored-by: Fei Wang <fwang12@ebay.com> Signed-off-by: Fei Wang <fwang12@ebay.com>
1 parent 3216536 commit 31fdd7e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+2185
-296
lines changed

dev/kyuubi-codecov/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@
6969
<version>${project.version}</version>
7070
</dependency>
7171

72+
<dependency>
73+
<groupId>org.apache.kyuubi</groupId>
74+
<artifactId>kyuubi-rest-client</artifactId>
75+
<version>${project.version}</version>
76+
</dependency>
77+
7278
<dependency>
7379
<groupId>org.apache.kyuubi</groupId>
7480
<artifactId>kyuubi-server_${scala.binary.version}</artifactId>

kyuubi-assembly/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@
5252
<version>${project.version}</version>
5353
</dependency>
5454

55+
<dependency>
56+
<groupId>org.apache.kyuubi</groupId>
57+
<artifactId>kyuubi-rest-client</artifactId>
58+
<version>${project.version}</version>
59+
</dependency>
60+
5561
<dependency>
5662
<groupId>org.apache.kyuubi</groupId>
5763
<artifactId>kyuubi-server_${scala.binary.version}</artifactId>

kyuubi-rest-client/pom.xml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one or more
4+
~ contributor license agreements. See the NOTICE file distributed with
5+
~ this work for additional information regarding copyright ownership.
6+
~ The ASF licenses this file to You under the Apache License, Version 2.0
7+
~ (the "License"); you may not use this file except in compliance with
8+
~ the License. You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing, software
13+
~ distributed under the License is distributed on an "AS IS" BASIS,
14+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ See the License for the specific language governing permissions and
16+
~ limitations under the License.
17+
-->
18+
19+
<project xmlns="http://maven.apache.org/POM/4.0.0"
20+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
22+
<parent>
23+
<groupId>org.apache.kyuubi</groupId>
24+
<artifactId>kyuubi-parent</artifactId>
25+
<version>1.6.0-SNAPSHOT</version>
26+
</parent>
27+
<modelVersion>4.0.0</modelVersion>
28+
29+
<artifactId>kyuubi-rest-client</artifactId>
30+
<name>Kyuubi Project Rest Client</name>
31+
<packaging>jar</packaging>
32+
<url>https://kyuubi.apache.org/</url>
33+
34+
<properties>
35+
<jars.target.dir>${project.build.directory}</jars.target.dir>
36+
</properties>
37+
38+
<dependencies>
39+
<dependency>
40+
<groupId>org.slf4j</groupId>
41+
<artifactId>slf4j-api</artifactId>
42+
</dependency>
43+
</dependencies>
44+
45+
<build>
46+
<outputDirectory>target/classes</outputDirectory>
47+
<testOutputDirectory>target/test-classes</testOutputDirectory>
48+
49+
<plugins>
50+
<plugin>
51+
<groupId>net.alchim31.maven</groupId>
52+
<artifactId>scala-maven-plugin</artifactId>
53+
<executions>
54+
<execution>
55+
<id>attach-scaladocs</id>
56+
<phase>none</phase>
57+
</execution>
58+
</executions>
59+
</plugin>
60+
61+
<plugin>
62+
<groupId>org.scalatest</groupId>
63+
<artifactId>scalatest-maven-plugin</artifactId>
64+
<configuration>
65+
<skipTests>true</skipTests>
66+
</configuration>
67+
</plugin>
68+
69+
<plugin>
70+
<groupId>org.scalastyle</groupId>
71+
<artifactId>scalastyle-maven-plugin</artifactId>
72+
<configuration>
73+
<skip>true</skip>
74+
</configuration>
75+
</plugin>
76+
</plugins>
77+
</build>
78+
</project>
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.kyuubi.client.api.v1.dto;
19+
20+
import java.util.Collections;
21+
import java.util.Map;
22+
import java.util.Objects;
23+
24+
public class Batch {
25+
private String id;
26+
private String batchType;
27+
private Map<String, String> batchInfo;
28+
private String kyuubiInstance;
29+
private String state;
30+
31+
public Batch() {}
32+
33+
public Batch(
34+
String id,
35+
String batchType,
36+
Map<String, String> batchInfo,
37+
String kyuubiInstance,
38+
String state) {
39+
this.id = id;
40+
this.batchType = batchType;
41+
this.batchInfo = batchInfo;
42+
this.kyuubiInstance = kyuubiInstance;
43+
this.state = state;
44+
}
45+
46+
public String getId() {
47+
return id;
48+
}
49+
50+
public void setId(String id) {
51+
this.id = id;
52+
}
53+
54+
public String getBatchType() {
55+
return batchType;
56+
}
57+
58+
public void setBatchType(String batchType) {
59+
this.batchType = batchType;
60+
}
61+
62+
public Map<String, String> getBatchInfo() {
63+
if (null == batchInfo) {
64+
return Collections.emptyMap();
65+
}
66+
return batchInfo;
67+
}
68+
69+
public void setBatchInfo(Map<String, String> batchInfo) {
70+
this.batchInfo = batchInfo;
71+
}
72+
73+
public String getKyuubiInstance() {
74+
return kyuubiInstance;
75+
}
76+
77+
public void setKyuubiInstance(String kyuubiInstance) {
78+
this.kyuubiInstance = kyuubiInstance;
79+
}
80+
81+
public String getState() {
82+
return state;
83+
}
84+
85+
public void setState(String state) {
86+
this.state = state;
87+
}
88+
89+
@Override
90+
public boolean equals(Object o) {
91+
if (this == o) return true;
92+
if (o == null || getClass() != o.getClass()) return false;
93+
Batch batch = (Batch) o;
94+
return Objects.equals(getId(), batch.getId());
95+
}
96+
97+
@Override
98+
public int hashCode() {
99+
return Objects.hash(getId());
100+
}
101+
}
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.kyuubi.client.api.v1.dto;
19+
20+
import java.util.Collections;
21+
import java.util.List;
22+
import java.util.Map;
23+
import java.util.Objects;
24+
25+
public class BatchRequest {
26+
private String batchType;
27+
private String resource;
28+
private String className;
29+
private String name;
30+
private Map<String, String> conf;
31+
private List<String> args;
32+
33+
public BatchRequest() {}
34+
35+
public BatchRequest(
36+
String batchType,
37+
String resource,
38+
String className,
39+
String name,
40+
Map<String, String> conf,
41+
List<String> args) {
42+
this.batchType = batchType;
43+
this.resource = resource;
44+
this.className = className;
45+
this.name = name;
46+
this.conf = conf;
47+
this.args = args;
48+
}
49+
50+
public BatchRequest(String batchType, String resource, String className, String name) {
51+
this.batchType = batchType;
52+
this.resource = resource;
53+
this.className = className;
54+
this.name = name;
55+
this.conf = Collections.emptyMap();
56+
this.args = Collections.emptyList();
57+
}
58+
59+
public String getBatchType() {
60+
return batchType;
61+
}
62+
63+
public void setBatchType(String batchType) {
64+
this.batchType = batchType;
65+
}
66+
67+
public String getResource() {
68+
return resource;
69+
}
70+
71+
public void setResource(String resource) {
72+
this.resource = resource;
73+
}
74+
75+
public String getClassName() {
76+
return className;
77+
}
78+
79+
public void setClassName(String className) {
80+
this.className = className;
81+
}
82+
83+
public String getName() {
84+
return name;
85+
}
86+
87+
public void setName(String name) {
88+
this.name = name;
89+
}
90+
91+
public Map<String, String> getConf() {
92+
if (null == conf) {
93+
return Collections.emptyMap();
94+
}
95+
return conf;
96+
}
97+
98+
public void setConf(Map<String, String> conf) {
99+
this.conf = conf;
100+
}
101+
102+
public List<String> getArgs() {
103+
if (null == args) {
104+
return Collections.emptyList();
105+
}
106+
return args;
107+
}
108+
109+
public void setArgs(List<String> args) {
110+
this.args = args;
111+
}
112+
113+
@Override
114+
public boolean equals(Object o) {
115+
if (this == o) return true;
116+
if (o == null || getClass() != o.getClass()) return false;
117+
BatchRequest that = (BatchRequest) o;
118+
return Objects.equals(getBatchType(), that.getBatchType())
119+
&& Objects.equals(getResource(), that.getResource())
120+
&& Objects.equals(getClassName(), that.getClassName())
121+
&& Objects.equals(getName(), that.getName())
122+
&& Objects.equals(getConf(), that.getConf())
123+
&& Objects.equals(getArgs(), that.getArgs());
124+
}
125+
126+
@Override
127+
public int hashCode() {
128+
return Objects.hash(
129+
getBatchType(), getResource(), getClassName(), getName(), getConf(), getArgs());
130+
}
131+
}

0 commit comments

Comments
 (0)