Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what do we need to fetch from remote server?

 
Holmes Wong
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Ranchers:
From my understanding, a data object is the only thing we need to fetch from the remote server, is it right? Since table model will store the fetched data, BookFlights and other service functions can be done on-the-fly on the client side right?
I have trouble to separate local mode from remote
mode, the code will be very messy if I do if/else
in my client. Any suggestions welcome and appreciated.
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on your design. In my case, I retuned the instance of a class which implements the remote interface from the server. This interface has the same methods contained in the Data class.
Use a Factory class to hide you the details in getting the instance of local or remote Data instance.
 
Holmes Wong
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Sai.
Here is my design:
I use a DataAccessFactory to get local or remote instances (return an interface to hide details) of my data access. Since I have all public methods for local or remote data (lock/unlock on
server-side), I do not need to differentiate these
methods (since they are the same) after I get the access instance. That is, on client-side, I only have to get this instance, then manipulate its methods without caring about if they are local or remote methods. I am using RMI, am I understanding this right?

Originally posted by Sai Prasad:
It depends on your design. In my case, I retuned the instance of a class which implements the remote interface from the server. This interface has the same methods contained in the Data class.
Use a Factory class to hide you the details in getting the instance of local or remote Data instance.
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your understanding is correct. In addition to the Factory, I had a proxy class that implements the remote interface at the client. This proxy satisfies the requirement "a client class should have all the public methods defined in the Data".
The proxy class contains the instance of the remote or local Data. The client talks only to the proxy instance that in turn communicates with the Data instance.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic