This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Final design Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Final design" Watch "Final design" New topic
Author

Final design

Ramesh kumaar
Ranch Hand

Joined: Mar 19, 2002
Posts: 146
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

Joined: Mar 19, 2002
Posts: 146
Dear All,
Please spend some time on the above design and give me ur valid feedback.
thanks & Regards,
rameshkumar
Andreas Reuss
Greenhorn

Joined: Oct 08, 2002
Posts: 3
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

Joined: Jun 07, 2002
Posts: 64
Dear Andreas,
So how do you handle the Q2?
Sri Addanki
Ranch Hand

Joined: Apr 27, 2001
Posts: 195
"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

Joined: Mar 19, 2002
Posts: 146
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

Joined: Mar 19, 2002
Posts: 146
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

Joined: Mar 18, 2002
Posts: 54
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".


SCEA, SCJD, SCWCD, SCBCD, SCJP<br />IBM WebSphere Portal certification
Sri Addanki
Ranch Hand

Joined: Apr 27, 2001
Posts: 195
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

Joined: Mar 19, 2002
Posts: 146
Hi Sri,
Thanks, Yes ur correct i did the same way u explained.
-rameshkumar
Ramesh kumaar
Ranch Hand

Joined: Mar 19, 2002
Posts: 146
Hi Calvin,
Thanks, I too agree what u said thinking to remove singleton.
regards,
rameshkumar
 
Don't get me started about those stupid light bulbs.
 
subject: Final design
 
Similar Threads
Please comment on FBN design
Comments please
Basic Design
Server Design Issue
Atlast i have come with some design. (critics are invited)