@@ -54,6 +54,7 @@ public class ConnectionConfig {
5454 public static final List <IpType > DEFAULT_IP_TYPE_LIST =
5555 Arrays .asList (IpType .PUBLIC , IpType .PRIVATE );
5656 public static final String CLOUD_SQL_GOOGLE_CREDENTIALS_PATH = "cloudSqlGoogleCredentialsPath" ;
57+ public static final String MDX_CLIENT_PROTOCOL_TYPE = "mdxClientProtocolType" ;
5758
5859 private final ConnectorConfig connectorConfig ;
5960 private final String cloudSqlInstance ;
@@ -64,6 +65,7 @@ public class ConnectionConfig {
6465 private final AuthType authType ;
6566 private final String unixSocketPathSuffix ;
6667 private final String domainName ;
68+ private final String mdxClientProtocolType ;
6769
6870 /** Create a new ConnectionConfig from the well known JDBC Connection properties. */
6971 public static ConnectionConfig fromConnectionProperties (Properties props ) {
@@ -116,6 +118,9 @@ public static ConnectionConfig fromConnectionProperties(Properties props, String
116118 ? RefreshStrategy .LAZY
117119 : RefreshStrategy .BACKGROUND ;
118120
121+ final String mdxClientProtocolType =
122+ props .getProperty (ConnectionConfig .MDX_CLIENT_PROTOCOL_TYPE );
123+
119124 return new ConnectionConfig (
120125 csqlInstanceName ,
121126 namedConnection ,
@@ -133,7 +138,8 @@ public static ConnectionConfig fromConnectionProperties(Properties props, String
133138 .withAdminQuotaProject (adminQuotaProject )
134139 .withUniverseDomain (universeDomain )
135140 .withRefreshStrategy (refreshStrategy )
136- .build ());
141+ .build (),
142+ mdxClientProtocolType );
137143 }
138144
139145 /**
@@ -197,7 +203,8 @@ private ConnectionConfig(
197203 AuthType authType ,
198204 String unixSocketPathSuffix ,
199205 String domainName ,
200- ConnectorConfig connectorConfig ) {
206+ ConnectorConfig connectorConfig ,
207+ String mdxClientProtocolType ) {
201208 this .cloudSqlInstance = cloudSqlInstance ;
202209 this .namedConnector = namedConnector ;
203210 this .unixSocketPath = unixSocketPath ;
@@ -206,6 +213,7 @@ private ConnectionConfig(
206213 this .connectorConfig = connectorConfig ;
207214 this .authType = authType ;
208215 this .domainName = domainName ;
216+ this .mdxClientProtocolType = mdxClientProtocolType ;
209217 }
210218
211219 /** Creates a new instance of the ConnectionConfig with an updated connectorConfig. */
@@ -218,7 +226,8 @@ public ConnectionConfig withConnectorConfig(ConnectorConfig config) {
218226 authType ,
219227 unixSocketPathSuffix ,
220228 domainName ,
221- config );
229+ config ,
230+ mdxClientProtocolType );
222231 }
223232
224233 /** Creates a new instance of the ConnectionConfig with an updated cloudSqlInstance. */
@@ -231,7 +240,8 @@ public ConnectionConfig withCloudSqlInstance(String newCloudSqlInstance) {
231240 authType ,
232241 unixSocketPathSuffix ,
233242 domainName ,
234- connectorConfig );
243+ connectorConfig ,
244+ mdxClientProtocolType );
235245 }
236246
237247 /** Creates a new instance of the ConnectionConfig with an updated cloudSqlInstance. */
@@ -244,7 +254,22 @@ public ConnectionConfig withDomainName(String domainName) {
244254 authType ,
245255 unixSocketPathSuffix ,
246256 domainName ,
247- connectorConfig );
257+ connectorConfig ,
258+ mdxClientProtocolType );
259+ }
260+
261+ /** Creates a new instance of the ConnectionConfig with an updated clientProtocolType. */
262+ public ConnectionConfig withMdxClientProtocolType (String mdxClientProtocolType ) {
263+ return new ConnectionConfig (
264+ cloudSqlInstance ,
265+ namedConnector ,
266+ unixSocketPath ,
267+ ipTypes ,
268+ authType ,
269+ unixSocketPathSuffix ,
270+ domainName ,
271+ connectorConfig ,
272+ mdxClientProtocolType );
248273 }
249274
250275 public String getNamedConnector () {
@@ -279,6 +304,10 @@ public String getDomainName() {
279304 return domainName ;
280305 }
281306
307+ public String getMdxClientProtocolType () {
308+ return mdxClientProtocolType ;
309+ }
310+
282311 /** The builder for the ConnectionConfig. */
283312 public static class Builder {
284313
@@ -290,6 +319,7 @@ public static class Builder {
290319 private ConnectorConfig connectorConfig = new ConnectorConfig .Builder ().build ();
291320 private AuthType authType = DEFAULT_AUTH_TYPE ;
292321 private String domainName ;
322+ private String mdxClientProtocolType ;
293323
294324 /** Chained setter for CloudSqlInstance field. */
295325 public Builder withCloudSqlInstance (String cloudSqlInstance ) {
@@ -345,6 +375,12 @@ public Builder withUnixSocketPathSuffix(String unixSocketPathSuffix) {
345375 return this ;
346376 }
347377
378+ /** Chained setter for MdxClientProtocolType field. */
379+ public Builder withMdxClientProtocolType (String mdxClientProtocolType ) {
380+ this .mdxClientProtocolType = mdxClientProtocolType ;
381+ return this ;
382+ }
383+
348384 /** Builds a new instance of {@code ConnectionConfig}. */
349385 public ConnectionConfig build () {
350386 return new ConnectionConfig (
@@ -355,7 +391,8 @@ public ConnectionConfig build() {
355391 authType ,
356392 unixSocketPathSuffix ,
357393 domainName ,
358- connectorConfig );
394+ connectorConfig ,
395+ mdxClientProtocolType );
359396 }
360397 }
361398}
0 commit comments