diff --git a/solr/contrib/morphlines-cell/src/java/org/apache/solr/morphlines/cell/SolrCellBuilder.java b/solr/contrib/morphlines-cell/src/java/org/apache/solr/morphlines/cell/SolrCellBuilder.java index af50c7cfd12..dc1ae418255 100644 --- a/solr/contrib/morphlines-cell/src/java/org/apache/solr/morphlines/cell/SolrCellBuilder.java +++ b/solr/contrib/morphlines-cell/src/java/org/apache/solr/morphlines/cell/SolrCellBuilder.java @@ -61,6 +61,7 @@ import com.cloudera.cdk.morphline.api.MorphlineCompilationException; import com.cloudera.cdk.morphline.api.MorphlineContext; import com.cloudera.cdk.morphline.api.MorphlineRuntimeException; import com.cloudera.cdk.morphline.api.Record; +import com.cloudera.cdk.morphline.base.Configs; import com.cloudera.cdk.morphline.base.Fields; import com.cloudera.cdk.morphline.stdio.AbstractParser; import com.google.common.base.Joiner; @@ -87,7 +88,7 @@ public final class SolrCellBuilder implements CommandBuilder { @Override public Command build(Config config, Command parent, Command child, MorphlineContext context) { - return new SolrCell(config, parent, child, context); + return new SolrCell(this, config, parent, child, context); } @@ -109,8 +110,8 @@ public final class SolrCellBuilder implements CommandBuilder { public static final String ADDITIONAL_SUPPORTED_MIME_TYPES = "additionalSupportedMimeTypes"; - public SolrCell(Config config, Command parent, Command child, MorphlineContext context) { - super(config, parent, child, context); + public SolrCell(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) { + super(builder, config, parent, child, context); Config solrLocatorConfig = getConfigs().getConfig(config, "solrLocator"); SolrLocator locator = new SolrLocator(solrLocatorConfig, context); @@ -129,7 +130,7 @@ public final class SolrCellBuilder implements CommandBuilder { } Config fmapConfig = getConfigs().getConfig(config, "fmap", null); if (fmapConfig != null) { - for (Map.Entry entry : fmapConfig.root().unwrapped().entrySet()) { + for (Map.Entry entry : new Configs().getEntrySet(fmapConfig)) { cellParams.put(ExtractingParams.MAP_PREFIX + entry.getKey(), entry.getValue().toString()); } } diff --git a/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/GenerateSolrSequenceKeyBuilder.java b/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/GenerateSolrSequenceKeyBuilder.java index 251d016634c..badf99ec3e7 100644 --- a/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/GenerateSolrSequenceKeyBuilder.java +++ b/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/GenerateSolrSequenceKeyBuilder.java @@ -60,7 +60,7 @@ public final class GenerateSolrSequenceKeyBuilder implements CommandBuilder { @Override public Command build(Config config, Command parent, Command child, MorphlineContext context) { - return new GenerateSolrSequenceKey(config, parent, child, context); + return new GenerateSolrSequenceKey(this, config, parent, child, context); } @@ -77,8 +77,8 @@ public final class GenerateSolrSequenceKeyBuilder implements CommandBuilder { private final String idPrefix; // for load testing only; enables adding same document many times with a different unique key private final Random randomIdPrefix; // for load testing only; enables adding same document many times with a different unique key - public GenerateSolrSequenceKey(Config config, Command parent, Command child, MorphlineContext context) { - super(config, parent, child, context); + public GenerateSolrSequenceKey(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) { + super(builder, config, parent, child, context); this.baseIdFieldName = getConfigs().getString(config, "baseIdField", Fields.BASE_ID); this.preserveExisting = getConfigs().getBoolean(config, "preserveExisting", true); diff --git a/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/LoadSolrBuilder.java b/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/LoadSolrBuilder.java index 019dfcf0f52..ff27cd09e6f 100644 --- a/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/LoadSolrBuilder.java +++ b/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/LoadSolrBuilder.java @@ -31,6 +31,7 @@ import com.cloudera.cdk.morphline.api.MorphlineContext; import com.cloudera.cdk.morphline.api.MorphlineRuntimeException; import com.cloudera.cdk.morphline.api.Record; import com.cloudera.cdk.morphline.base.AbstractCommand; +import com.cloudera.cdk.morphline.base.Configs; import com.cloudera.cdk.morphline.base.Metrics; import com.cloudera.cdk.morphline.base.Notifications; import com.codahale.metrics.Timer; @@ -49,7 +50,7 @@ public final class LoadSolrBuilder implements CommandBuilder { @Override public Command build(Config config, Command parent, Command child, MorphlineContext context) { - return new LoadSolr(config, parent, child, context); + return new LoadSolr(this, config, parent, child, context); } @@ -62,14 +63,14 @@ public final class LoadSolrBuilder implements CommandBuilder { private final Map boosts = new HashMap(); private final Timer elapsedTime; - public LoadSolr(Config config, Command parent, Command child, MorphlineContext context) { - super(config, parent, child, context); + public LoadSolr(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) { + super(builder, config, parent, child, context); Config solrLocatorConfig = getConfigs().getConfig(config, "solrLocator"); SolrLocator locator = new SolrLocator(solrLocatorConfig, context); LOG.debug("solrLocator: {}", locator); this.loader = locator.getLoader(); Config boostsConfig = getConfigs().getConfig(config, "boosts", ConfigFactory.empty()); - for (Map.Entry entry : boostsConfig.root().unwrapped().entrySet()) { + for (Map.Entry entry : new Configs().getEntrySet(boostsConfig)) { String fieldName = entry.getKey(); float boost = Float.parseFloat(entry.getValue().toString().trim()); boosts.put(fieldName, boost); diff --git a/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/SanitizeUnknownSolrFieldsBuilder.java b/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/SanitizeUnknownSolrFieldsBuilder.java index fbc8de21bda..79ecec34b64 100644 --- a/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/SanitizeUnknownSolrFieldsBuilder.java +++ b/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/SanitizeUnknownSolrFieldsBuilder.java @@ -50,7 +50,7 @@ public final class SanitizeUnknownSolrFieldsBuilder implements CommandBuilder { @Override public Command build(Config config, Command parent, Command child, MorphlineContext context) { - return new SanitizeUnknownSolrFields(config, parent, child, context); + return new SanitizeUnknownSolrFields(this, config, parent, child, context); } @@ -62,8 +62,8 @@ public final class SanitizeUnknownSolrFieldsBuilder implements CommandBuilder { private final IndexSchema schema; private final String renameToPrefix; - public SanitizeUnknownSolrFields(Config config, Command parent, Command child, MorphlineContext context) { - super(config, parent, child, context); + public SanitizeUnknownSolrFields(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) { + super(builder, config, parent, child, context); Config solrLocatorConfig = getConfigs().getConfig(config, "solrLocator"); SolrLocator locator = new SolrLocator(solrLocatorConfig, context); diff --git a/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/TokenizeTextBuilder.java b/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/TokenizeTextBuilder.java index 58c1bb5536c..323eedd27de 100644 --- a/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/TokenizeTextBuilder.java +++ b/solr/contrib/morphlines-core/src/java/org/apache/solr/morphlines/solr/TokenizeTextBuilder.java @@ -51,7 +51,7 @@ public final class TokenizeTextBuilder implements CommandBuilder { @Override public Command build(Config config, Command parent, Command child, MorphlineContext context) { - return new TokenizeText(config, parent, child, context); + return new TokenizeText(this, config, parent, child, context); } @@ -66,8 +66,8 @@ public final class TokenizeTextBuilder implements CommandBuilder { private final CharTermAttribute token; // cached private final ReusableStringReader reader = new ReusableStringReader(); // cached - public TokenizeText(Config config, Command parent, Command child, MorphlineContext context) { - super(config, parent, child, context); + public TokenizeText(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) { + super(builder, config, parent, child, context); this.inputFieldName = getConfigs().getString(config, "inputField"); this.outputFieldName = getConfigs().getString(config, "outputField"); String solrFieldType = getConfigs().getString(config, "solrFieldType"); diff --git a/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkAliasTest.java b/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkAliasTest.java index 939ef199c89..35fbdf1486d 100644 --- a/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkAliasTest.java +++ b/solr/contrib/morphlines-core/src/test/org/apache/solr/morphlines/solr/SolrMorphlineZkAliasTest.java @@ -118,8 +118,6 @@ public class SolrMorphlineZkAliasTest extends AbstractSolrMorphlineZkTestBase { } catch (IllegalArgumentException e) { } - - cloudClient.shutdown(); } private NamedList createAlias(String alias, String collections) throws SolrServerException, IOException {