diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-01-24 17:06:51 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-01-24 17:06:51 +0100 |
commit | c9be2d021bdf5b57a00fab40db35a3e3ece95760 (patch) | |
tree | 674f42d30ba2ce9c67f40dad9539d8decbee74de /config-model | |
parent | 56748bee37ad8fae2889c2f7711201768f8be342 (diff) |
Simplify
Diffstat (limited to 'config-model')
-rw-r--r-- | config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java | 26 | ||||
-rw-r--r-- | config-model/src/main/java/com/yahoo/config/model/deploy/SearchDocumentModel.java | 35 |
2 files changed, 11 insertions, 50 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 d83419f5093..3036572cd01 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 @@ -28,11 +28,10 @@ import com.yahoo.config.model.test.MockApplicationPackage; import com.yahoo.config.provision.DockerImage; import com.yahoo.config.provision.Zone; import com.yahoo.io.IOUtils; -import com.yahoo.io.reader.NamedReader; +import com.yahoo.searchdefinition.Application; import com.yahoo.searchdefinition.RankProfileRegistry; import com.yahoo.searchdefinition.Schema; import com.yahoo.searchdefinition.SchemaBuilder; -import com.yahoo.searchdefinition.parser.ParseException; import com.yahoo.vespa.config.ConfigDefinition; import com.yahoo.vespa.config.ConfigDefinitionBuilder; import com.yahoo.vespa.config.ConfigDefinitionKey; @@ -103,8 +102,7 @@ public class DeployState implements ConfigDefinitionStore { return new Builder().applicationPackage(applicationPackage).build(); } - private DeployState(ApplicationPackage applicationPackage, - SearchDocumentModel searchDocumentModel, + private DeployState(Application application, RankProfileRegistry rankProfileRegistry, FileRegistry fileRegistry, ExecutorService executor, @@ -130,15 +128,15 @@ public class DeployState implements ConfigDefinitionStore { this.fileRegistry = fileRegistry; this.executor = executor; this.rankProfileRegistry = rankProfileRegistry; - this.applicationPackage = applicationPackage; + this.applicationPackage = application.applicationPackage(); this.properties = properties; this.vespaVersion = vespaVersion; this.previousModel = previousModel; this.accessLoggingEnabledByDefault = accessLoggingEnabledByDefault; this.provisioner = hostProvisioner.orElse(getDefaultModelHostProvisioner(applicationPackage)); this.provisioned = provisioned; - this.schemas = searchDocumentModel.getSchemas(); - this.documentModel = searchDocumentModel.getDocumentModel(); + this.schemas = List.copyOf(application.schemas().values()); + this.documentModel = application.documentModel(); this.permanentApplicationPackage = permanentApplicationPackage; this.configDefinitionRepo = configDefinitionRepo; this.endpoints = Set.copyOf(endpoints); @@ -442,9 +440,8 @@ public class DeployState implements ConfigDefinitionStore { RankProfileRegistry rankProfileRegistry = new RankProfileRegistry(); QueryProfiles queryProfiles = new QueryProfilesBuilder().build(applicationPackage, logger); SemanticRules semanticRules = new SemanticRuleBuilder().build(applicationPackage); - SearchDocumentModel searchDocumentModel = createSearchDocumentModel(rankProfileRegistry, queryProfiles, validationParameters); - return new DeployState(applicationPackage, - searchDocumentModel, + Application application = createApplication(rankProfileRegistry, queryProfiles, validationParameters); + return new DeployState(application, rankProfileRegistry, fileRegistry, executor, @@ -468,15 +465,14 @@ public class DeployState implements ConfigDefinitionStore { reindexing); } - // TODO: This should be moved into Application+SchemaBuilder - private SearchDocumentModel createSearchDocumentModel(RankProfileRegistry rankProfileRegistry, - QueryProfiles queryProfiles, - ValidationParameters validationParameters) { + private Application createApplication(RankProfileRegistry rankProfileRegistry, + QueryProfiles queryProfiles, + ValidationParameters validationParameters) { SchemaBuilder builder = new SchemaBuilder(applicationPackage, fileRegistry, logger, properties, rankProfileRegistry, queryProfiles.getRegistry()); builder.importFromApplicationPackage(); builder.build(! validationParameters.ignoreValidationErrors()); - return new SearchDocumentModel(builder); + return builder.application(); } } diff --git a/config-model/src/main/java/com/yahoo/config/model/deploy/SearchDocumentModel.java b/config-model/src/main/java/com/yahoo/config/model/deploy/SearchDocumentModel.java deleted file mode 100644 index 3673451b9ba..00000000000 --- a/config-model/src/main/java/com/yahoo/config/model/deploy/SearchDocumentModel.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.config.model.deploy; - -import com.yahoo.searchdefinition.Schema; -import com.yahoo.searchdefinition.SchemaBuilder; -import com.yahoo.vespa.documentmodel.DocumentModel; - -import java.util.ArrayList; -import java.util.List; - -/** - * Internal helper class to retrieve document model and schemas. - * - * @author Ulf Lilleengen - */ -// TODO: This should be removed in favor of Application -public class SearchDocumentModel { - - private final DocumentModel documentModel; - private final List<Schema> schemas; - - public SearchDocumentModel(SchemaBuilder builder) { - this.documentModel = builder.getModel(); - this.schemas = builder.getSchemaList(); - } - - public DocumentModel getDocumentModel() { - return documentModel; - } - - public List<Schema> getSchemas() { - return schemas; - } - -} |