public PageTemplateRegistry read(String directory) {
        List<NamedReader> pageReaders = new ArrayList<>();
        try {
            File dir = new File(directory);
            if ( ! dir.isDirectory() ) throw new IllegalArgumentException("Could not read page templates: '" +
                                                                          directory + "' is not a valid directory.");

            for (File file : sortFiles(dir)) {
                if ( ! file.getName().endsWith(".xml")) continue;
                pageReaders.add(new NamedReader(file.getName(), new FileReader(file)));
            }

            return read(pageReaders, true);
        }
        catch (IOException e) {
            throw new IllegalArgumentException("Could not read page templates from '" + directory + "'",e);
        }
        finally {
            for (NamedReader reader : pageReaders) {
                try { reader.close(); } catch (IOException e) { }
            }
        }
    }
Reads all page template xml files in a given directory.

@throws RuntimeException if <code>directory</code> is not a readable directory, or if there is some error in the XML
container-search/src/main/java/com/yahoo/search/pagetemplates/config/PageTemplateXMLReader.java