Started injecting a file observer factory into the model, that allows us
to know when to re-scan directories and/or when to re-process files.
This is done in a way that is both immediate and fully reliable when the
model is under test, yet more performant (by accepting there may be a
delay between updating a file, and having the change noticed by the
model) when run as an app.
Updated the model engine utilities UML diagram before attempting to
refactor it to start making use of the FileObserverFactory.
Moved some file utility methods that are no longer used in 'brjs-core',
out into 'cutlass-common', where they are still used.
Introduced the concept of file and directory iterators, so that
end-developers don't need to work directly with the FileObserverFactory
class, and so that a single directory iterator can be shared by multiple
objects, in a way that was not possible with the DirectoryObserver
interface.
Preparatory changes so that the model engine utility classes now have
access to RootNode so they can start accessing the directory iterators.
Bug fixes for problems discovered while trying to use the new file
watching code.
Created a BRJS.close() method so that we can clean up file watcher
resources after they have been used.
Switching over to the directory iterator for all model node discovery.
Created a UML of the new file change utility classes before attempting
to refactor to account for the 128 max watch service instance
restriction on Linux, plus fixed up some of the class and method names
in the process.
Start to refactor code based on the new requirement to create only a
single WatchService per model instance, so as not to exhaust the 128
watch-service limit on Linux -- at present though, the code won't work
if more classes begin to use the same watch service
Node tests now pass as we now provide a non-null root node
implementation, which is now necessary.
Updates to the file-change UML diagram.
Checking in my current performance test, in case anybody else finds it
useful while we are improving performance.
Terminate the app deployment watching thread when we stop the
application server, as otherwise we will try and use a watch-service
that has now been closed.
Fixed a bug that meant the DirectoryIterator.reset() invocation within
AbstractNode.create() only worked for some node types.
commented out BRJS.close() invocation from CommandRunner, since it
doesn't currently work when used with long running commands like
'serve'.
Switched code over from absolute paths to canonical paths for caching
on, since this also works with symbolic links.
Stop having separate concepts of FileIterator and DirectoryIterator
classes, and just have a single FileIterator that can return all files,
all directories or a filtered list of files -- this allows us to cache
all file lists even though we still support file filtering.
We now use the file iterator to ensure that the creation of file objects
by the plug-ins doesn't cause any unnecessary disk I/O.
All use of listFiles() has now been replaced with file iterators that
cache the results.