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
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.
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
posted
0
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 ?
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.