friends, I use factory pattern (RMI) to obtain a wrapper of Data class in remote mode. I bind ConnectionFactory to registry which implements ConnectionInterface. it's getConnection() returns RemoteDataAccess object. (RemoteDataAccess implements DataInterface which contains all public methods of Data.) I have implemented locking thru LockManager... my connection object has an instance of LockManager. RemoteDataAccess calls lock( recno) of LockManager. Should my remote client have DataInterface, ConnectionInterface and LockManager classes stored in it? excuse me. I am new to RMI.
Hi Nagu, Not being totally aware of you design, I can't make a complete judgement here but generally speaking, the less the client knows about the server or connection, the better. You should use a Facade pattern to separate the the two subsystems on the client: GUI and database. Now your Facade class will obviously have to have a reference to your DataAccess implementation. Assuming that your RemoteDataAccess extends DataAccess you should still only access through the parent interface (DataAccess) if that is possible. Hopefully, you have designed your db package so that there is no need for the Facade to have a reference to the LockManager. You should just be able to call lock and unlock on your interface. I only had one interface for both remote and local. My client was oblivious to whether it was in local or remote mode. Locking in local mode was just a no-op. Hope this helps, Michael Morris
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher