dsmiley commented on code in PR #3876:
URL: https://github.com/apache/solr/pull/3876#discussion_r2535764577
##########
solr/bin/solr:
##########
@@ -342,7 +342,7 @@ fi
if [ -n "${SOLR_AUTH_TYPE:-}" ]; then
case "$(echo "$SOLR_AUTH_TYPE" | awk '{print tolower($0)}')" in
basic)
-
SOLR_AUTHENTICATION_CLIENT_BUILDER="org.apache.solr.client.solrj.impl.PreemptiveBasicAuthClientBuilderFactory"
+
SOLR_AUTHENTICATION_CLIENT_BUILDER="org.apache.solr.client.solrj.impl.PreemptiveBasicAuthClientCustomizer"
Review Comment:
perhaps this env var should be renamed too
##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java:
##########
@@ -186,16 +187,15 @@ private void initAuthStoreFromExistingClient(HttpClient
httpClient) {
this.authenticationStore = (AuthenticationStoreHolder)
httpClient.getAuthenticationStore();
}
- private void applyHttpClientBuilderFactory() {
- String factoryClassName =
-
System.getProperty(SolrHttpConstants.SYS_PROP_HTTP_CLIENT_BUILDER_FACTORY);
+ private void applyClientCustomizer() {
+ String factoryClassName =
EnvUtils.getProperty(SolrClientCustomizer.CLIENT_CUSTOMIZER_SYSPROP);
if (factoryClassName != null) {
- log.debug("Using Http Builder Factory: {}", factoryClassName);
- HttpClientBuilderFactory factory;
+ log.debug("Using {}", factoryClassName);
+ SolrClientCustomizer factory;
Review Comment:
TODO rename to `instance`
##########
solr/solr-ref-guide/modules/configuration-guide/pages/solr-properties.adoc:
##########
@@ -102,18 +96,20 @@ NOTE: Properties marked with "!" indicate inverted meaning
between pre Solr 10 a
|solr.security.allow.urls|solr.allowUrls||A comma seperated list of urls for
reading from.
-|solr.security.allow.urls.enabled|!solr.disable.allow.urls|false|If using an
allow list of accessible urls is enabled.
+|solr.security.allow.urls.enabled|!solr.disable.allow.urls|false|If using an
allow list of accessible urls is enabled.
+
|solr.security.auth.plugin|authenticationPlugin||Specifies the authentication
plugin to use.
|solr.solrj.cloud.max.stale.retries|cloudSolrClientMaxStaleRetries|5|Sets the
maximum number of retries for stale connection attempts in SolrJ cloud client.
-|solr.solrj.http.cookies.enabled|!solr.http.disableCookies| false |If
Http2SolrClient should support cookies.
+|solr.solrj.http.customizer|solr.httpclient.builder.factory||A class loaded to
customize HttpJettySolrClient upon creation.
Review Comment:
`HttpJettySolrClient` slipped in here... hasn't been renamed from
Http2SolrClient yet
##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java:
##########
@@ -186,16 +187,15 @@ private void initAuthStoreFromExistingClient(HttpClient
httpClient) {
this.authenticationStore = (AuthenticationStoreHolder)
httpClient.getAuthenticationStore();
}
- private void applyHttpClientBuilderFactory() {
- String factoryClassName =
-
System.getProperty(SolrHttpConstants.SYS_PROP_HTTP_CLIENT_BUILDER_FACTORY);
+ private void applyClientCustomizer() {
+ String factoryClassName =
EnvUtils.getProperty(SolrClientCustomizer.CLIENT_CUSTOMIZER_SYSPROP);
Review Comment:
now using EnvUtils; should now work consistently with the env var pattern if
someone wishes
##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/SolrHttpConstants.java:
##########
@@ -42,17 +42,11 @@ public interface SolrHttpConstants {
/** Maximum total connections allowed */
String PROP_MAX_CONNECTIONS = "maxConnections";
- /**
- * A Java system property to select the {@linkplain
HttpClientBuilderFactory} used for configuring
- * HTTP based SolrClients.
- */
- String SYS_PROP_HTTP_CLIENT_BUILDER_FACTORY =
"solr.httpclient.builder.factory";
Review Comment:
I felt this was better organized on the class that loads it. I can change
back if asked.
##########
solr/solrj/src/java/org/apache/solr/client/solrj/SolrClientCustomizer.java:
##########
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.client.solrj;
+
+/**
+ * A config hook for post-configuration of a {@linkplain SolrClient} by its
builder. It is not
+ * supported by all builders.
+ *
+ * @see #CLIENT_CUSTOMIZER_SYSPROP
+ * @lucene.experimental
+ */
+public interface SolrClientCustomizer {
+ /**
+ * A Java system property to select the {@linkplain SolrClientCustomizer}
used for configuring
+ * HTTP based SolrClients.
+ */
+ String CLIENT_CUSTOMIZER_SYSPROP = "solr.solrj.http.customizer";
+
+ void setup(SolrClient client);
Review Comment:
No longer mandate a specific type of SolrClient
##########
solr/solrj/src/java/org/apache/solr/client/solrj/SolrClientCustomizer.java:
##########
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.client.solrj;
+
+/**
+ * A config hook for post-configuration of a {@linkplain SolrClient} by its
builder. It is not
+ * supported by all builders.
+ *
+ * @see #CLIENT_CUSTOMIZER_SYSPROP
+ * @lucene.experimental
+ */
+public interface SolrClientCustomizer {
Review Comment:
doesn't need to be Closeable!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]