public boolean sourceIsReady ( ) { // make a note of our source's last modification time _sourceLastMod = _source . lastModified ( ) ; // if we are unpacking files, the time to do so is now if ( _unpacked != null && _unpacked . lastModified ( ) != _sourceLastMod ) { try { resolveJarFile ( ) ; } catch ( IOException ioe ) { log . warning ( "Failure resolving jar file" , "source" , _source , ioe ) ; wipeBundle ( true ) ; return false ; } log . info ( "Unpacking into " + _cache + "..." ) ; if ( ! _cache . exists ( ) ) { if ( ! _cache . mkdir ( ) ) { log . warning ( "Failed to create bundle cache directory" , "dir" , _cache ) ; closeJar ( ) ; // we are hopelessly fucked return false ; } } else { FileUtil . recursiveClean ( _cache ) ; } // unpack the jar file (this will close the jar when it's done) if ( ! FileUtil . unpackJar ( _jarSource , _cache ) ) { // if something went awry, delete everything in the hopes // that next time things will work wipeBundle ( true ) ; return false ; } // if everything unpacked smoothly, create our unpack stamp try { _unpacked . createNewFile ( ) ; if ( ! _unpacked . setLastModified ( _sourceLastMod ) ) { log . warning ( "Failed to set last mod on stamp file" , "file" , _unpacked ) ; } } catch ( IOException ioe ) { log . warning ( "Failure creating stamp file" , "file" , _unpacked , ioe ) ; // no need to stick a fork in things at this point } } return true ; }
Called by the resource manager once it has ensured that our resource jar file is up to date and ready for reading .