aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes B&S: How to use suncertify.properties ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "B&S: How to use suncertify.properties ?" Watch "B&S: How to use suncertify.properties ?" New topic
Author

B&S: How to use suncertify.properties ?

Darya Akbari
Ranch Hand

Joined: Aug 21, 2004
Posts: 1855
Hi,

my assignment says about the suncertify.properties file:


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.properties which must be located in the current working directory.


How do you use this file? Do you create suncertify.properties with each new run of the application and read from it whenever necessary?

Like reading the data file path from suncertiy.properties from inside the data layer to read the data file into the model. Or like reading the host from suncertify.properties from inside the network layer to create an RMI connection?

I prefer to create suncertify.properties with each new run and read from it at appropriate times from the different layers.

How do you do it ?

Regards,
Darya


SCJP, SCJD, SCWCD, SCBCD
Wei-ju Wu
Ranch Hand

Joined: Feb 16, 2005
Posts: 147
Hi Darya,
creating the properties new with every new run violates the requirement "and must be persistent between runs of the program". This means that the settings the user makes are stored in the property file and can be used on subsequent runs of your application.

If you create it on every new run it means you do not use the settings for later use at all.
[ May 10, 2005: Message edited by: Wei-ju Wu ]

"The UrlyBird catches the certificate. And he's gonna FlyByNight"<br /> <br />SCJP 1.2/5.0, SCJD, SCBCD, SCWCD, SCEA
Olena Golub
Ranch Hand

Joined: Jan 17, 2005
Posts: 113
Hello Darya,

I have implemented it in this way:
The Application checks the properties file. If this properties file exists than checks if all settings (for example for server mode: port and database location) for startup mode not nullable. If not, the application will be started with these settings. If some of these properties are nullable, the Dialog will be shown where user can enter these settings.
If the properties file doesn�t exist. The Dialog will be shown and after the user enters the settings the properties file will be created and these settings will be saved in it.
I have made also the possibility to change and save the setting to properties file in my Client/Server GUI.
Regards,
Olena
[ May 10, 2005: Message edited by: Olena Golub ]

SCJP 1.4<br />SCJD 1.4 (in progress)
Darya Akbari
Ranch Hand

Joined: Aug 21, 2004
Posts: 1855
Hi Wei-ju and Olena ,

Wei-ju. what do you think of Olena's approach. Sounds good to me.

Olena, why do you have a Client and a Server GUI ?

As I understand the single mode flag we have the following:

  • server starts the application (client on local host + server on a remote host)
  • alone starts the application (client + server) on the local host
  • - starts the application (only client) on the local host

  • I offer two views (GUI). One view which is the client and another view to enter the configuration information which is necessary for mode server and alone.

    Regards,
    Darya
    Olena Golub
    Ranch Hand

    Joined: Jan 17, 2005
    Posts: 113
    Hi Darya,

    I have the following GUIs:
    Client GUI (for standalone or remote client). Where I have one MenuBar "Preferences...".

    In Server part I have very simple GUI only with one button "Shutdown", that stops the server and close the program. And here I have also the "Preferences..." Menu.


    If I start my application with "server" argument, then only the server part (where I create registry and register my remote object ) will be started and will GUI (say, Server GUI) will appear. I will not start the remote client with this argument.

    After I started the application with "server" I can start the application with no parameter, for
    example, in another computer. This will start my Client GUI, that connects to Server or in another words to another
    Java VM that I have started with "server" parameter. If I start the client from the another computer or from another path a new
    properties file will be created in System.getProperty("user.dir") and this directory is different.
    That�s why I have the possibility to configure properties in client or server GUI.


    If I start in alone mode, no server will be started, only my Client GUI with database access.

    Make this sense or maybe I did not correct understand the assignment ?
    Sorry, my English is very bad, if something is difficult to understand, just ask, and I try to rephrase it.

    Thanks a lot for your comments!
    Regards
    Olena
    Darya Akbari
    Ranch Hand

    Joined: Aug 21, 2004
    Posts: 1855
    Thanks for your response Olena,

    I think your approach is better than mine. I've to rethink the mode flag.

    Regards,
    Darya
    Wei-ju Wu
    Ranch Hand

    Joined: Feb 16, 2005
    Posts: 147

    Wei-ju. what do you think of Olena's approach. Sounds good to me.


    I agree
    Reza Rahman
    author
    Ranch Hand

    Joined: Feb 01, 2005
    Posts: 580
        
        5
    I would confirm saved settings with the user before starting the application, thereby simplifying the application design as well as saving the need for the user to have to "enter the app" to alter a saved setting.


    Independent Consultant — Author, EJB 3 in Action — Expert Group Member, Java EE 6 and EJB 3.1
     
    It is sorta covered in the JavaRanch Style Guide.
     
    subject: B&S: How to use suncertify.properties ?