public static List < String > findIndexNames ( final String root ) throws IOException , URISyntaxException { if ( root == null ) { return findIndexNames ( ) ; } logger . debug ( "Looking for indices in classpath under [{}]." , root ) ; final List < String > indexNames = new ArrayList <> ( ) ; final Set < String > keys = new HashSet <> ( ) ; String [ ] resources = ResourceList . getResources ( root + "/" ) ; // "es/" or "a/b/c/" for ( String resource : resources ) { if ( ! resource . isEmpty ( ) ) { logger . trace ( " - resource [{}]." , resource ) ; String key ; if ( resource . contains ( "/" ) ) { key = resource . substring ( 0 , resource . indexOf ( "/" ) ) ; } else { key = resource ; } if ( ! key . equals ( Defaults . TemplateDir ) && ! keys . contains ( key ) ) { logger . trace ( " - found [{}]." , key ) ; keys . add ( key ) ; indexNames . add ( key ) ; } } } return indexNames ; }
Find all indices existing in a given classpath dir