I've put all access to files behind a new interface called AppFile. At the moment that just returns instances of TomcatFile, which is now the sole implementation of AppFile. But I foresee a time when we, or a user, might want to run the RIF on another platform, or as a standalone app. If and when that time comes, this change will make it easier to adapt to the new environment.
A Single Place for Changes
This change also means that we only have to change one place if application paths change, or other possibilities become available.
File Locking
As well as that I've gone through all the places where files are used and made sure that Readers are closed, and so on.
There are a number of places where we pass a File object into a library function, so we have to rely on that library being well behaved and closing its resources, but that's just business as usual.
Improving the File Handling
Future Proofing
I've put all access to files behind a new interface called
AppFile
. At the moment that just returns instances ofTomcatFile
, which is now the sole implementation ofAppFile
. But I foresee a time when we, or a user, might want to run the RIF on another platform, or as a standalone app. If and when that time comes, this change will make it easier to adapt to the new environment.A Single Place for Changes
This change also means that we only have to change one place if application paths change, or other possibilities become available.
File Locking
As well as that I've gone through all the places where files are used and made sure that
Reader
s are closed, and so on.There are a number of places where we pass a
File
object into a library function, so we have to rely on that library being well behaved and closing its resources, but that's just business as usual.So this should fix #108.