private void parseFilesInDirectory ( File currentDirectory , Vector < GlobusResource > pathsMatchingLocationPattern ) { File [ ] directoryContents = null ; if ( currentDirectory . isDirectory ( ) ) { directoryContents = currentDirectory . listFiles ( ) ; //Get a list of the files and directories } else { directoryContents = new File [ 1 ] ; directoryContents [ 0 ] = currentDirectory ; } String absolutePath = null ; Matcher locationPatternMatcher = null ; if ( directoryContents != null ) { for ( File currentFile : directoryContents ) { if ( currentFile . isFile ( ) ) { //We are only interested in files not directories absolutePath = currentFile . getAbsolutePath ( ) ; locationPatternMatcher = locationPattern . matcher ( absolutePath ) ; if ( locationPatternMatcher . find ( ) ) { pathsMatchingLocationPattern . add ( new GlobusResource ( absolutePath ) ) ; } } } } }
Compares every file s Absolute Path against the locationPattern if they match a GlobusResource is created with the file s Absolute Path and added to pathsMatchingLocationPattern .