aboutsummaryrefslogtreecommitdiffstats
path: root/config-model-api
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@oath.com>2018-12-01 07:35:14 -0800
committerJon Bratseth <bratseth@oath.com>2018-12-01 07:35:14 -0800
commit051c699dee05fc0a2f5e9a83ddd49016114d8bfb (patch)
treea94c05da756ff987d198a8bea2b9bf5149771546 /config-model-api
parentc0513ac34d2c438e9f97e699659855029e1f06e8 (diff)
Deprecate com.yahoo.config.provision.Version
We have com.yahoo.component.Version, and one is enough.
Diffstat (limited to 'config-model-api')
-rw-r--r--config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationPackage.java36
-rw-r--r--config-model-api/src/main/java/com/yahoo/config/model/api/ModelFactory.java12
2 files changed, 41 insertions, 7 deletions
diff --git a/config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationPackage.java b/config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationPackage.java
index c6e44e3aef3..6b49ea0c172 100644
--- a/config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationPackage.java
+++ b/config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationPackage.java
@@ -2,7 +2,7 @@
package com.yahoo.config.application.api;
import com.yahoo.config.provision.AllocatedHosts;
-import com.yahoo.config.provision.Version;
+import com.yahoo.component.Version;
import com.yahoo.config.provision.Zone;
import com.yahoo.io.IOUtils;
import com.yahoo.io.reader.NamedReader;
@@ -27,6 +27,7 @@ import java.util.Map;
import java.util.Optional;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
+import java.util.stream.Collectors;
/**
* Represents an application package, that is, used as input when creating a VespaModel and as
@@ -184,7 +185,17 @@ public interface ApplicationPackage {
Optional<Reader> getDeployment();
Optional<Reader> getValidationOverrides();
- List<ComponentInfo> getComponentsInfo(Version vespaVersion);
+ /** @deprecated do not override or call. Use the other Version class */
+ @Deprecated
+ default List<ComponentInfo> getComponentsInfo(com.yahoo.config.provision.Version vespaVersion) {
+ return getComponentsInfo(vespaVersion.toVersion());
+ }
+
+ // TODO: Remove the default implementation after December 2018
+ @SuppressWarnings("deprecation")
+ default List<ComponentInfo> getComponentsInfo(Version vespaVersion) {
+ return getComponentsInfo(com.yahoo.config.provision.Version.from(vespaVersion));
+ }
/**
* Reads a ranking expression from file to a string and returns it.
@@ -237,7 +248,13 @@ public interface ApplicationPackage {
throw new UnsupportedOperationException("This application package cannot validate XML");
}
- default void validateXML(Optional<Version> vespaVersion) throws IOException {
+ /** @deprecated do not override or call. Use the other Version class */
+ @Deprecated
+ default void validateXML(Optional<com.yahoo.config.provision.Version> vespaVersion) throws IOException {
+ validateXMLFor(vespaVersion.map(com.yahoo.config.provision.Version::toVersion));
+ }
+
+ default void validateXMLFor(Optional<Version> vespaVersion) throws IOException {
throw new UnsupportedOperationException("This application package cannot validate XML");
}
@@ -252,7 +269,7 @@ public interface ApplicationPackage {
*/
// TODO: Remove on Vespa 7
@Deprecated
- default Map<Version, AllocatedHosts> getProvisionInfoMap() {
+ default Map<com.yahoo.config.provision.Version, AllocatedHosts> getProvisionInfoMap() {
return Collections.emptyMap();
}
@@ -261,7 +278,16 @@ public interface ApplicationPackage {
return Optional.empty();
}
- default Map<Version, FileRegistry> getFileRegistryMap() {
+ /** @deprecated do not override or call. Use getFileRegistries */
+ @Deprecated
+ default Map<com.yahoo.config.provision.Version, FileRegistry> getFileRegistryMap() {
+ return getFileRegistries().entrySet()
+ .stream()
+ .collect(Collectors.toMap(e -> com.yahoo.config.provision.Version.from(e.getKey()),
+ e -> e.getValue()));
+ }
+
+ default Map<Version, FileRegistry> getFileRegistries() {
return Collections.emptyMap();
}
diff --git a/config-model-api/src/main/java/com/yahoo/config/model/api/ModelFactory.java b/config-model-api/src/main/java/com/yahoo/config/model/api/ModelFactory.java
index b2d9244cc9d..23782162725 100644
--- a/config-model-api/src/main/java/com/yahoo/config/model/api/ModelFactory.java
+++ b/config-model-api/src/main/java/com/yahoo/config/model/api/ModelFactory.java
@@ -1,7 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.model.api;
-import com.yahoo.config.provision.Version;
+import com.yahoo.component.Version;
/**
* Factory for config models.
@@ -13,7 +13,14 @@ public interface ModelFactory {
*
* @return the version of a {@link Model} instance that this factory can create.
*/
- Version getVersion();
+ @SuppressWarnings("deprecation")
+ default Version version() { // TODO: Remove this default implementationm after December 2018
+ return getVersion().toVersion();
+ }
+
+ /** @deprecated use and override version(). TODO: Remove this method after December 2018 */
+ @Deprecated
+ default com.yahoo.config.provision.Version getVersion() { return com.yahoo.config.provision.Version.from(version()); }
/**
* Creates an instance of a {@link Model}. The resulting instance will be used to serve config. No model
@@ -34,4 +41,5 @@ public interface ModelFactory {
* @return a {@link ModelCreateResult} instance.
*/
ModelCreateResult createAndValidateModel(ModelContext modelContext, ValidationParameters validationParameters);
+
}