summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2017-08-28 15:32:45 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2017-08-28 15:32:45 +0200
commit8c50c885d8f3efb07e10dd585976004ba44cdbbe (patch)
treec404c17d40d0eccc88df396b24a8abc75db9ef1f /config-model
parent035e54041385d832e15f0c6fe1bdf20858332581 (diff)
Add one wimphy test
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java b/config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java
index 1f52d9db818..a20d502dbfb 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java
@@ -42,9 +42,17 @@ public class VespaModelFactory implements ModelFactory {
private final ConfigModelRegistry configModelRegistry;
private final Zone zone;
private final Clock clock;
+ private final Version version;
+ /** Creates a factory for vespa models for this version of the source */
@Inject
public VespaModelFactory(ComponentRegistry<ConfigModelPlugin> pluginRegistry, Zone zone) {
+ this(Version.fromIntValues(VespaVersion.major, VespaVersion.minor, VespaVersion.micro), pluginRegistry, zone);
+ }
+
+ /** Creates a factory for vespa models of a particular version */
+ public VespaModelFactory(Version version, ComponentRegistry<ConfigModelPlugin> pluginRegistry, Zone zone) {
+ this.version = version;
List<ConfigModelBuilder> modelBuilders = new ArrayList<>();
for (ConfigModelPlugin plugin : pluginRegistry.allComponents()) {
if (plugin instanceof ConfigModelBuilder) {
@@ -55,11 +63,15 @@ public class VespaModelFactory implements ModelFactory {
this.zone = zone;
this.clock = Clock.systemUTC();
}
-
+
public VespaModelFactory(ConfigModelRegistry configModelRegistry) {
this(configModelRegistry, Clock.systemUTC());
}
public VespaModelFactory(ConfigModelRegistry configModelRegistry, Clock clock) {
+ this(Version.fromIntValues(VespaVersion.major, VespaVersion.minor, VespaVersion.micro), configModelRegistry, clock);
+ }
+ public VespaModelFactory(Version version, ConfigModelRegistry configModelRegistry, Clock clock) {
+ this.version = version;
if (configModelRegistry == null) {
this.configModelRegistry = new NullConfigModelRegistry();
log.info("Will not load config models from plugins, as no registry is available");
@@ -72,9 +84,7 @@ public class VespaModelFactory implements ModelFactory {
/** Returns the version this model is build for */
@Override
- public Version getVersion() {
- return Version.fromIntValues(VespaVersion.major, VespaVersion.minor, VespaVersion.micro);
- }
+ public Version getVersion() { return version; }
@Override
public Model createModel(ModelContext modelContext) {