aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Switch between remote/local db required? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Switch between remote/local db required?" Watch "Switch between remote/local db required?" New topic
Author

Switch between remote/local db required?

shan chen
Ranch Hand

Joined: Apr 09, 2003
Posts: 70
When I reread the instruction, I am confused with the following words:

Network Approaches
Your choice of RMI or serialized objects will not affect your grade. In either case, the porgram must allow the user to specify the location of the database, and it must also accept an indication that a local database is to be used, in which case, the networking must be bypassed entirely.


So when a client is connecting to a remote database in network mode, it should be able to switch to a local database, and the networking is bypassed. In other words, switch the mode on fly. Am I right?
Previously I thought the mode is defined by the command line argument and will not change through the program life.
Thanks for any help.
Christian Garcia
Ranch Hand

Joined: Jan 29, 2002
Posts: 77
We aren't required to provide the "switch on the fly" functionality. However, the user must be presented with an option to work in local or network mode when the application is loaded.
I think there have been people that did add this ability, but it's outside the scope of the core requirements. I guess it's really up to.
Hope this helps.


Christian
Thomas Kijftenbelt
Ranch Hand

Joined: Feb 13, 2002
Posts: 73
hi,
From my point of view the instructions are quite specific on this: you must use a single commandline argument "mode" indicating the mode the application has to use...
greetings,
TK
shan chen
Ranch Hand

Joined: Apr 09, 2003
Posts: 70
Thanks for all replies. English is not my first language and I am not clear about the sentence here.
Does "In either case" only covers "the program must allow the user to specify the location of the database", or it also covers the rest of sentence?
If the former is the case, no switch on fly.
If the latter is the caes, we may need switch on fly.
Does the case mentioned in "in which case" included in "in either case" or not?

I hope no switch on fly.
Thx.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
The "in either case" refers to the previous sentence "Your choice of RMI or serialized objects (for the networked version)...".
So you can ignore it, and read the next sentences as:
1. "The program must allow the user to specify the location of the database."
2. "The program must accept an indication that a local database is to be used."
3. "When a local database is used there must be no networking code".
Even for a person with english as a first language there is a lot of "noise" in the assignment instructions that has to be filtered out. In fact the first step should be to rewrite the instructions making a checklist of the things that "must", "should", "may", "must not" be done.
-Barry
[ May 04, 2003: Message edited by: Barry Gaunt ]
[ May 04, 2003: Message edited by: Barry Gaunt ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
shan chen
Ranch Hand

Joined: Apr 09, 2003
Posts: 70
Thanks Barry. I have another question related property file.
All configuration must be done cia a GUI, and must be persistent between runs of the program. Such configuration information must be stored in a file called suncertify.properities which must be located in the current working directory.

But in section "Packaging Submission", it does not mention suncertify.properties. So it just is an optional? The program can use default property and does not allow reconfiguration. Is it correct?
Thanks to any comments.
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11278
    
  59

Hi Shan,
You suggested: The program can use default property and does not allow reconfiguration.
I think this will limit your client application to only running on the same machine as your RMI registry. This may be how the examiner chooses to run your application, but I would not want to force them to do this.
If you decide to allow the client application to be on a different machine to the RMI registry then you are going to need to tell the client application where to find the RMI registry.
As soon as you do that, you fall into the clause:
configuration ... must be persistent between runs of the program

That is, the examiner should not have to re-enter the address of the RMI Registry each time they run your client application. Therefore you need to store that information, in a file you will create named "suncertify.properities". The name this file is given should give you a clear idea of which classes the examiner expects you to use.
Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
All configuration MUST be done via a GUI, and MUST be persistent between runs of the program. Such configuration information MUST be stored in a file called suncertify.properities which MUST be located in the current working directory.

Hi Shan, see those "MUSTS"? There's no optional allowed there. If you do not do those "MUSTS" you are doomed.
shan chen
Ranch Hand

Joined: Apr 09, 2003
Posts: 70
Thanks, Andrew, Barry.
I am actaully not clear about the instruction:
<quota>All configuration MUST be done via a GUI,
</quota>
It implies properties is configured with some GUI.
<quota>and MUST be persistent between runs of the program.</quota>
Does this mean suncertify.properties is just configured once, then no changes any more?
<quota> the examiner should not have to re-enter the address of the RMI Registry each time they run your client application.
</quota>
Andrew, I think the host name still needed when a client starts.
What my code does now is:
1.when server starts, it reads in port and dbfile name from suncertify.properties, displays them in a dialog. User can re-configure or just leave them unchanged. The new properties will be saved back to suncertify.properties. The server then starts with the new port and new datafile, if changed.
2. when client starts, it displays a dialog first, asking for host name and port number, then connect to the server according to the input. The client <bold>DOES NOT<bold> read suncertify.properties, because it does not have an <bold>updated</bold> suncertify.properties, unless the server can send it to the client. But how can the server know where the client is?
Thanks to any comments!
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11278
    
  59

Hi Shan,
Please be careful with your UBB codes - they are not HTML codes, so angled brackets (<,> ) dont work. They have to be square brackets ([,]). And the word is QUOTE, not QUOTA (case doesnt matter).
All configuration MUST be done via a GUI,
It implies properties is configured with some GUI.

If you are suggesting one application to set up properties, then multiple applications (Client GUI and Server) read these properties, then no - this is wrong.
What you are doing (on the server) is correct: load the configuration, allow the user to change them, save them back to the parameters file, then continue with the main application which uses the parameters that were either edited or approved by the user.
and MUST be persistent between runs of the program.
Does this mean suncertify.properties is just configured once, then no changes any more?

Substitute "persistent" with "remembered".
So if the examiner enters port number 1234 the first time they run your application, then the next time they run it, they should be offered port 1234 as the default.
However they can change it without any problems.
the examiner should not have to re-enter the address of the RMI Registry each time they run your client application.
Andrew, I think the host name still needed when a client starts.

Agreed. I was not suggesting that it would not be needed. See my earlier comment about remembering values. The examiner should only have to enter the value once. Every time they start your application after that, it should have remembered the host name, and offer it as the default. They can change it, but they dont have to. And more importantly, they dont have to re-enter it.
Your description of how the server works looks correct to me.
Your client program though, has left out the important step of saving the data to file so that it will be persistent (remembered) for future executions of your program.
Regards, Andrew
[ May 06, 2003: Message edited by: Andrew Monkhouse ]
shan chen
Ranch Hand

Joined: Apr 09, 2003
Posts: 70
Hi, Andrew,
Thank you for your suggestion.
For the origianl question, I got the SUN reply:

The instructions do not specify that users can switch databases dynamically.
It's ok if the mode and database are set
only once, at startup time.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Switch between remote/local db required?
 
Similar Threads
Network approaches confusing statement
How to process the networking with a local database?
NX: Question about database location.
How many modes are there for the program?
Design