My Data class is a facade to a LockHandler for all locking and a FileHandler for all database operations.
I have a DataService class as an adapter to the Data class. This implements another interface, Database and it is this that exposes methods to the client (all locking is on the server). It is also a singleton so that the Data class can be extended in the future.
My local mode is working through the DataService and thus my local mode uses locking as well as the networked mode at the moment.
I can't think of a way round this just now other than having another class, say, LocalDataService to implement the Database interface as well but which creates an instance of FileHandler and not the Data class so that no locking is employed. So, local mode would create a LocalDataService with no locking and networked mode would create a DataService (Rename this to RemoteDataService) with locking.
I'm not so sure about this approach. Would you please advise your thoughts on this.
Alison [ August 17, 2007: Message edited by: Al McG ]
I think you're overcomplicating. Sure, locking and unlocking has its costs in terms of performance, so it might be an idea to bypass it when not needed, but there is no requirement on performance in the assignment. So I wouldn't bother; it can only costs you points but you will gain none. I've seen people pass with 400 points who didn't bother about this.
On your way in you may have missed that we have a JavaRanch Naming Policy for displayed (screen) names. Your displayed name must consist of a first name (or an initial), a space, and a family name (in that order) and not be obviously fictitious. Since yours "Al McG", does not conform with it, please take a moment to change it, which you can do right here.
Posters with nonconforming displayed names will be locked out of JavaRanch after a few posts using those names.