summaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2020-03-13 22:52:43 +0100
committerGitHub <noreply@github.com>2020-03-13 22:52:43 +0100
commita289c6ea55bc0251e437805892e545c5c3090f99 (patch)
tree661d9d3b319c3299a6f70eb47044c192476f1494 /config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java
parent7e92c3852e893d09f0aa821e04e4e9dbe83b4ab2 (diff)
Revert "Bratseth/search to schema"
Diffstat (limited to 'config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java')
-rw-r--r--config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java31
1 files changed, 19 insertions, 12 deletions
diff --git a/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java b/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java
index 01809faa2f6..074b19d7238 100644
--- a/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java
+++ b/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java
@@ -36,8 +36,9 @@ import com.yahoo.vespa.model.container.search.QueryProfiles;
import com.yahoo.vespa.model.container.search.QueryProfilesBuilder;
import com.yahoo.vespa.model.container.search.SemanticRuleBuilder;
import com.yahoo.vespa.model.container.search.SemanticRules;
-import com.yahoo.vespa.model.search.NamedSchema;
+import com.yahoo.vespa.model.search.SearchDefinition;
+import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.Reader;
@@ -61,7 +62,7 @@ public class DeployState implements ConfigDefinitionStore {
private final DeployLogger logger;
private final FileRegistry fileRegistry;
private final DocumentModel documentModel;
- private final List<NamedSchema> schemas;
+ private final List<SearchDefinition> searchDefinitions;
private final ApplicationPackage applicationPackage;
private final Optional<ConfigDefinitionRepo> configDefinitionRepo;
private final Optional<ApplicationPackage> permanentApplicationPackage;
@@ -121,7 +122,7 @@ public class DeployState implements ConfigDefinitionStore {
this.previousModel = previousModel;
this.accessLoggingEnabledByDefault = accessLoggingEnabledByDefault;
this.provisioner = hostProvisioner.orElse(getDefaultModelHostProvisioner(applicationPackage));
- this.schemas = searchDocumentModel.getSchemas();
+ this.searchDefinitions = searchDocumentModel.getSearchDefinitions();
this.documentModel = searchDocumentModel.getDocumentModel();
this.permanentApplicationPackage = permanentApplicationPackage;
this.configDefinitionRepo = configDefinitionRepo;
@@ -208,8 +209,8 @@ public class DeployState implements ConfigDefinitionStore {
return applicationPackage;
}
- public List<NamedSchema> getSchemas() {
- return schemas;
+ public List<SearchDefinition> getSearchDefinitions() {
+ return searchDefinitions;
}
public DocumentModel getDocumentModel() {
@@ -426,18 +427,20 @@ public class DeployState implements ConfigDefinitionStore {
for (NamedReader reader : readers) {
try {
String readerName = reader.getName();
- String topLevelName = builder.importReader(reader, readerName, logger);
+ String searchName = builder.importReader(reader, readerName, logger);
String sdName = stripSuffix(readerName, ApplicationPackage.SD_NAME_SUFFIX);
- names.put(topLevelName, sdName);
- if ( ! sdName.equals(topLevelName)) {
- throw new IllegalArgumentException("Schema definition file name ('" + sdName + "') and name of " +
- "top level element ('" + topLevelName +
+ names.put(searchName, sdName);
+ if ( ! sdName.equals(searchName)) {
+ throw new IllegalArgumentException("Search definition file name ('" + sdName + "') and name of " +
+ "search element ('" + searchName +
"') are not equal for file '" + readerName + "'");
}
} catch (ParseException e) {
- throw new IllegalArgumentException("Could not parse sd file '" + reader.getName(), e);
+ throw new IllegalArgumentException("Could not parse search definition file '" +
+ getSearchDefinitionRelativePath(reader.getName()) + "': " + e.getMessage(), e);
} catch (IOException e) {
- throw new IllegalArgumentException("Could not read sd file '" + reader.getName(), e);
+ throw new IllegalArgumentException("Could not read search definition file '" +
+ getSearchDefinitionRelativePath(reader.getName()) + "': " + e.getMessage(), e);
} finally {
closeIgnoreException(reader.getReader());
}
@@ -446,6 +449,10 @@ public class DeployState implements ConfigDefinitionStore {
return SearchDocumentModel.fromBuilderAndNames(builder, names);
}
+ private String getSearchDefinitionRelativePath(String name) {
+ return ApplicationPackage.SEARCH_DEFINITIONS_DIR + File.separator + name;
+ }
+
private static String stripSuffix(String nodeName, String postfix) {
assert (nodeName.endsWith(postfix));
return nodeName.substring(0, nodeName.length() - postfix.length());