aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes URLyBird 1.3.2 : Configuration Doubt 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 "URLyBird 1.3.2 : Configuration Doubt" Watch "URLyBird 1.3.2 : Configuration Doubt" New topic
Author

URLyBird 1.3.2 : Configuration Doubt

Jeffry Kristianto Yanuar
Ranch Hand

Joined: Oct 01, 2007
Posts: 759
Hi guys, I have a little bit problem regarding configuration file.

The assignment requires me to store the configuration file to working directory What does it mean? Does it mean I must put the configuration file to the same folder with the jar file when I save the configuration?

Do I must use the Property class? Or use the XML file to store the configuration file?

One last thing. What configuration that should be stored? The instruction doesn't say anything about it so I'll assume the client will store the server's address or database location (in local mode), and the server will store the database location. I choose hard-coded port number.


Jeffry Kristianto Yanuar
SCJP 5.0
SCJA
SCJD (Working on UrlyBird 1.3.2)
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2266
    
    3

Do I must use the Property class? Or use the XML file to store the configuration file?


God, no!!!

About this requirement, you need to have a suncertify.properties file in the current working directory. This will store the configuration the users provide when the application starts in the 3 different modes. For instance, I get your runme.jar file and place it in my C:\Jeffry-SCJD directory. I run your file with java -jar runme.jar server. Since there isn't still a suncertify.properties file in the C:\Jeffry-SCJD directory, your application will create the file there. But what should be stored there? For instance, in my case, for the server initialization, I ask the user to provide the port number and the database location. Remember that, at this point, I'm starting the server, so clients can connect to it. When the user provides these information, I store these information in the suncertify.properties file in the current working directory (System.getProperty("user.dir")). I used the java.util.Properties class to store the properties, then java.io.FileInputStream to physically store them. Then, the next time the user starts the application in server mode, the fields of the configuration window will already be filled with the options the user provided the last time the application was started in server mode. Each initialization mode (identified by the parameter in the command line) has its own fields. These fields are the ones you judge necessary to start your application.


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Jeffry Kristianto Yanuar
Ranch Hand

Joined: Oct 01, 2007
Posts: 759
So in one configuration file, There are three configuration:
- For client networked mode (storing server's address)
- For server mode (storing database path)
- For stand alone mode (storing database path)

Is it like that?

thanks
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2266
    
    3

So in one configuration file, There are three configuration


Yes, that's it partner!
jin Young
Greenhorn

Joined: Nov 03, 2008
Posts: 21
Hi, Roberto & Jeffry ,

When i package the application to runme.jar or further package the runme.jar to final submition ,should I package the property file named suncertify.properties to the package for submit?

Thanks a lot!!
Jeffry Kristianto Yanuar
Ranch Hand

Joined: Oct 01, 2007
Posts: 759
I didn't do that because in my assignment didn't say so.

I already pass the SCJD exam, You woke the zombie thread and the zombie will come into your house


Anyway, good luck in your assignment. If you get a problem, don't hesitate to make a new thread.


Good Luck !!!

Jeffry Kristianto Yanuar (Java Instructor)
SCJP 5.0, SCJA, SCJD (UrlyBird 1.3.2)
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2266
    
    3

When i package the application to runme.jar or further package the runme.jar to final submition ,should I package the property file named suncertify.properties to the package for submit?


No. This file has to be created in the working directory only if there isn't still one.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: URLyBird 1.3.2 : Configuration Doubt