File tree Expand file tree Collapse file tree 5 files changed +18
-13
lines changed
src/main/java/io/cloudquery
internal/servers/plugin/v3 Expand file tree Collapse file tree 5 files changed +18
-13
lines changed Original file line number Diff line number Diff line change @@ -48,8 +48,6 @@ dependencies {
4848 implementation ' org.apache.logging.log4j:log4j-api:2.20.0'
4949 implementation ' org.apache.logging.log4j:log4j-core:2.20.0'
5050
51- implementation ' com.google.code.gson:gson:2.10.1'
52-
5351 testImplementation(platform(' org.junit:junit-bom:5.10.0' ))
5452 testImplementation(' org.junit.jupiter:junit-jupiter:5.10.0' )
5553 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(
4242 public void init (
4343 io .cloudquery .plugin .v3 .Init .Request request ,
4444 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+ }
5054 }
5155
5256 @ Override
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ public void close() {
105105 }
106106
107107 @ Override
108- public ClientMeta newClient (String spec , NewClientOptions options ) {
108+ public ClientMeta newClient (String spec , NewClientOptions options ) throws Exception {
109109 if (options .isNoConnection ()) {
110110 return null ;
111111 }
Original file line number Diff line number Diff line change 11package io .cloudquery .memdb ;
22
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 ;
46import lombok .Getter ;
57import lombok .Setter ;
68
79@ Getter
810@ Setter
911public 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 );
1215 if (spec .getConcurrency () == 0 ) {
1316 spec .setConcurrency (10000 );
1417 }
Original file line number Diff line number Diff line change @@ -19,11 +19,11 @@ public abstract class Plugin {
1919 @ Setter protected Logger logger ;
2020 protected ClientMeta client ;
2121
22- public void init (String spec , NewClientOptions options ) {
22+ public void init (String spec , NewClientOptions options ) throws Exception {
2323 client = newClient (spec , options );
2424 }
2525
26- public abstract ClientMeta newClient (String spec , NewClientOptions options );
26+ public abstract ClientMeta newClient (String spec , NewClientOptions options ) throws Exception ;
2727
2828 public abstract List <Table > tables (
2929 List <String > includeList , List <String > skipList , boolean skipDependentTables )
You can’t perform that action at this time.
0 commit comments