Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Implementation question

 
Matt Ghiold
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys,
Just a quick question, I will be posting my design up here shortly, but I have one question that's bugging me as to how to do something regarding locking.
I am going with an MVC design pattern overall, and in my backend I am going to have a DataInterface which will be used with the local or the remote data class.
Now, it's been fairly well established that the local client has no need for locking/unlocking as it lives in a single threaded enviroment.
I know I am going to build a lock manager class, which implements lock and unlock, but my question is this.
I want to have my RemoteData class extend UnicastRemoteObject etc for RMI, now that being said my LockManager class would have to live in the RemoteDataClass (perhaps an inner class) I think and place the appropriate method calls inside any write methods, can anyone else think of a better way to do this or do you guys think I going down the correct road.
Thanks,
[ May 14, 2002: Message edited by: Matt Ghiold ]
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should be fine if you deal with only one table like the current status of this assignment. I had the LockManager as a seperate class which is also a Singleton.
You can argue that only the RemoteData instance is ever going to use the LockManager and there is nothing wrong in having such a tight coupling between them. But you need to design the RemoteData class so that it is generic and can be used against any future tables. So a better choice would be to create a seperate LockManager class in a seperate file.
[ May 14, 2002: Message edited by: Sai Prasad ]
 
Matt Ghiold
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I created a seperate lock manager in seperate class which would be fine, would I then incorporate a data class inside my lock manager or leave them seperate and make calls from my RemoteData class using my LockManager class
Thoughts?
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One way is to let the LockManager manages the intance of the Data class which gets passed by the RemoteData instance. That way the LockManager can be used to manage any Data instance(Assuming that this application has to work against more tables in the future). RemoteData instance can get the Data instance using a DataFactory which is a Singleton.
RemoteData(uses DataFactory) -> LockManager -> Data
 
Matt Ghiold
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sai,
Thanks for all the responses, my only problem with what you last proposed is it would break my RMI implementation. Because, I want to use my data object via rmi ( which would allow the same client to be used locally or remotely ), I need to use an instance of the DataInterface for my RMI. If I place LockManager in front of that I would need to have 2 gui's one for remote and one for local.
Thoughts?
-Matt
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
LockManager is available only for the RMI Server. Since there is no need to manage access to lock/unlock/modify/delete methods during the local mode at the client side, you use the same DataFactory to get the Data instance. Your facade or controller at the client side need not communicate with the LockManager.
Also I would put the DataFactory in the db package.
[ May 14, 2002: Message edited by: Sai Prasad ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic