SOLR-12036: Factor out DefaultStreamFactory solrj class.

This commit is contained in:
Christine Poerschke 2018-04-10 20:45:58 +01:00
parent a39a6ce672
commit e8f862ea44
4 changed files with 37 additions and 8 deletions

View File

@ -84,6 +84,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
----------------------

View File

@ -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){

View File

@ -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.

View File

@ -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);
}
}