private void check()

in commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileMonitor.java [114:163]


        private void check() {
            this.refresh();

            try {
                // If the file existed and now doesn't
                if (this.exists && !this.fileObject.exists()) {
                    this.exists = this.fileObject.exists();
                    this.timestamp = -1;

                    // Fire delete event

                    ((AbstractFileSystem) this.fileObject.getFileSystem()).fireFileDeleted(this.fileObject);

                    // Remove listener in case file is re-created. Don't want to fire twice.
                    if (this.defaultFileMonitor.getFileListener() != null) {
                        this.fileObject.getFileSystem().removeListener(this.fileObject, this.defaultFileMonitor.getFileListener());
                    }

                    // Remove from map
                    this.defaultFileMonitor.queueRemoveFile(this.fileObject);
                } else if (this.exists && this.fileObject.exists()) {

                    // Check the timestamp to see if it has been modified
                    if (this.timestamp != this.fileObject.getContent().getLastModifiedTime()) {
                        this.timestamp = this.fileObject.getContent().getLastModifiedTime();
                        // Fire change event

                        // Don't fire if it's a folder because new file children
                        // and deleted files in a folder have their own event triggered.
                        if (!this.fileObject.getType().hasChildren()) {
                            ((AbstractFileSystem) this.fileObject.getFileSystem()).fireFileChanged(this.fileObject);
                        }
                    }

                } else if (!this.exists && this.fileObject.exists()) {
                    this.exists = this.fileObject.exists();
                    this.timestamp = this.fileObject.getContent().getLastModifiedTime();
                    // Don't fire if it's a folder because new file children
                    // and deleted files in a folder have their own event triggered.
                    if (!this.fileObject.getType().hasChildren()) {
                        ((AbstractFileSystem) this.fileObject.getFileSystem()).fireFileCreated(this.fileObject);
                    }
                }

                this.checkForNewChildren();

            } catch (final FileSystemException fse) {
                LOG.error(fse.getLocalizedMessage(), fse);
            }
        }