public static List<String> findTemplates(String root) throws IOException, URISyntaxException {
        if (root == null) {
            return findTemplates();
        }

        logger.debug("Looking for templates in classpath under [{}].", root);

        final List<String> templateNames = new ArrayList<>();
        String[] resources = ResourceList.getResources(root + "/" + Defaults.TemplateDir + "/"); // "es/_template/"
        for (String resource : resources) {
            if (!resource.isEmpty()) {
                String withoutIndex = resource.substring(resource.indexOf("/")+1);
                String template = withoutIndex.substring(0, withoutIndex.indexOf(Defaults.JsonFileExtension));
                logger.trace(" - found [{}].", template);
                templateNames.add(template);
            }
        }

        return templateNames;
    }
public static List < String > findTemplates ( String root ) throws IOException , URISyntaxException { if ( root == null ) { return findTemplates ( ) ; } logger . debug ( "Looking for templates in classpath under [{}]." , root ) ; final List < String > templateNames = new ArrayList < > ( ) ; String [ ] resources = ResourceList . getResources ( root + "/" + Defaults . TemplateDir + "/" ) ; for ( String resource : resources ) { if ( ! resource . isEmpty ( ) ) { String withoutIndex = resource . substring ( resource . indexOf ( "/" ) + 1 ) ; String template = withoutIndex . substring ( 0 , withoutIndex . indexOf ( Defaults . JsonFileExtension ) ) ; logger . trace ( " - found [{}]." , template ) ; templateNames . add ( template ) ; } } return templateNames ; }
Find all templates
@param root dir within the classpath
@return a list of templates
@throws IOException if connection with elasticsearch is failing
@throws URISyntaxException this should not happen