• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Client-side DataServerFactory

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. Initially I was using the Factory pattern to create the appropriate DataServer<interface> implementation... Remote or Local, depending on the connection preferences of the user. These 2 implementations wrap the remote RMI Data reference, or the local Data respectively. I have also read many posts regarding this solution to the client side connection.
I have abstracted most of the functionality for these 2 implementations into an Abstract class. In fact, the only code that ends up in the 2 subclasses is the constructor, which intializes the appropriate Data member (either to the remote reference or the local Data).
My concern is that it seems a bit overboard for me to have these 2 subclasses when all they do is have a constructor, while I could simply add 2 constructors to the abstract class and change it to be concrete.
Any ideas or comments?
Thanks,
 
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In your Factory at the client, instead of creating the implementation of DataServer for local or remote, create/find the instance of the Data (local/remote) and pass the Data instance to the only constructor in DataServer implementation class. I would also name the client side DataServer implementation as DataProxy.
Client Facade -> ClientDataFactory(creates or finds the Data instance) -> DataProxy (holds a reference to Data) ->Data
[ May 20, 2002: Message edited by: Sai Prasad ]
 
Aaron Dressin
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ahhh. Thanks for the direction! Funny... I originally had the factory focused on the Data rather than the "server/proxy"... but I lost that focus somewhere.
Cheers!
 
Aaron Dressin
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ahhh. Thanks for the direction! Funny... I originally had the factory focused on the Data rather than the "server/proxy"... but I lost that focus somewhere.
Cheers!
 
What's wrong? Where are you going? Stop! Read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic