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 ; }
Find all templates