File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Final design

 
Ramesh kumaar
Ranch Hand
Posts: 146
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,

Finally i have comeup with my design and also implemented. Kindly please go through and give my ur valid feed back.
Server Design
-------------
* I have an Interface DataInterface which has all the public methods of Data class, Here all the methods throw RemoteException along with the other exception it throws.
* I have a RemoteDataInterface which just extend DataInterface,Remote interface.
* For LocalData access i have a class DataAccess which implements DataInterface and instantiate Data class.
* For performing locking and unlocking I have a class LockMgr which extends Data class and override lock() and unlock(), this class I implement singleton pattern. Here i dont handle clientID.
* For RemoteData access I have a class named RemoteDataAccess which extends UnicastRemoteObject and implements RemoteDataInterface, Here i have a instance of LockMgr, which i use for all database releated operation including locking and unlocking.

* In case of criteriaFind i just modified the Data class
* Finally i have GUI class, which is used to start and stop the server. This also bind the rmi server with the registry.

Client Design
-------------
Iam following the MVC archicture
*FBNMainGUI is the views class which has all the GUI components related to viewing and quering.
*I have a class FBNController which handles all the events that are generated by the views class. Here my controller implements ActionListener.

*I have a facade class which acts as model, invoked by the FBNController calls the connectionFactory and get the appropriate data class.
Here in the above design when ever any request made through the FBNMainGUI, is recived by controller and processed by FBNFacade and Controller recive the result back and this again update the GUI.
Here inorder to decouple the view and controller i use hook methods concept which was adviced by MARK
i also follow commandpattern in even handling.


Thanks & regards,
-rameshkumar
-rameshkumar
 
Ramesh kumaar
Ranch Hand
Posts: 146
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,
Please spend some time on the above design and give me ur valid feedback.
thanks & Regards,
rameshkumar
 
Andreas Reuss
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Ramesh kumaar,
Im also just about to finish the work. I only have 2 questions:
1. Couldn't you just access local via RemoteDataAccess?
2. You implements Singleton pattern on LockMgr. Have you reallized that you can now only have 1 table in the "database"? If you need a new table "customers" in a future version, you have to redesign the "database".
Greetings and good luck
Andreas Reuss
 
Allen Chan
Ranch Hand
Posts: 64
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Andreas,
So how do you handle the Q2?
 
Sri Addanki
Ranch Hand
Posts: 195
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"I have an Interface DataInterface which has all the public methods of Data class, Here all the methods throw RemoteException along with the other exception it throws."
"For LocalData access i have a class DataAccess which implements DataInterface and instantiate Data class."
Why is DataInterface throwing Remote Exceptions?
Don't u think its supposed to throw more general exceptions?
Because when in local mode u shouldn't even throw Remote Exceptions.
 
Ramesh kumaar
Ranch Hand
Posts: 146
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai Sri,

Thanks for ur reply. See in my local implementation i will throw the generic exception only and incase of remote implementation i will throw both remote and genericExceptions. I think now u may be clear.
-rameshkumar
 
Ramesh kumaar
Ranch Hand
Posts: 146
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Andreas,
Thanks for ur reply. As there should be only one instance of the Data class at any point. I made the DataAccess class(used for LockDataAccess) and LockMgr(used for remote DataAccess) as singleton. Guide me if iam wrong
-rameshkumar
 
calvin zhu
Ranch Hand
Posts: 54
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Ramesh.
If u search the whole forum using "singleton Peter", I'm sure u can find lots of articles talking about the shortcoming of using this pattern and the other way to achieve the same result.
BTW, Peter is the guru's name who strongly against using "singleton".
 
Sri Addanki
Ranch Hand
Posts: 195
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i didn't quite understand what u meant when u said:
"....I have an Interface DataInterface which has all the public methods of Data class, Here all the methods throw RemoteException along with the other exception it throws."
does this mean that your method declarations, in DataInterface are something like this:
public FieldInfo [] getFieldInfo() throws Exception, RemoteException, DatabaseException;
And local implementation its like this:
public FieldInfo [] getFieldInfo() throws Exception, DatabaseException;
And in case of remote implementation its like this:
public FieldInfo [] getFieldInfo() throws RemoteException, DatabaseException;
thnaks
 
Ramesh kumaar
Ranch Hand
Posts: 146
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sri,
Thanks, Yes ur correct i did the same way u explained.
-rameshkumar
 
Ramesh kumaar
Ranch Hand
Posts: 146
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Calvin,
Thanks, I too agree what u said thinking to remove singleton.
regards,
rameshkumar
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic