private Set < String > getResourcesToScan ( ) { final String classPath = System . getProperty ( "java.class.path" ) ; final Set < String > modules = new TreeSet <> ( ) ; final Pattern pattern = Pattern . compile ( ".*(structr).*(war|jar)" ) ; final Matcher matcher = pattern . matcher ( "" ) ; for ( final String jarPath : classPath . split ( "[" . concat ( pathSep ) . concat ( "]+" ) ) ) { final String lowerPath = jarPath . toLowerCase ( ) ; if ( lowerPath . endsWith ( classesDir ) || lowerPath . endsWith ( testClassesDir ) ) { modules . add ( jarPath ) ; } else { final String moduleName = lowerPath . substring ( lowerPath . lastIndexOf ( pathSep ) + 1 ) ; matcher . reset ( moduleName ) ; if ( matcher . matches ( ) ) { modules . add ( jarPath ) ; } } } for ( final String resource : Services . getInstance ( ) . getResources ( ) ) { final String lowerResource = resource . toLowerCase ( ) ; if ( lowerResource . endsWith ( ".jar" ) || lowerResource . endsWith ( ".war" ) ) { modules . add ( resource ) ; } } return modules ; }
Scans the class path and returns a Set containing all structr modules .