diff options
author | Jon Bratseth <bratseth@gmail.com> | 2020-03-13 22:52:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-13 22:52:43 +0100 |
commit | a289c6ea55bc0251e437805892e545c5c3090f99 (patch) | |
tree | 661d9d3b319c3299a6f70eb47044c192476f1494 /config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationPackage.java | |
parent | 7e92c3852e893d09f0aa821e04e4e9dbe83b4ab2 (diff) |
Revert "Bratseth/search to schema"
Diffstat (limited to 'config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationPackage.java')
-rw-r--r-- | config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationPackage.java | 28 |
1 files changed, 13 insertions, 15 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 174f9bb54d7..db3d391d19b 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,6 +36,8 @@ 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 { @@ -45,8 +47,7 @@ public interface ApplicationPackage { String HOSTS = "hosts.xml"; String SERVICES = "services.xml"; - Path SCHEMAS_DIR = Path.fromString("schemas"); - Path SEARCH_DEFINITIONS_DIR = Path.fromString("searchdefinitions"); // Legacy addition to schemas + Path SEARCH_DEFINITIONS_DIR = Path.fromString("searchdefinitions"); String COMPONENT_DIR = "components"; String SEARCHCHAINS_DIR = "search/chains"; String DOCPROCCHAINS_DIR = "docproc/chains"; @@ -167,7 +168,7 @@ public interface ApplicationPackage { } /** - * Returns information about a file + * Returns inforamtion 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 @@ -205,26 +206,23 @@ public interface ApplicationPackage { Reader getRankingExpression(String name); /** - * 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/' + * 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/' * @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> schemas = new LinkedHashMap<>(); + Map<String,String> ret = new LinkedHashMap<>(); for (Enumeration<JarEntry> e = bundle.entries(); e.hasMoreElements();) { - 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); + 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); } } bundle.close(); - return schemas; + return ret; } /** |