This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Micro Frontends in Action and have Michael Geers on-line!
See this thread for details.
Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Using JAXB for my suncertify.properties file?

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

First of all. Thank you for this forum. I was a heavy user in the last months. I'm coming to an end with my SCJD implementation and now it's the first time I did not found an answer for my question.

I'm using JAXB for my suncertify.properties file. This is a very convenient way to persist options via XML. AFAIK this has become a part of java SE 6.0.

=> Am I right? So I can use JAXB?

Greetings don_huberto
 
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
XML seems overkill. JAXB even more. Ever heard of 'not using a cannon to kill a fly'?
I am not sure now, but I think my reqs said that the config file must have text format similar to the standard Properties format. Does your say the same?
 
Bartender
Posts: 2292
3
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy, Hubert. Welcome to our JavaRanch, champ!

Thank you for this forum.



You're very welcome, champion!

I'm using JAXB for my suncertify.properties file.



Well, first, the official SCJD Assignment Page doesn't say that you can't use it. However, the resolution of the assignment should be simpler than that. You may have introduced more complexity than necessary, so you could lose points for that.

Now, if you are using JAXB, then I assume that your suncertify.properties file isn't an actual properties file, but an XML file... right? Although it is never said that the content of this file must have the format "key=value", I don't think it is a good idea to persist this file with XML format... first, because it is "suncertify.properties" and not "suncertify.xml", so this is isn't a requirement... and second, because (in my opinion) it is harder to deal with an XML file rather than a properties file. I agree with you that JAXB eases a lot this task... and this introduces one limitation in your solution: JAXB has indeed become part of the JDK since JDK 6, so you either must have JRE 6 or provide the path to the JAXB library in the classpath when running the application (and remember that you are not supposed to provide any parameter in the command line other than the flag that suggests how the application should run).

So, in my opinion, it is not a good idea. It should be better to keep things simple and deal with the suncertify.properties file as a key=value file.
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe JAXB simplifies the writing of XML, but the Properties class certainly simplifies the writing and loading of key-value pairs. So I would not use JAXB in this assignment, just keep it simple and easy. I don't know if a junior programmer is familiar with JAXB, but more chance he is familiar with the simple Properties class (and as you know from the instructions: a simple approach which is understandable for a junior programmer is prefered above a complex but more performant one).

I even have to say: when I got the notification of this new topic in this forum, I thought you simply posted your question in a wrong forum. I'm monitoring this forum since January 2009 and it's the 1st time JAXB is mentioned
 
Hubert Stroebitzer
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi

Thank you for your replies. I understand your argumentation.

But I think I will keep my JAXB solution. I think I can justify this decision in the choices.txt.

In fact, I find it more simpler and less error-prone to use JAXB. My options class has getters like this:



And persisting such options looks like this:


And that's it. The file is called "suncertify.properties".

I think this solution is also a very simple way.

Maybe soon I will regret this decission

Once again. Thank you for your statements.

Regards don_huberto

 
Raf Szczypiorski
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hubert Stroebitzer wrote:
Maybe soon I will regret this decission


I wouldn't count on Oracle grading your assignment 'soon'.
 
Drove my Chevy to the levee but the levee was dry. A wrung this tiny ad and it was still dry.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic