SOLR-1301: Merge in latest morphlines module updates.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1547879 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2013-12-04 19:11:41 +00:00
parent b2a253a930
commit e4f83aa1a0
6 changed files with 19 additions and 19 deletions

View File

@ -61,6 +61,7 @@ import com.cloudera.cdk.morphline.api.MorphlineCompilationException;
import com.cloudera.cdk.morphline.api.MorphlineContext; import com.cloudera.cdk.morphline.api.MorphlineContext;
import com.cloudera.cdk.morphline.api.MorphlineRuntimeException; import com.cloudera.cdk.morphline.api.MorphlineRuntimeException;
import com.cloudera.cdk.morphline.api.Record; 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.base.Fields;
import com.cloudera.cdk.morphline.stdio.AbstractParser; import com.cloudera.cdk.morphline.stdio.AbstractParser;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
@ -87,7 +88,7 @@ public final class SolrCellBuilder implements CommandBuilder {
@Override @Override
public Command build(Config config, Command parent, Command child, MorphlineContext context) { 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 static final String ADDITIONAL_SUPPORTED_MIME_TYPES = "additionalSupportedMimeTypes";
public SolrCell(Config config, Command parent, Command child, MorphlineContext context) { public SolrCell(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) {
super(config, parent, child, context); super(builder, config, parent, child, context);
Config solrLocatorConfig = getConfigs().getConfig(config, "solrLocator"); Config solrLocatorConfig = getConfigs().getConfig(config, "solrLocator");
SolrLocator locator = new SolrLocator(solrLocatorConfig, context); SolrLocator locator = new SolrLocator(solrLocatorConfig, context);
@ -129,7 +130,7 @@ public final class SolrCellBuilder implements CommandBuilder {
} }
Config fmapConfig = getConfigs().getConfig(config, "fmap", null); Config fmapConfig = getConfigs().getConfig(config, "fmap", null);
if (fmapConfig != null) { if (fmapConfig != null) {
for (Map.Entry<String, Object> entry : fmapConfig.root().unwrapped().entrySet()) { for (Map.Entry<String, Object> entry : new Configs().getEntrySet(fmapConfig)) {
cellParams.put(ExtractingParams.MAP_PREFIX + entry.getKey(), entry.getValue().toString()); cellParams.put(ExtractingParams.MAP_PREFIX + entry.getKey(), entry.getValue().toString());
} }
} }

View File

@ -60,7 +60,7 @@ public final class GenerateSolrSequenceKeyBuilder implements CommandBuilder {
@Override @Override
public Command build(Config config, Command parent, Command child, MorphlineContext context) { 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 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 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) { public GenerateSolrSequenceKey(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) {
super(config, parent, child, context); super(builder, config, parent, child, context);
this.baseIdFieldName = getConfigs().getString(config, "baseIdField", Fields.BASE_ID); this.baseIdFieldName = getConfigs().getString(config, "baseIdField", Fields.BASE_ID);
this.preserveExisting = getConfigs().getBoolean(config, "preserveExisting", true); this.preserveExisting = getConfigs().getBoolean(config, "preserveExisting", true);

View File

@ -31,6 +31,7 @@ import com.cloudera.cdk.morphline.api.MorphlineContext;
import com.cloudera.cdk.morphline.api.MorphlineRuntimeException; import com.cloudera.cdk.morphline.api.MorphlineRuntimeException;
import com.cloudera.cdk.morphline.api.Record; import com.cloudera.cdk.morphline.api.Record;
import com.cloudera.cdk.morphline.base.AbstractCommand; 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.Metrics;
import com.cloudera.cdk.morphline.base.Notifications; import com.cloudera.cdk.morphline.base.Notifications;
import com.codahale.metrics.Timer; import com.codahale.metrics.Timer;
@ -49,7 +50,7 @@ public final class LoadSolrBuilder implements CommandBuilder {
@Override @Override
public Command build(Config config, Command parent, Command child, MorphlineContext context) { 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<String, Float> boosts = new HashMap(); private final Map<String, Float> boosts = new HashMap();
private final Timer elapsedTime; private final Timer elapsedTime;
public LoadSolr(Config config, Command parent, Command child, MorphlineContext context) { public LoadSolr(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) {
super(config, parent, child, context); super(builder, config, parent, child, context);
Config solrLocatorConfig = getConfigs().getConfig(config, "solrLocator"); Config solrLocatorConfig = getConfigs().getConfig(config, "solrLocator");
SolrLocator locator = new SolrLocator(solrLocatorConfig, context); SolrLocator locator = new SolrLocator(solrLocatorConfig, context);
LOG.debug("solrLocator: {}", locator); LOG.debug("solrLocator: {}", locator);
this.loader = locator.getLoader(); this.loader = locator.getLoader();
Config boostsConfig = getConfigs().getConfig(config, "boosts", ConfigFactory.empty()); Config boostsConfig = getConfigs().getConfig(config, "boosts", ConfigFactory.empty());
for (Map.Entry<String, Object> entry : boostsConfig.root().unwrapped().entrySet()) { for (Map.Entry<String, Object> entry : new Configs().getEntrySet(boostsConfig)) {
String fieldName = entry.getKey(); String fieldName = entry.getKey();
float boost = Float.parseFloat(entry.getValue().toString().trim()); float boost = Float.parseFloat(entry.getValue().toString().trim());
boosts.put(fieldName, boost); boosts.put(fieldName, boost);

View File

@ -50,7 +50,7 @@ public final class SanitizeUnknownSolrFieldsBuilder implements CommandBuilder {
@Override @Override
public Command build(Config config, Command parent, Command child, MorphlineContext context) { 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 IndexSchema schema;
private final String renameToPrefix; private final String renameToPrefix;
public SanitizeUnknownSolrFields(Config config, Command parent, Command child, MorphlineContext context) { public SanitizeUnknownSolrFields(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) {
super(config, parent, child, context); super(builder, config, parent, child, context);
Config solrLocatorConfig = getConfigs().getConfig(config, "solrLocator"); Config solrLocatorConfig = getConfigs().getConfig(config, "solrLocator");
SolrLocator locator = new SolrLocator(solrLocatorConfig, context); SolrLocator locator = new SolrLocator(solrLocatorConfig, context);

View File

@ -51,7 +51,7 @@ public final class TokenizeTextBuilder implements CommandBuilder {
@Override @Override
public Command build(Config config, Command parent, Command child, MorphlineContext context) { 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 CharTermAttribute token; // cached
private final ReusableStringReader reader = new ReusableStringReader(); // cached private final ReusableStringReader reader = new ReusableStringReader(); // cached
public TokenizeText(Config config, Command parent, Command child, MorphlineContext context) { public TokenizeText(CommandBuilder builder, Config config, Command parent, Command child, MorphlineContext context) {
super(config, parent, child, context); super(builder, config, parent, child, context);
this.inputFieldName = getConfigs().getString(config, "inputField"); this.inputFieldName = getConfigs().getString(config, "inputField");
this.outputFieldName = getConfigs().getString(config, "outputField"); this.outputFieldName = getConfigs().getString(config, "outputField");
String solrFieldType = getConfigs().getString(config, "solrFieldType"); String solrFieldType = getConfigs().getString(config, "solrFieldType");

View File

@ -118,8 +118,6 @@ public class SolrMorphlineZkAliasTest extends AbstractSolrMorphlineZkTestBase {
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
} }
cloudClient.shutdown();
} }
private NamedList<Object> createAlias(String alias, String collections) throws SolrServerException, IOException { private NamedList<Object> createAlias(String alias, String collections) throws SolrServerException, IOException {