diff options
author | Jon Bratseth <bratseth@verizonmedia.com> | 2020-03-13 15:03:16 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@verizonmedia.com> | 2020-03-13 15:03:16 +0100 |
commit | d1dc33f47cb35a0542f10f60309a3d24b7a85a29 (patch) | |
tree | a9076d1c5d0aa699e7f5a9131cb0d0c90646ef39 /config-model-api | |
parent | 8afe53c8d43910621ce19ad7d278b601dd85eaa1 (diff) |
searchdefinitions -> schemas
Diffstat (limited to 'config-model-api')
3 files changed, 18 insertions, 14 deletions
diff --git a/config-model-api/abi-spec.json b/config-model-api/abi-spec.json index 8556fd4a40b..4a7d929fd3e 100644 --- a/config-model-api/abi-spec.json +++ b/config-model-api/abi-spec.json @@ -137,6 +137,7 @@ "fields": [ "public static final java.lang.String HOSTS", "public static final java.lang.String SERVICES", + "public static final com.yahoo.path.Path SCHEMAS_DIR", "public static final com.yahoo.path.Path SEARCH_DEFINITIONS_DIR", "public static final java.lang.String COMPONENT_DIR", "public static final java.lang.String SEARCHCHAINS_DIR", 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 db3d391d19b..174f9bb54d7 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 @@ -36,8 +36,6 @@ import java.util.jar.JarFile; * The class hides detail as to whether the source is local files or ZooKeeper * data in config server. * - * Anyone wanting to access application data should use this interface. - * * @author Vegard Havdal */ public interface ApplicationPackage { @@ -47,7 +45,8 @@ public interface ApplicationPackage { String HOSTS = "hosts.xml"; String SERVICES = "services.xml"; - Path SEARCH_DEFINITIONS_DIR = Path.fromString("searchdefinitions"); + Path SCHEMAS_DIR = Path.fromString("schemas"); + Path SEARCH_DEFINITIONS_DIR = Path.fromString("searchdefinitions"); // Legacy addition to schemas String COMPONENT_DIR = "components"; String SEARCHCHAINS_DIR = "search/chains"; String DOCPROCCHAINS_DIR = "docproc/chains"; @@ -168,7 +167,7 @@ public interface ApplicationPackage { } /** - * Returns inforamtion about a file + * Returns information about a file * * @param relativePath the relative path of the file within this application package. * @return information abut the file, returned whether or not the file exists @@ -206,23 +205,26 @@ public interface ApplicationPackage { Reader getRankingExpression(String name); /** - * Returns the name-payload pairs of any sd files under path/searchdefinitions/ in the given jar bundle - * @param bundle The jar file, which will be closed afterwards by this method. - * @param path For example 'complex/' + * Returns the name-payload pairs of any sd files under path/schemas and path/searchdefinitions/ + * in the given jar bundle. + * + * @param bundle the jar file, which will be closed afterwards by this method + * @param path for example 'complex/' * @return map of the SD payloads * @throws IOException if it is reading sd files fails */ static Map<String, String> getBundleSdFiles(String path, JarFile bundle) throws IOException { - Map<String,String> ret = new LinkedHashMap<>(); + Map<String, String> schemas = new LinkedHashMap<>(); for (Enumeration<JarEntry> e = bundle.entries(); e.hasMoreElements();) { - JarEntry je=e.nextElement(); - if (je.getName().startsWith(path+SEARCH_DEFINITIONS_DIR+"/") && je.getName().endsWith(SD_NAME_SUFFIX)) { - String contents = IOUtils.readAll(new InputStreamReader(bundle.getInputStream(je))); - ret.put(getFileName(je), contents); + JarEntry entry = e.nextElement(); + if ((entry.getName().startsWith(path + SCHEMAS_DIR + "/") || entry.getName().startsWith(path + SEARCH_DEFINITIONS_DIR + "/")) + && entry.getName().endsWith(SD_NAME_SUFFIX)) { + String contents = IOUtils.readAll(new InputStreamReader(bundle.getInputStream(entry))); + schemas.put(getFileName(entry), contents); } } bundle.close(); - return ret; + return schemas; } /** diff --git a/config-model-api/src/main/java/com/yahoo/config/model/api/SuperModelListener.java b/config-model-api/src/main/java/com/yahoo/config/model/api/SuperModelListener.java index e66a7e1ef7e..930c3c94907 100644 --- a/config-model-api/src/main/java/com/yahoo/config/model/api/SuperModelListener.java +++ b/config-model-api/src/main/java/com/yahoo/config/model/api/SuperModelListener.java @@ -7,6 +7,7 @@ import com.yahoo.config.provision.ApplicationId; * Interface for those wanting to be notified about changes to the SuperModel. */ public interface SuperModelListener { + /** * Application has been activated: Either deployed the first time, * internally redeployed, or externally triggered redeploy. @@ -22,7 +23,7 @@ public interface SuperModelListener { * Invoked once all applications that were supposed to be deployed on bootstrap * have been activated (and the respective {@link #applicationActivated(SuperModel, ApplicationInfo) * applicationActivated} have been invoked). The SuperModel is then said to be "complete". - * @param superModel */ void notifyOfCompleteness(SuperModel superModel); + } |