File tree 5 files changed +18
-13
lines changed
src/main/java/io/cloudquery
internal/servers/plugin/v3
5 files changed +18
-13
lines changed Original file line number Diff line number Diff line change @@ -48,8 +48,6 @@ dependencies {
48
48
implementation ' org.apache.logging.log4j:log4j-api:2.20.0'
49
49
implementation ' org.apache.logging.log4j:log4j-core:2.20.0'
50
50
51
- implementation ' com.google.code.gson:gson:2.10.1'
52
-
53
51
testImplementation(platform(' org.junit:junit-bom:5.10.0' ))
54
52
testImplementation(' org.junit.jupiter:junit-jupiter:5.10.0' )
55
53
testImplementation(' org.junit.jupiter:junit-jupiter-api:5.10.0' )
Original file line number Diff line number Diff line change @@ -42,11 +42,15 @@ public void getVersion(
42
42
public void init (
43
43
io .cloudquery .plugin .v3 .Init .Request request ,
44
44
StreamObserver <io .cloudquery .plugin .v3 .Init .Response > responseObserver ) {
45
- plugin .init (
46
- request .getSpec ().toStringUtf8 (),
47
- NewClientOptions .builder ().noConnection (request .getNoConnection ()).build ());
48
- responseObserver .onNext (io .cloudquery .plugin .v3 .Init .Response .newBuilder ().build ());
49
- responseObserver .onCompleted ();
45
+ try {
46
+ plugin .init (
47
+ request .getSpec ().toStringUtf8 (),
48
+ NewClientOptions .builder ().noConnection (request .getNoConnection ()).build ());
49
+ responseObserver .onNext (io .cloudquery .plugin .v3 .Init .Response .newBuilder ().build ());
50
+ responseObserver .onCompleted ();
51
+ } catch (Exception e ) {
52
+ responseObserver .onError (e );
53
+ }
50
54
}
51
55
52
56
@ Override
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ public void close() {
105
105
}
106
106
107
107
@ Override
108
- public ClientMeta newClient (String spec , NewClientOptions options ) {
108
+ public ClientMeta newClient (String spec , NewClientOptions options ) throws Exception {
109
109
if (options .isNoConnection ()) {
110
110
return null ;
111
111
}
Original file line number Diff line number Diff line change 1
1
package io .cloudquery .memdb ;
2
2
3
- import com .google .gson .Gson ;
3
+ import com .fasterxml .jackson .core .JsonProcessingException ;
4
+ import com .fasterxml .jackson .databind .JsonMappingException ;
5
+ import com .fasterxml .jackson .databind .ObjectMapper ;
4
6
import lombok .Getter ;
5
7
import lombok .Setter ;
6
8
7
9
@ Getter
8
10
@ Setter
9
11
public class Spec {
10
- public static Spec fromJSON (String json ) {
11
- Spec spec = new Gson ().fromJson (json , Spec .class );
12
+ public static Spec fromJSON (String json ) throws JsonMappingException , JsonProcessingException {
13
+ ObjectMapper objectMapper = new ObjectMapper ();
14
+ Spec spec = objectMapper .readValue (json , Spec .class );
12
15
if (spec .getConcurrency () == 0 ) {
13
16
spec .setConcurrency (10000 );
14
17
}
Original file line number Diff line number Diff line change @@ -19,11 +19,11 @@ public abstract class Plugin {
19
19
@ Setter protected Logger logger ;
20
20
protected ClientMeta client ;
21
21
22
- public void init (String spec , NewClientOptions options ) {
22
+ public void init (String spec , NewClientOptions options ) throws Exception {
23
23
client = newClient (spec , options );
24
24
}
25
25
26
- public abstract ClientMeta newClient (String spec , NewClientOptions options );
26
+ public abstract ClientMeta newClient (String spec , NewClientOptions options ) throws Exception ;
27
27
28
28
public abstract List <Table > tables (
29
29
List <String > includeList , List <String > skipList , boolean skipDependentTables )
You can’t perform that action at this time.
0 commit comments