My assignment specifies: "The user interface should connect to the database using either a local or a network based connection according to user choice". Can I accept a command line parameter for this? Does that cover the requirement? What do the certified ones think? Thanks!
You can only accept the command line parameters that sun sets in the instructions. You can not add another. However nothing says you can not have a gui to do this or base it on the number of command line parameters. Your choice. Trevor
For simplicity's sake, I decided to use the number of command line parameters supplied to the client to determine the mode. Sun does say that the app can take the hostname and port of the remote server, the database file name, policy file, yada yada. My code therefore assumes that if it receives TWO parameters then we are in network mode (hostname and port), whereas if only one is received we are in local mode (database file name). That's not to say you can't be more clever than I was... But I recommend that you take the advice that someone gave me about the assignment: Satisfy the requirements with a solid design, avoid frills and unneeded "flash", get it done and move on. When you have the certification plaque on your wall, no one will know that you didn't implement a GUI to allow the "Fly By Night" users to choose the mode Matt
There is no right or worng way of doing this as long as you dont introduce any other command line arguments (use only the ones that the spec allowes). My algorithm is like this: 1. if -host is present assume network mode and optionally look for -port. 2. if -data is present assume local mode. 3. if both (-data and -port) are present defaut to local mode (you can default to network if you want but make it known in your User guide) 4. if neither is present start in 'not-conected' mode. (if you dont have gui facility to connect you may display error message and quit). I implemented GUI Connect/Disconnect functionality so my client can reconnect on the fly, which justifies initial 'not-connected' mode. But this is beyond requirements. This protocol seems quite simple and covers you in terms of initial connection.
posted 18 years ago
Thanks to all who replied for their insight. Would you think it's OK if I let the user know that the client couldn't be started (in cases in which I expect command line parameters, but none are specified) by dumping something to the console (e.g. "No database file was specified. Terminating . . . ") or do you believe that I need a fancier way of conveying that to him/her.
You guys wanna see my fabulous new place? Or do you wanna look at this tiny ad?
Devious Experiments for a Truly Passive Greenhouse!