forked from kiritbasu/datacollector
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SDC-12428. Move SolrTarget config parameters to config bean
Encapsulate all the config Solr config parameters in a ConfigBean object. This will make the implementation of SDC-12216 easier Change-Id: I79a51c572332d6abecfe4ec52aa7d5c13f161be7 Reviewed-on: https://review.streamsets.net/c/25637 Reviewed-by: Xavier Baqués <xavi@streamsets.com>
- Loading branch information
Showing
5 changed files
with
587 additions
and
306 deletions.
There are no files selected for viewing
224 changes: 224 additions & 0 deletions
224
...protolib/src/main/java/com/streamsets/pipeline/stage/destination/solr/SolrConfigBean.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,224 @@ | ||
/* | ||
* Copyright 2019 StreamSets Inc. | ||
* | ||
* Licensed 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 com.streamsets.pipeline.stage.destination.solr; | ||
|
||
|
||
import com.streamsets.pipeline.api.ConfigDef; | ||
import com.streamsets.pipeline.api.Dependency; | ||
import com.streamsets.pipeline.api.ListBeanModel; | ||
import com.streamsets.pipeline.api.ValueChooserModel; | ||
import com.streamsets.pipeline.stage.processor.scripting.ProcessingMode; | ||
import com.streamsets.pipeline.stage.processor.scripting.ProcessingModeChooserValues; | ||
|
||
import java.util.List; | ||
|
||
public class SolrConfigBean { | ||
|
||
@ConfigDef( | ||
required = true, | ||
type = ConfigDef.Type.MODEL, | ||
defaultValue = "SINGLE_NODE", | ||
label = "Instance Type", | ||
description = "", | ||
displayPosition = 10, | ||
group = "SOLR" | ||
) | ||
@ValueChooserModel(InstanceTypeOptionsChooserValues.class) | ||
public InstanceTypeOptions instanceType; | ||
|
||
@ConfigDef( | ||
required = true, | ||
type = ConfigDef.Type.STRING, | ||
defaultValue = "http://localhost:8983/solr/corename", | ||
label = "Solr URI", | ||
description = "", | ||
displayPosition = 20, | ||
group = "SOLR", | ||
dependsOn = "instanceType", | ||
triggeredByValue = { "SINGLE_NODE"} | ||
) | ||
public String solrURI; | ||
|
||
@ConfigDef( | ||
required = true, | ||
type = ConfigDef.Type.STRING, | ||
defaultValue = "localhost:9983", | ||
label = "ZooKeeper Connection String", | ||
description = "Comma-separated list of the Zookeeper <HOST>:<PORT> used by the SolrCloud", | ||
displayPosition = 30, | ||
group = "SOLR", | ||
dependsOn = "instanceType", | ||
triggeredByValue = { "SOLR_CLOUD"} | ||
) | ||
public String zookeeperConnect; | ||
|
||
@ConfigDef( | ||
required = true, | ||
type = ConfigDef.Type.STRING, | ||
defaultValue = "", | ||
label = "Default Collection Name", | ||
description = "", | ||
displayPosition = 30, | ||
group = "SOLR", | ||
dependsOn = "instanceType", | ||
triggeredByValue = { "SOLR_CLOUD"} | ||
) | ||
public String defaultCollection; | ||
|
||
@ConfigDef( | ||
required = true, | ||
type = ConfigDef.Type.MODEL, | ||
defaultValue = "BATCH", | ||
label = "Record Indexing Mode", | ||
description = "If 'Record by Record' the destination indexes one record at a time, if 'Record batch' " + | ||
"the destination bulk indexes all the records in the batch. ", | ||
displayPosition = 40, | ||
group = "SOLR" | ||
) | ||
@ValueChooserModel(ProcessingModeChooserValues.class) | ||
public ProcessingMode indexingMode; | ||
|
||
@ConfigDef( | ||
required = true, | ||
type = ConfigDef.Type.BOOLEAN, | ||
defaultValue = "true", | ||
label = "Map Fields Automatically", | ||
description = "Maps record fields to Solr columns with matching names. Records must contain matching fields for" + | ||
" each required column in the schema", | ||
displayPosition = 50, | ||
group = "SOLR" | ||
) | ||
public boolean fieldsAlreadyMappedInRecord; | ||
|
||
@ConfigDef( | ||
required = true, | ||
type = ConfigDef.Type.MODEL, | ||
defaultValue="", | ||
label = "Fields", | ||
description = "Map record fields to Solr columns. Map fields to all required columns", | ||
displayPosition = 50, | ||
group = "SOLR", | ||
dependencies = { | ||
@Dependency(configName = "fieldsAlreadyMappedInRecord", triggeredByValues = "false") | ||
} | ||
) | ||
@ListBeanModel | ||
public List<SolrFieldMappingConfig> fieldNamesMap; | ||
|
||
@ConfigDef( | ||
required = true, | ||
type = ConfigDef.Type.STRING, | ||
defaultValue = "/", | ||
label = "Field Path for Data", | ||
displayPosition = 55, | ||
description = "Field path that contains the data to write to Solr", | ||
group = "SOLR", | ||
dependencies = { | ||
@Dependency(configName = "fieldsAlreadyMappedInRecord", triggeredByValues = "true") | ||
} | ||
) | ||
public String recordSolrFieldsPath; | ||
|
||
@ConfigDef( | ||
required = false, | ||
type = ConfigDef.Type.LIST, | ||
defaultValue = "[]", | ||
label = "Auto-generated Fields", | ||
description = "Fields that are generated by Solr if not provided in the record", | ||
displayPosition = 57, | ||
group = "SOLR" | ||
) | ||
public List<String> autogeneratedFields; | ||
|
||
@ConfigDef( | ||
required = true, | ||
type = ConfigDef.Type.BOOLEAN, | ||
defaultValue = "true", | ||
label = "Ignore Optional Fields", | ||
displayPosition = 59, | ||
group = "SOLR" | ||
) | ||
public boolean ignoreOptionalFields = false; | ||
|
||
@ConfigDef( | ||
required = true, | ||
type = ConfigDef.Type.MODEL, | ||
defaultValue= "TO_ERROR", | ||
label = "Missing Fields", | ||
description = "Action to take when fields are empty", | ||
displayPosition = 60, | ||
group = "SOLR" | ||
) | ||
@ValueChooserModel(MissingFieldActionChooserValues.class) | ||
public MissingFieldAction missingFieldAction = MissingFieldAction.TO_ERROR; | ||
|
||
@ConfigDef( | ||
required = true, | ||
type = ConfigDef.Type.BOOLEAN, | ||
defaultValue = "false", | ||
label = "Kerberos Authentication", | ||
displayPosition = 70, | ||
group = "SOLR" | ||
) | ||
public boolean kerberosAuth; | ||
|
||
@ConfigDef( | ||
required = true, | ||
type = ConfigDef.Type.BOOLEAN, | ||
defaultValue = "false", | ||
label = "Skip Validation", | ||
displayPosition = 80, | ||
group = "SOLR" | ||
) | ||
public boolean skipValidation; | ||
|
||
@ConfigDef( | ||
required = true, | ||
type = ConfigDef.Type.BOOLEAN, | ||
defaultValue = "true", | ||
label = "Wait Flush", | ||
description = "Block until index changes are flushed to disk", | ||
displayPosition = 1000, | ||
group = "SOLR" | ||
) | ||
public boolean waitFlush = true; | ||
|
||
@ConfigDef( | ||
required = true, | ||
type = ConfigDef.Type.BOOLEAN, | ||
defaultValue = "true", | ||
label = "Wait Searcher", | ||
description = "Block until a new searcher is opened and registered as the main query searcher, making the" + | ||
" changes visible", | ||
displayPosition = 1010, | ||
group = "SOLR" | ||
) | ||
public boolean waitSearcher = true; | ||
|
||
@ConfigDef( | ||
required = true, | ||
type = ConfigDef.Type.BOOLEAN, | ||
defaultValue = "false", | ||
label = "Soft Commit", | ||
description = "Makes index changes visible while neither fsync-ing index files nor writing a new index" + | ||
" descriptor", | ||
displayPosition = 1020, | ||
group = "SOLR" | ||
) | ||
public boolean softCommit = false; | ||
|
||
} |
Oops, something went wrong.