Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate default values for configuration properties #754

Open
Omertron opened this issue Mar 15, 2015 · 9 comments
Open

Consolidate default values for configuration properties #754

Omertron opened this issue Mar 15, 2015 · 9 comments

Comments

@Omertron
Copy link
Member

Original issue 755 created by Omertron on 2009-04-29T01:55:30.000Z:

I find the current method of specifying default values for configuration properties to be tedious
and repetitive, which makes it error-prone. Basically, I don't like that we have to mention the
default value every time we grab the property from the Properties collection.

I would much rather consolidate all the default values into one location, eg a static initializer in
the PropertiesUtil class. That way properties will always be set to their defaults if not
overridden by the user, so the version of getProperty that takes two arguments would never
need to be used.

Bonus points if we can have the build process generate the default moviejukebox.properties
file based on those defaults.

@Omertron
Copy link
Member Author

Comment #1 originally posted by Omertron on 2009-04-29T06:18:47.000Z:

Good idea.

@Omertron
Copy link
Member Author

Comment #2 originally posted by Omertron on 2009-04-29T06:23:59.000Z:

OK, as long as there is never the situation where you want to override the default
with different values.

I've been meaning to do a code review and look for all the properties as I'm sure
there are some extra ones that aren't documented.

@Omertron
Copy link
Member Author

Comment #3 originally posted by Omertron on 2009-04-29T06:26:56.000Z:

If you think that's an important feature, I can make sure it remains available.

@Omertron
Copy link
Member Author

Comment #4 originally posted by Omertron on 2009-04-29T13:58:46.000Z:

Just thinking aloud really.
Is there a situation where you want to read the property and know if it's defaulted?
I doubt it, as that was the purpose of supplying the default value to the function in
the first place.

@Omertron
Copy link
Member Author

Comment #5 originally posted by Omertron on 2009-04-29T18:44:35.000Z:

These changes would probably also help make Issue 681 easier for localized strings.

@Omertron
Copy link
Member Author

Comment #6 originally posted by Omertron on 2009-04-29T19:39:24.000Z:

How about just having a default.properties file with all the default values?

Something like this:

FileReader rdr = new FileReader( "default.properties" );
props = new Properties();
defaults.load( rdr );
rdr.close();

rdr = new FileReader( "moviejukebox.properties" );
props = new Properties( props );
props.load( rdr );
rdr.close();

rdr = new FileReader( "skin.properties" );
props = new Properties( props );
props.load( rdr );
rdr.close();

The default moviejukebox.properties would just be a copy of default.properties.
If we put default.properties in the .jar file instead of the file system, it would
be relatively hidden from the users so they won't edit it.

@Omertron
Copy link
Member Author

Comment #7 originally posted by Omertron on 2009-04-29T22:32:25.000Z:

That's a very good idea.

@Omertron
Copy link
Member Author

Comment #8 originally posted by Omertron on 2009-08-25T07:42:41.000Z:

<empty>

@Omertron
Copy link
Member Author

Comment #9 originally posted by Omertron on 2010-08-24T13:43:49.000Z:

This has sort of been implemeted with the moviejukebox-default.properties file.

However, having a single place to define what is considered "default" in yamj and not have to look/guess/find the property that it corresponds to would be good.

I know Vincent was looking at implementing something similar.

Perhaps he can enlighten us on the work so far

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant