summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2016-06-27 15:11:44 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2016-06-27 15:11:44 +0200
commitfec8f248bdaefe1628adae8a35d0a3fc17fdc33c (patch)
treef78bb753bf246d50dccecc4aab3d5fd2610f780c /config-model
parentc3a6e8d99b0878180a448ce632d7458e3b1e634d (diff)
Correct indexing chain logic and cleanup
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/content/Content.java24
1 files changed, 7 insertions, 17 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/content/Content.java b/config-model/src/main/java/com/yahoo/vespa/model/content/Content.java
index 97857e3bc34..31a880ea29c 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/content/Content.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/content/Content.java
@@ -71,13 +71,11 @@ public class Content extends ConfigModel {
public void createTlds(ConfigModelRepo modelRepo) {
IndexedSearchCluster indexedCluster = cluster.getSearch().getIndexed();
- if (indexedCluster == null) {
- return;
- }
+ if (indexedCluster == null) return;
SimpleConfigProducer tldParent = new SimpleConfigProducer(indexedCluster, "tlds");
for (ConfigModel model : modelRepo.asMap().values()) {
- if (!(model instanceof ContainerModel)) {
+ if ( ! (model instanceof ContainerModel)) {
continue;
}
@@ -92,15 +90,13 @@ public class Content extends ConfigModel {
indexedCluster.setupDispatchGroups();
}
- private static boolean checkParentChain(ComponentRegistry<DocprocChain> allChains, ChainSpecification chainSpec) {
- if (IndexingDocprocChain.NAME.equals(chainSpec.componentId.stringValue())) {
- return true;
- }
+ private static boolean containsIndexingChain(ComponentRegistry<DocprocChain> allChains, ChainSpecification chainSpec) {
+ if (IndexingDocprocChain.NAME.equals(chainSpec.componentId.stringValue())) return true;
ChainSpecification.Inheritance inheritance = chainSpec.inheritance;
for (ComponentSpecification parentComponentSpec : inheritance.chainSpecifications) {
ChainSpecification parentSpec = getChainSpec(allChains, parentComponentSpec);
- checkParentChain(allChains, parentSpec);
+ if (containsIndexingChain(allChains, parentSpec)) return true;
}
return false;
@@ -138,17 +134,11 @@ public class Content extends ConfigModel {
private static void checkThatExplicitIndexingChainInheritsCorrectly(ComponentRegistry<DocprocChain> allChains, ChainSpecification chainSpec) {
ChainSpecification.Inheritance inheritance = chainSpec.inheritance;
- boolean found = false;
for (ComponentSpecification componentSpec : inheritance.chainSpecifications) {
ChainSpecification parentSpec = getChainSpec(allChains, componentSpec);
- found = checkParentChain(allChains, parentSpec);
- if (found) {
- break;
- }
- }
- if (!found) {
- throw new IllegalArgumentException("Docproc chain '" + chainSpec.componentId + "' does not inherit from 'indexing' chain.");
+ if (containsIndexingChain(allChains, parentSpec)) return;
}
+ throw new IllegalArgumentException("Docproc chain '" + chainSpec.componentId + "' does not inherit from 'indexing' chain.");
}
public static List<Content> getContent(ConfigModelRepo pc) {