Github user hmcl commented on a diff in the pull request:
https://github.com/apache/storm/pull/2467#discussion_r159121022
--- Diff:
external/storm-solr/src/main/java/org/apache/storm/solr/schema/builder/RestJsonSchemaBuilderV2.java
---
@@ -0,0 +1,127 @@
+/**
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.storm.solr.schema.builder;
+
+import org.apache.solr.client.solrj.SolrClient;
+import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.impl.CloudSolrClient;
+import org.apache.solr.client.solrj.impl.HttpClientUtil;
+import org.apache.solr.client.solrj.impl.Krb5HttpClientConfigurer;
+import org.apache.solr.client.solrj.request.schema.FieldTypeDefinition;
+import org.apache.solr.client.solrj.request.schema.SchemaRequest;
+import org.apache.solr.client.solrj.response.schema.SchemaRepresentation;
+import org.apache.solr.client.solrj.response.schema.SchemaResponse;
+import org.apache.storm.solr.config.SolrConfig;
+import org.apache.storm.solr.schema.CopyField;
+import org.apache.storm.solr.schema.Field;
+import org.apache.storm.solr.schema.FieldType;
+import org.apache.storm.solr.schema.Schema;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Class that builds the {@link Schema} object from the schema returned by
the SchemaRequest
+ */
+public class RestJsonSchemaBuilderV2 implements SchemaBuilder {
+ private static final Logger logger =
LoggerFactory.getLogger(RestJsonSchemaBuilderV2.class);
+ private Schema schema = new Schema();
+ private SolrConfig solrConfig;
+ private String collection;
+
+ public RestJsonSchemaBuilderV2(SolrConfig solrConfig, String
collection) {
+ this.solrConfig = solrConfig;
+ this.collection = collection;
+ }
+
+ @Override
+ public void buildSchema() throws IOException {
+ SolrClient solrClient = null;
+ try {
+ if (solrConfig.enableKerberos())
+ HttpClientUtil.setConfigurer(new
Krb5HttpClientConfigurer());
+
+ solrClient = new CloudSolrClient(solrConfig.getZkHostString());
--- End diff --
The initial code was building the schema from the JSON representation. The
other class has been deprecated, which means that JSON is no longer supported.
Is there a reason to support both? If so, there should probably be a factory
that depending on configuration choice (e.g. Kerberos) would build one or
another.
The goal of using JSON was to avoid using all of this programatic setting.
---