Child pages
  • FileWatcher implementation contract
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

This describes protocol for command line tool to be used to notify IDEA on filesystem changes.

1. Discovery
Regardless of the platform, IDEA will try to execute binary named 'fsnotifier' in 'bin' folder of its distribution. Whatefer executable found
under that name must comply to the following protocol:

2. Protocol
All the communication is being performed using standard input (for commands from IDEA to notifier) and standard output (for command reponds and notification output).

Commands:

ROOTS: Advisory command, which lists all the paths, where changes are expected to be reported, recursively.
If the path is prefixed with '|' symbol, this path is only required to be monitored flat. No recursive watching is required.
Format is as follows: ROOTS keyword, followed by list of paths, followed by # sign, each on separate line

ROOTS
<path1>
...
<pathN>
#

EXIT: Request for the notifier to shutdown itself

Results/Response:

Notification results all have similar format as <keyword>, followed by newline, followed by path, followed by one more newline.
Keywords can be:
CREATE - issued to report new file or folder created
DELETE - issued to report file or folder deleted
STATS - flags (like R/O attribute) changed
CHANGE - Content of the file changed
DIRTY - something changed at the path. For directories, files added or deleted, or contents of the files in directory may have been changed
RECDIRTY - something changed at the path, recursively
RESET - everything changed. Complete manual rescan is required.

Sample:

CHANGE
/Users/max/Depot/Trunk/docs/FileWatcherProtcol.txt

Note that notifier doesn't have report all the commands that apply to certain change. Just use what's easier to implement. For instance, it's totally
OK to use just DIRTY and RECDIRTY instead of reporting detailed create/delete/change/stats.

Certain parts of the local file system may not have notification capabilities. Those paths must be reported using UNWATCHEABLE command like

UNWATCHEABLE
N:
W:\DIR
/Volumes/MountedNetworkDrive
#

This may be issued as response to ROOTS command, or at any time notifier has an update on the list of unwatcheable roots. The list must be at least
complete with regards to the roots passed by ROOTS command.

At any time in the communication notifier has the right to give up on providing adequate results and inform subscriber by issuing GIVEUP command.
This command shall normally be used if the platform is unsupported by notifier, like MacOS prior to Leopard.

  • No labels