Meaningless Drivel is fun!*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Persist 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 "Persist Properties" Watch "Persist Properties" New topic
Author

Persist Properties

yaza awad
Greenhorn

Joined: Mar 20, 2009
Posts: 4
Hello everyone:

Do I need to persist the server properties? I am thinking no. If yes, do I need a separate file than the one I use to persist to persist the client's ones. here I say yes.

K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 1966
    
    7

You need to persist both client and server. When you start server, you need to save database and port say. Without that how can remote clients connect?


K. Tsang JavaRanch SCJP5 SCJD/OCM-JD OCPJP7
yaza awad
Greenhorn

Joined: Mar 20, 2009
Posts: 4
The user at the client side should know the server and port, when starting the client, the user is prompted to enter this information. Maybe I am wrong??

On the server side, the admin is prompted for the rmi port everytime they start the server, I can persist such information. In this case I should have 2 files one for the client side and one for the server side. I am not sure how other people approached this. Maybe I am making a big deal out of it, any way any feedback is appreciated.

Thanks in advance
K. Tsang
Bartender

Joined: Sep 13, 2007
Posts: 1966
    
    7

Yes you are absolutely correct. In fact if the server and client are 2 separate computers you will have no problems. But what happens if you run server and client on the same computer?

Therefore whatever you have already saved for client/server need to be read in then add the new stuff and write it all back.

Also for the server the configuration should be done only once. So the first run you set the port, subsequent runs should not need to prompt for the port and just start server.

For the remote client I think you need both server address and port in order to connect. This is how RMI and sockets work.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Persist Properties
 
Similar Threads
Database Location - Bodgitt & Scarper
Use EJBs for transactions?
creating copies, JPA
SCEA Part II - Shall we persistent all the objects mentioned in Domain Model?
NX: properties GUI