question: private void handleFile ( File file , UriDeploymentScannerContext ctx ) { boolean changed ; Long lastMod ; if ( file . isDirectory ( ) ) { GridTuple < Long > dirLastModified = F . t ( file . lastModified ( ) ) ; changed = checkGarDirectoryChanged ( file , dirLastModified ) ; lastMod = dirLastModified . get ( ) ; } else { lastMod = tstampCache . get ( file ) ; changed = lastMod == null || lastMod != file . lastModified ( ) ; lastMod = file . lastModified ( ) ; } if ( changed ) { tstampCache . put ( file , lastMod ) ; if ( ctx . getLogger ( ) . isDebugEnabled ( ) ) ctx . getLogger ( ) . debug ( "Discovered deployment file or directory: " + file ) ; String fileName = file . getName ( ) ; try { File cpFile = ctx . createTempFile ( fileName , ctx . getDeployDirectory ( ) ) ; cpFile . deleteOnExit ( ) ; if ( file . isDirectory ( ) ) { cpFile = new File ( cpFile . getParent ( ) , "dir_" + cpFile . getName ( ) ) ; cpFile . deleteOnExit ( ) ; } U . copy ( file , cpFile , true ) ; String fileUri = getFileUri ( file . getAbsolutePath ( ) ) ; assert lastMod != null ; ctx . getListener ( ) . onNewOrUpdatedFile ( cpFile , fileUri , lastMod ) ; } catch ( IOException e ) { U . error ( ctx . getLogger ( ) , "Error saving file: " + fileName , e ) ; } } }
target:  Tests whether given directory or file was changed since last check and if so copies all directory sub-folders and files or file itself to the deployment directory and than notifies listener about new or updated files.