List < MwDumpFile > findDumpsLocally ( DumpContentType dumpContentType ) { String directoryPattern = WmfDumpFile . getDumpFileDirectoryName ( dumpContentType , "*" ) ; List < String > dumpFileDirectories ; try { dumpFileDirectories = this . dumpfileDirectoryManager . getSubdirectories ( directoryPattern ) ; } catch ( IOException e ) { logger . error ( "Unable to access dump directory: " + e . toString ( ) ) ; return Collections . emptyList ( ) ; } List < MwDumpFile > result = new ArrayList <> ( ) ; for ( String directory : dumpFileDirectories ) { String dateStamp = WmfDumpFile . getDateStampFromDumpFileDirectoryName ( dumpContentType , directory ) ; if ( dateStamp . matches ( WmfDumpFileManager . DATE_STAMP_PATTERN ) ) { WmfLocalDumpFile dumpFile = new WmfLocalDumpFile ( dateStamp , this . projectName , dumpfileDirectoryManager , dumpContentType ) ; if ( dumpFile . isAvailable ( ) ) { result . add ( dumpFile ) ; } else { logger . error ( "Incomplete local dump file data. Maybe delete " + dumpFile . getDumpfileDirectory ( ) + " to attempt fresh download." ) ; } } // else: silently ignore directories that don't match } result . sort ( Collections . reverseOrder ( new MwDumpFile . DateComparator ( ) ) ) ; logger . info ( "Found " + result . size ( ) + " local dumps of type " + dumpContentType + ": " + result ) ; return result ; }
Finds out which dump files of the given type have been downloaded already . The result is a list of objects that describe the available dump files in descending order by their date . Not all of the dumps included might be actually available .