• Post Reply Bookmark Topic Watch Topic
  • New Topic

Please review my new Data Access design  RSS feed

Eric Kim
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is my new Design and I use wrote a test case to prove it works. But it seems too complicated:
1. Create DB interface as SUN provided
2. Data class implements DB interface, implement everything required to handle database file in this class. (Of course it will have FieldInfo and DataInfo inner clases)
3. Implement LockManager class which hold an HashMap of record locked and keep track of client who locks record, do unlocking etc. lock() and unlock() in Data class will use LockManager to do that.
4. Create DBRemote interface which has the same methods as DB interface, except it extends Remote and throws RemoteException.
5. Create DBRemoteAdapter class which implements DBRemote interface and adaptes Data class.
6. Create DBRemoteServer class which is the RMI remote server, it binds DBRemoteAdapters object to RMI Registry.
7. Create Database interface which has all methods UI needs, throws Exception for each methods.
8. Create LocalAdapter class which adaptes Data class.
9. Create RemoteAdapter class which adaptes DBRemoteAdapter class.
10. Create DatabaseFactory class which only has one static method:
public Database void getDatabase( int nMode )
and either return an instance of LocalAdapter or an instance of RemoteAdapter.
11. Client UI can use Database to do whatever he wants to do.
It has 3 interfaces and 7 classes, which seems very complex, but each one serves its purpose. 7, 8, 9, 10 are created so that client can have a transparent Data Access object.
Can someone please review this design and share your thoughts. Again I have created a sample program to prove this thing actually does work, but I am not sure whether this is too complicated and fit the assignment requirements. (One of the requirement is simple implementation of course).
Thanks in advanced!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!