• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

suncertify.properties format?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all!

Very quick question... Is the format of the suncertify.properties file restricted in any way? I'm asking because I'd rather work with preferences than properties and so, I want to populate the file with XML.

Your thoughts?
 
Bartender
Posts: 2292
3
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Howdy, partner! Welcome to JavaRanch!

Champion, you have to store the properties that your program require in a file called suncertify.properties that must be saved in the folder in which the application is running. This is a must. And you may define the properties that your program will require, according to its needs.
 
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,


I am not sure about the format but I am sure that XML style tags should not be used and also your file name must be suncertify.properties.

sat
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

You have to store the configuration settings in suncertify.properties and that is a must. I don't think there is a must on how the data should be stored, so xml, plain text, binary,... everything is allowed.

But of course why making it hard for yourself, if there is a Java class which is made perfectly for the job (java.util.Properties): loading, saving, retrieving properties is as simple as possible with this class.

Kind regards,
Roel
 
Lonesha Akaaba
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello again...

Yes, I understand the requirements (storing properties the app requires in the file, in the current directory, etc) and that there is a Properties class. The reason why I want to use preferences is because it provides a clean way to separate my client properties from the server ones (by specifying the parent node). For example, I can write out changed client properties without having to code the logic to skip properties that only apply to the server (because I have them in separate nodes)... Does this help explain my question more?

My original question is really will I be penalized (failed) if the contents are XML?
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Lonesha,

With this code I set 2 properties and save it to file:


Like I previously said: I think you are making it more difficult than it should be. But there is no requirement about how the properties (format) are saved in the suncertify.properties, so if you prefer XML just use it.

Kind regards,
Roel
 
Lonesha Akaaba
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Roel... you're still not understanding me... I know how to set properties... the problem with your example is that I have properties specific to the server and another set specific to the client. Because they are both in one file (per the requirements), if I only want to load and/or write those specific to the client, it requires additional code. There isn't (at least I haven't found it) a way of specifying the "group".... So, when I write client prop changes back to the file, I either have to deal with the server ones or lose them... and the reverse is true when working with the server props...

Hopefully this example will help
- client properties
-- show splash screen
-- database location (server remote or local)
-- database file (only valid when server is local)
--- etc
- server properties
-- database file
-- port
--- etc


Thanks for your responses.
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Roel De Nijs wrote:With this code I set 2 properties and save it to file ...


Which is not that much different to an XML version:

Realistically therefore, I think there should be no problems using the XML format of a standard properties file if you desire.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Lonesha,

You don't lose properties. When you load the properties, it loads all properties in that file. And if you store the properties object, all properties are saved.

A small example:


Kind regards,
Roel

 
Lonesha Akaaba
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. I'll stick with what I have
reply
    Bookmark Topic Watch Topic
  • New Topic