public void process ( JawrWatchEvent evt ) { Path resolvedPath = evt . getResolvedPath ( ) ; List < PathMapping > mappings = watcher . getPathToResourceBundle ( ) . get ( evt . getDirPath ( ) ) ; if ( mappings != null ) { boolean isDir = Files . isDirectory ( resolvedPath , NOFOLLOW_LINKS ) ; List < JoinableResourceBundle > bundles = new ArrayList <> ( ) ; List < PathMapping > recursivePathMappings = new ArrayList <> ( ) ; for ( PathMapping mapping : mappings ) { String filePath = resolvedPath . toFile ( ) . getAbsolutePath ( ) ; if ( mapping . isAsset ( ) ) { String fileName = FileNameUtils . getName ( filePath ) ; if ( fileName . equals ( FileNameUtils . getName ( mapping . getPath ( ) ) ) ) { bundles . add ( mapping . getBundle ( ) ) ; } } else { if ( isDir ) { if ( mapping . isRecursive ( ) && ( ! mapping . hasFileFilter ( ) || mapping . accept ( filePath ) ) ) { bundles . add ( mapping . getBundle ( ) ) ; } } else if ( ! mapping . hasFileFilter ( ) || mapping . accept ( filePath ) ) { bundles . add ( mapping . getBundle ( ) ) ; } if ( mapping . isRecursive ( ) ) { recursivePathMappings . add ( mapping ) ; } } } if ( ! bundles . isEmpty ( ) ) { bundlesHandler . notifyModification ( bundles ) ; } if ( ! recursivePathMappings . isEmpty ( ) ) { // if directory is created, and watching // recursively, // then // register it and its sub-directories if ( evt . getKind ( ) == ENTRY_CREATE && isDir ) { try { watcher . registerAll ( resolvedPath , recursivePathMappings ) ; } catch ( IOException e ) { if ( LOGGER . isWarnEnabled ( ) ) { LOGGER . warn ( e . getMessage ( ) ) ; } } } } } lastProcessTime . set ( Calendar . getInstance ( ) . getTimeInMillis ( ) ) ; }
Process the event