• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Comments on design please !!!

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Krishna Varma Adluru
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
It's a pleasure to see superheros taking such an interest in science. And this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic