File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Comments on design please !!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Comments on design please !!!" Watch "Comments on design please !!!" New topic
Author

Comments on design please !!!

Krishna Varma Adluru
Ranch Hand

Joined: Nov 24, 2001
Posts: 55
Hi Ranchers,
Can you guys please give some valuable input to my design ?
Here is how my high level design is for FBN project:
1. I have an interface, called DataAdapter that has all the methods of Data class and
also this interface extends Remote. All the methods in this interface throw RemoteException
in addition to the original exceptions thrown in the Data Class

2. For Remote case: I have a class called RemoteDataAdapter which extends UnicastRemoteObject and implements DataAdapter. This class adapts the "Data Class"(adaptee) for "Remoteness" needed for RMI calls, so that we do not need to change anything in the Data class.
3. For local mode, I have a class called LocalDataAdapter. This class will internally use Data class instance and will delegate all the calls to it. Methods in this class does not
throw RemoteExceptions.
4. Using the above architecture, my client side component will make a call like
(new DataAdapterFactory()).getDataAdapter(choice)
which will return DataAdapter reference which will point to Local or RMI implementation depending on the argument "choice" passed to it.
But the client does not need to worry about it.
Any comments on the above design would be highly appreciated.
If you have any questions, please let me know.
Thank You in advance,
Regards,
Krishna Varma Adluru
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Krishna your design is very nice. Here is where I would point you to add to it, and instead of your RemoteDataAdapter extending Unicast and being bound into RMI, I would bind a ConnectionFactory, and get a connection object which is your RemoteDataAdapter, This will guarantee each user to get their own version of this Adapter, and hence more control on locking, which is the "Client ID"
Mark
Look for posts in this forum on Connections, you will find many of them, which will fill in the rest of the details for ya.


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Krishna Varma Adluru
Ranch Hand

Joined: Nov 24, 2001
Posts: 55
Mark,
Thank You very much for your comments ..!!!
I will search on Connections and modify the design
accordingly ...
ThankYou again,
Regards,
Krishna Varma
Krishna Varma Adluru
Ranch Hand

Joined: Nov 24, 2001
Posts: 55
Hi Mark,
I have read several posts on Connections and still could not understand
1)"why does each User need their own version of RemoteDataAdapter" ..?
Also, I have another question regarding my above design :
2) Is it Okay for my "LocalDataAdapter" class to implement "DataAdapter" interface
which extends Remote ?. I did this only to provide one common interface for
both Local and Remote. But, the methods in LocalDataAdapter does not throw RemoteExceptions ..!!!
Any suggestions or Comments please ?

Thank You,
Regards,
Krishna Varma Adluru
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

1) Because that serves as the "Client ID" everyone keeps searching for.
Because each client has it's own Remote Object, you can now track all the locks that that one client has, and then the LockManager can have all the locks and keep track of who has what, if need be.

2) It is ok that your LocalDataAdapter implements DataAdapter interface. ave the interface just throw Exception, then in your Remote Implementation you will have them throw the more specific RemoteException, and probably some DatabaseExceptions.

Mark
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Comments on design please !!!
 
Similar Threads
Questions on Design
Remote interface, NetworkedServer and NonNetworkedServer
how do I return a DBAccess interface back to client?
NX:URLyBird1.3.2, Please comments on the Locking. Thanks!!
Stand alone criteria [B&S]