2222import java .util .List ;
2323import java .util .Objects ;
2424
25+ import javax .net .ssl .SSLSocketFactory ;
26+
2527/**
2628 * A {@link DataSource} configuration.
2729 */
@@ -37,6 +39,11 @@ public class DataSourceConfiguration {
3739 */
3840 private final boolean allowUnlistedDataSource ;
3941
42+ /**
43+ * An {@link SSLSocketFactory} to connect to Reindexer using cprotos (SSL/TLS) protocol.
44+ */
45+ private final SSLSocketFactory sslSocketFactory ;
46+
4047 /**
4148 * An index of the current active data source.
4249 */
@@ -46,6 +53,7 @@ private DataSourceConfiguration(Builder builder) {
4653 urls = builder .urls ;
4754 allowUnlistedDataSource = builder .allowUnlistedDataSource ;
4855 active = builder .active ;
56+ sslSocketFactory = builder .sslSocketFactory ;
4957 }
5058
5159 public static Builder builder () {
@@ -69,6 +77,15 @@ public boolean isAllowUnlistedDataSource() {
6977 return allowUnlistedDataSource ;
7078 }
7179
80+ /**
81+ * Returns an {@link SSLSocketFactory} to connect to Reindexer using cprotos (SSL/TLS) protocol.
82+ *
83+ * @return the {@link SSLSocketFactory} to use
84+ */
85+ public SSLSocketFactory getSslSocketFactory () {
86+ return sslSocketFactory ;
87+ }
88+
7289 /**
7390 * Returns the index of the current active data source.
7491 *
@@ -102,6 +119,11 @@ public static class Builder {
102119 */
103120 private boolean allowUnlistedDataSource = true ;
104121
122+ /**
123+ * An {@link SSLSocketFactory} to connect to Reindexer using cprotos (SSL/TLS) protocol.
124+ */
125+ private SSLSocketFactory sslSocketFactory ;
126+
105127 /**
106128 * An index of the current active data source.
107129 */
@@ -157,6 +179,17 @@ public Builder allowUnlistedDataSource(boolean allowUnlistedDataSource) {
157179 return this ;
158180 }
159181
182+ /**
183+ * Configure an {@link SSLSocketFactory} to connect to Reindexer using cprotos (TLS) protocol.
184+ *
185+ * @param sslSocketFactory the {@link SSLSocketFactory} to use
186+ * @return the {@link Builder} for further customizations
187+ */
188+ public Builder sslSocketFactory (SSLSocketFactory sslSocketFactory ) {
189+ this .sslSocketFactory = sslSocketFactory ;
190+ return this ;
191+ }
192+
160193 /**
161194 * Build and return a {@link DataSource} configuration.
162195 *
0 commit comments