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

Data Client Constructors

 
lev grevnin
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all.
Peter and everyone else who helped me out on the "interfaces and exceptions" thread - THANKS A LOT!
Now, it's just a clarification question. The assignment states: To connect with your server, you should create a client program. This implementation should include a class that implements the same public methods as the suncertify.db.Data class, although it will need different constructors to allow it to support the network configuration.
What do they mean by "different network configuration"? That this class can have one constructor to instantiate it for local use and the other to instantiate it for networked use? Is that what they mean by "netwok configuration" - local and network modes??
thanks...
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you've got it correctly. One constructor for pointing a local database file and another for specifying hostname+port+dbname.
 
Brian Blignaut
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
For creating connections to my database I used a simple factory. i.e A ConnectionFactory class Connection interface which defines all the public methods of data, and a LocalConnection class and a RemoteConnection class which both implement Connection and do as you would expect. My connection factory has two methods, one for creating a local connection and one for creating a remote connection.
Is this incorrect? Does this not qualify as a DataClient?
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is not at all how I interpreted the requirement.
I don't think you need to have an object with two different constructors, one constructor for local and one for remote operation. My understanding is merely that you will have some client-side "Data-like object" in networked mode. (I suspect that Sun included this requirement to force your architecture into a certain direction; there have been a number of posts about this). This object will have constructors that are different from those of Data for the simple reason that the networked mode works completely differently.
My understanding is also that there is a requirement for this object to exist. That doesn't mean you have to write that class yourself; an rmic-generated class can well satisfy the requirement. I personally used RMI in my project, and had a server-side Remote class implementing the Data interface. The rmic-generated stub for this class satisfies the requirement quoted above in every respect.
The assessor seemed happy enough with it.
- Peter
[ February 05, 2003: Message edited by: Peter den Haan ]
 
Brian Blignaut
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for you reply Peter. That was the last thing I was unsure of.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic