wood burning stoves 2.0*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Should server configuration be provided by suncertify.properties ? 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 "Should server configuration be provided by suncertify.properties ?" Watch "Should server configuration be provided by suncertify.properties ?" New topic
Author

Should server configuration be provided by suncertify.properties ?

Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
I find it increasingly absurd to allow the client application to configure the server. Has anyone succeeded in providing my intended solution ?:
"The client application configures itself and changes made affect only that client. Changes to the server will require a recompile of the system (as candidate configuration values are hard-coded in an interface). Allowing the client to configure the server presents concurrency issues along with reliability issues i.e. the client should be able to apply a configuration and be sure that it takes effect, however, some other client application may also decide to configure the server. Other problems such as allowing the client to configure the server port would require the server to be restarted and only the client that made the change would know about it. (etc., etc.)"
Any suggestions/comments are most appreciated.


Tony Morris
Java Q&A (FAQ, Trivia)
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
I should have also stipulated that I am attempting to ensure that my thoughts conform to the following requirements:
- "either case, the program 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. "
- "Your programs must not require use of command line property specifications. All configuration must be done via a GUI, and must be persistent between runs of the program. "
Tony Collins
Ranch Hand

Joined: Jul 03, 2003
Posts: 435
In my project
The client should configure the location of the server.
The server should configure the location of the database and the port no of the server should run on.
In alone mode the client should configure the location of the database.
Tony
[ September 26, 2003: Message edited by: Tony Collins ]
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
"The server should configure the location of the database and the port no of the server should run on."
How so ? Please elaborate. A server configuring itself seems very undefined to me.
Tony Collins
Ranch Hand

Joined: Jul 03, 2003
Posts: 435
Well the server should configure itself from the suncertify.properties file or from user input. The server needs to know the location of the database file somehow.
Tony
[ September 26, 2003: Message edited by: Tony Collins ]
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
I still can't make a concise definition from that.
Am I right in saying that you use the client application to configure the server by means of reading/writing the suncertify.properties file directly (not over the network) ?
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
When you run the program in server mode, you should have an opportunity to configure the server parameters before the server"really" starts. The term "server" is a little fuzzy, as in one sense it refers to the whole program which you run in server omde - but more specifically, it can refer to the part of the program which connects to a socket or RMI and communicates with clients. So the part of the "server" (meaning, the entire program) can configure the "server" (meaning, the part that networks with clients). Yes, the insturctions are vague here. Just htink about, if you need to start a server, or connect to a server, what information do you need to be able to specify, and what's a good, sensible way for you to specify it? My instructions require that all configuration be done via GUI, so think about how to design a GUI screen (or screens) to allow the user to configure what he needs.


"I'm not back." - Bill Harding, Twister
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
Are you saying then that there are two separate GUI applications ?
One for the client to the server, the other running on the server ?
Tony Collins
Ranch Hand

Joined: Jul 03, 2003
Posts: 435
I've got two GUI's
Bharat Ruparel
Ranch Hand

Joined: Jul 30, 2003
Posts: 493
Hello Tony Morris,
Tony Collins is right. I had the same doubts that you have. Please refer to the following thread:
NX: URLy Bird 1.3.1 Suncertify.properties
[url=http://www.coderanch.com/t/184161/java-developer-SCJD/certification/NX-URLy-Bird-Suncertify-properties'']http://www.coderanch.com/t/184161/java-developer-SCJD/certification/NX-URLy-Bird-Suncertify-properties''[/url]
I started out more than convinced that only one GUI was needed. However, when implementing it, the flow became clearer to me. My advice is to start out by implementing GUI for the server. Now do it for the alone mode. and finally do it for the network client. As a matter of fact, I have three dialog boxes with a file-chooser when appropriate, i.e., looking up the path for the database file. Just take it one step at a time and don't think too much until you get to a point where it will be productive to step back again.
Regards.
Bharat


SCJP,SCJD,SCWCD,SCBCD,SCDJWS,SCEA
Vlad Rabkin
Ranch Hand

Joined: Jul 07, 2003
Posts: 555
Hi Tony,
Are you saying then that there are two separate GUI applications ?

Yes, that is what you can do and most of do so.
Best,
Vlad
Philippe Maquet
Bartender

Joined: Jun 02, 2003
Posts: 1872
Hi Tony,
Server ----> Server GUI
Client ----> Client GUI
Alone ----> Client GUI++
Very short, but clear enough IMO.
Best,
Phil.
[ September 26, 2003: Message edited by: Philippe Maquet ]
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
The requirements make references to "the GUI" which has an implication that there is only one ("the" one) GUI. I agree that the requirements are somewhat flaky and I can understand your reasoning for implementing two GUIs (hence, the reason I started this thread).
I have decided to provide the ability for the client application to set configuration properties that are relevant to the server (TCP bind port, data file and JNDI name of exported object). The client application will write the changes directly to suncertify.properties - it's intended that the server will read this file at start-up time. I will document my reasoning (references to "the GUI", etc.) in choices.txt.
Thanks for the help.
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
After rereading the requirements, there is a reference to "a GUI".
"All configuration must be done via a GUI"
Damn, I spent all last night implementing my original thoughts.
Guess what I'll be doing today ?
Ken Krebs
Ranch Hand

Joined: Nov 27, 2002
Posts: 451
Tony,
My interpretation is that some GUI code must be used to handle configuration of the location settings for any mode of operation. This is not necessarily part of the same code used as the primary GUI fucntionality, i.e manipulation of the db. I wrote a LocationDialog class that handles this location configuration part for server and client modes. I simply use JFileChooser directly for standalone mode.
My interpretation of "location" for each mode is :
standalone - the database file path
server - the database file path and port no.
client - the hostname and port no.

BTW, my primary GUI is in a ContractorView class which is used in standalone and client modes. That capability could also be added to the server mode should it ever be needed with 1 line of code as my database implementation handles the locking internally and does not expose it to clients.
kktec
SCJP1.4 & SCWCD


kktec<br />SCJP, SCWCD, SCJD<br />"What we observe is not nature itself, but nature exposed to our method of questioning." - Werner Heisenberg
Lanuk Jajab
Greenhorn

Joined: Jul 03, 2003
Posts: 19
Hello all,
I don't mean to jump in here, but I'm myself doing the URLyBird assignment and I implemented the GUI the following way. I assume that the person who starts the application in "server" mode will provide the configuration parameters for the server (i.e., the port number, the binding name as well as the location of the database). The Remote Client (end user) will specify the Hostname or IP where the "server" is located, the Binding Name and the Port. In standalone mode, none of this extraneous stuff is of any issue as you specify and use the database directly. So essentially, I have 3 different GUI configuration screens (1 for a Remote Client, 1 for a Standalone and 1 for a Server).
So what does this imply in terms of the suncertify.properties file? Well, keep in mind that if one does not exist in the current working directory, it needs to be implicitly created. So, if a Remote Client is logging on to the server (which for all intents and purposes may be on a different box), there would be 2 different suncertify.properties (one for the remote client) and another for the Server, where each would store their own configuration information.
I do not believe there is any restriction that forces you to use a single configuration file to store both remote, standalone and server properties, unless of course you are running all three modes from the same working directory on the same box.
Hope that clears up things a bit
- Lanuk
[ September 27, 2003: Message edited by: Lanuk Jajab ]
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
Does anyone make the assumption that the client and server application are never executed from the same working directory on the same machine ?
I ask this because I am loading and storing the Properties separately for the server and client - if the client has it's set of properties, the server will overwrite them.
Lanuk Jajab
Greenhorn

Joined: Jul 03, 2003
Posts: 19
Tony,
Even though it may seem a little silly to connect with the database remotely even when you are on the same box, I do not think we can make an assumption like that.
Besides, even if the properties file is overwritten, why does it matter ... so long as the keys that define the server preferences vs. remote preferences vs. standalone preferences are defined uniquely? So for example, I start the next iteration only in server mode from the same box/same working directory I would have loaded the appropriate preferences for the server, while leaving the keys for the remote and standalone mode completely alone. Similarly, if I wanted to use the networked GUI client from this same CWD but connect to a different server, I could still use the same properties file, but just overwrite the remote client preferences related keys.
- Lanuk.
Bharat Ruparel
Ranch Hand

Joined: Jul 30, 2003
Posts: 493
I completely agree with Lanuk. That is what I have done, it works.
Bharat
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
This is the problem. I am using Properties.store, which, when you open the OutputStream, overwrites any existing values. Opening it for append does not solve the problem. I have written my own class (PassiveProperties extends Properties). This class has an additional store method, that takes a File object (and a header) that reads the properties from that file and then "concatenates" the new properties, before writing back out to the file.
How else could this problem be solved ?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Should server configuration be provided by suncertify.properties ?