I am using RMI for connecting to the server. I am getting the IP/Port settings from the properties file whichj will be in the default directory. In case that file is missing what's the value of IP/Port we can use that won't cause any conflicts! Thanxs in advance.
I haven't coded this part. But here is what I plan to do in general. When my client starts, I display a connection selection dialog, where the user can choose to connect either locally or remotely. I default the selections and properties (db location, port, ip) to what the user chose last time by reading from the properties file. If the user wants to keep everything unchanged, he just click OK and move on. If the properties file doesn't exist or the values aren't there, the dialog defaults to local connection. But the user can change the settings. After the user enters the values, I persist them to the properties file and make the connection accordingly to start the main GUI.
T. Anthony Chen<br />---------------<br />SCJP, SCJD, SCBCD, SCWCD, SCEA
Using localhost as the IP: wont it cause the loopback!
Yes, but only in networked mode, if the examiner wants to test the requirement 'must not use network code' then they will run the standalone mode which should comply with that. What default would you use for ip/host if not localhost, do you have a crystal ball handy?
Ok from the server side we can use localhost. I have server port in the server side where the app is listening, and i have server location and server port in the client side. I can't hard code this in the properties file. For that reason the properties file has to be created the first time the application is run. During the first run the app asks for these three parameters using a UI and create the properties file. This is what i am planning to do. My questions is, Is this setup part necessary? Can't we supply the propertieds file with the jar file? Regards
You can have a properties 'resource' within the runme.jar this can hold the defaults and populate an empty or existing suncertify.properties 'file'. That way the suncertify.properties 'file' is not required for the app to run. For the sake of this assignment, I strongly advise the defaults to be set to 1099, localhost & for the DB file - root directory and provided file name.