1717 */
1818package org .apache .beam .io .debezium ;
1919
20- import com .fasterxml .jackson .core .type .TypeReference ;
21- import com .fasterxml .jackson .databind .ObjectMapper ;
2220import com .google .auto .service .AutoService ;
23- import java .io .IOException ;
2421import java .util .List ;
2522import java .util .Map ;
2623import org .apache .beam .sdk .expansion .ExternalTransformRegistrar ;
@@ -79,17 +76,12 @@ public static class ReadBuilder
7976
8077 public static class Configuration extends CrossLanguageConfiguration {
8178 private @ Nullable List <String > connectionProperties ;
82- private @ Nullable String connectionPropertiesJson ;
8379 private @ Nullable Long maxNumberOfRecords ;
8480
8581 public void setConnectionProperties (@ Nullable List <String > connectionProperties ) {
8682 this .connectionProperties = connectionProperties ;
8783 }
8884
89- public void setConnectionPropertiesJson (@ Nullable String connectionPropertiesJson ) {
90- this .connectionPropertiesJson = connectionPropertiesJson ;
91- }
92-
9385 public void setMaxNumberOfRecords (@ Nullable Long maxNumberOfRecords ) {
9486 this .maxNumberOfRecords = maxNumberOfRecords ;
9587 }
@@ -105,29 +97,12 @@ public PTransform<PBegin, PCollection<String>> buildExternal(Configuration confi
10597 .withPort (configuration .port )
10698 .withConnectorClass (configuration .connectorClass .getConnector ());
10799
108- List <String > propertiesToProcess = null ;
109- if (configuration .connectionPropertiesJson != null ) {
110- // Prioritize the new JSON format if present
111- try {
112- ObjectMapper mapper = new ObjectMapper ();
113- propertiesToProcess =
114- mapper .readValue (
115- configuration .connectionPropertiesJson , new TypeReference <List <String >>() {});
116- } catch (IOException e ) {
117- throw new IllegalArgumentException ("Error parsing connectionPropertiesJson." , e );
118- }
119- } else {
120- // Fall back to the old list format for backward-compatibility
121- propertiesToProcess = configuration .connectionProperties ;
122- }
123-
124- if (propertiesToProcess != null ) {
125- for (String connectionProperty : propertiesToProcess ) {
100+ if (configuration .connectionProperties != null ) {
101+ for (String connectionProperty : configuration .connectionProperties ) {
126102 String [] parts = connectionProperty .split ("=" , -1 );
127- if (parts .length == 2 ) {
128- connectorConfiguration =
129- connectorConfiguration .withConnectionProperty (parts [0 ], parts [1 ]);
130- }
103+ String key = parts [0 ];
104+ String value = parts [1 ];
105+ connectorConfiguration = connectorConfiguration .withConnectionProperty (key , value );
131106 }
132107 }
133108
0 commit comments