You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by cp...@apache.org on 2018/04/10 19:48:50 UTC

lucene-solr:branch_7x: SOLR-12036: Factor out DefaultStreamFactory solrj class.

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_7x 750c7a982 -> bce3925cd


SOLR-12036: Factor out DefaultStreamFactory solrj class.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/bce3925c
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/bce3925c
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/bce3925c

Branch: refs/heads/branch_7x
Commit: bce3925cd8428841517af3cc29565a9e204e7cc7
Parents: 750c7a9
Author: Christine Poerschke <cp...@apache.org>
Authored: Tue Apr 10 20:45:58 2018 +0100
Committer: Christine Poerschke <cp...@apache.org>
Committed: Tue Apr 10 20:47:47 2018 +0100

----------------------------------------------------------------------
 solr/CHANGES.txt                                |  2 ++
 .../org/apache/solr/handler/GraphHandler.java   |  6 ++--
 .../org/apache/solr/handler/StreamHandler.java  |  6 ++--
 .../io/stream/expr/DefaultStreamFactory.java    | 31 ++++++++++++++++++++
 4 files changed, 37 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/bce3925c/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 4be66ab..0c88650 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -59,6 +59,8 @@ New Features
 * SOLR-10783: Add support for Hadoop Credential Provider as SSL/TLS store password source.
   (Mano Kovacs via Mark Miller)
 
+* SOLR-12036: Factor out DefaultStreamFactory solrj class. (Christine Poerschke)
+
 Bug Fixes
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/bce3925c/solr/core/src/java/org/apache/solr/handler/GraphHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/GraphHandler.java b/solr/core/src/java/org/apache/solr/handler/GraphHandler.java
index cb4f8d5..13874c9 100644
--- a/solr/core/src/java/org/apache/solr/handler/GraphHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/GraphHandler.java
@@ -25,10 +25,10 @@ import java.util.Map;
 import java.util.Map.Entry;
 
 import org.apache.solr.client.solrj.io.Tuple;
-import org.apache.solr.client.solrj.io.Lang;
 import org.apache.solr.client.solrj.io.comp.StreamComparator;
 import org.apache.solr.client.solrj.io.graph.Traversal;
 import org.apache.solr.client.solrj.io.stream.*;
+import org.apache.solr.client.solrj.io.stream.expr.DefaultStreamFactory;
 import org.apache.solr.client.solrj.io.stream.expr.Explanation;
 import org.apache.solr.client.solrj.io.stream.expr.Expressible;
 import org.apache.solr.client.solrj.io.stream.expr.StreamFactory;
@@ -53,7 +53,7 @@ import org.slf4j.LoggerFactory;
  */
 public class GraphHandler extends RequestHandlerBase implements SolrCoreAware, PermissionNameProvider {
 
-  private StreamFactory streamFactory = new StreamFactory();
+  private StreamFactory streamFactory = new DefaultStreamFactory();
   private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
   private String coreName;
 
@@ -86,8 +86,6 @@ public class GraphHandler extends RequestHandlerBase implements SolrCoreAware, P
       streamFactory.withDefaultZkHost(defaultZkhost);
     }
 
-    Lang.register(streamFactory);
-
     // This pulls all the overrides and additions from the config
     Object functionMappingsObj = initArgs.get("streamFunctions");
     if(null != functionMappingsObj){

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/bce3925c/solr/core/src/java/org/apache/solr/handler/StreamHandler.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/StreamHandler.java b/solr/core/src/java/org/apache/solr/handler/StreamHandler.java
index ffe66de..269d12d 100644
--- a/solr/core/src/java/org/apache/solr/handler/StreamHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/StreamHandler.java
@@ -29,9 +29,9 @@ import java.util.Map;
 import org.apache.solr.client.solrj.io.ModelCache;
 import org.apache.solr.client.solrj.io.SolrClientCache;
 import org.apache.solr.client.solrj.io.Tuple;
-import org.apache.solr.client.solrj.io.Lang;
 import org.apache.solr.client.solrj.io.comp.StreamComparator;
 import org.apache.solr.client.solrj.io.stream.*;
+import org.apache.solr.client.solrj.io.stream.expr.DefaultStreamFactory;
 import org.apache.solr.client.solrj.io.stream.expr.Explanation;
 import org.apache.solr.client.solrj.io.stream.expr.Explanation.ExpressionType;
 import org.apache.solr.client.solrj.io.stream.expr.Expressible;
@@ -65,7 +65,7 @@ public class StreamHandler extends RequestHandlerBase implements SolrCoreAware,
 
   static SolrClientCache clientCache = new SolrClientCache();
   static ModelCache modelCache = null;
-  private StreamFactory streamFactory = new StreamFactory();
+  private StreamFactory streamFactory = new DefaultStreamFactory();
   private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
   private String coreName;
   private Map<String,DaemonStream> daemons = Collections.synchronizedMap(new HashMap());
@@ -106,8 +106,6 @@ public class StreamHandler extends RequestHandlerBase implements SolrCoreAware,
           clientCache);
     }
 
-    Lang.register(streamFactory);
-
     /*
     * Add the core functions. These are functions that rely directly on either Lucene or Solr
     * capabilities that are not part of Lang.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/bce3925c/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/expr/DefaultStreamFactory.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/expr/DefaultStreamFactory.java b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/expr/DefaultStreamFactory.java
new file mode 100644
index 0000000..672d0cd
--- /dev/null
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/io/stream/expr/DefaultStreamFactory.java
@@ -0,0 +1,31 @@
+/*
+ * 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.io.stream.expr;
+
+import org.apache.solr.client.solrj.io.Lang;
+
+/**
+ * A default collection of mappings, used to convert strings into stream expressions.
+ */
+public class DefaultStreamFactory extends StreamFactory {
+
+  public DefaultStreamFactory() {
+    super();
+    Lang.register(this);
+  }
+
+}