Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

posting again...pl help

 
Nagu Rathina
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic