Non-default Preferences (how to push new conf file)

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Non-default Preferences (how to push new conf file)

Peter Hansson-2

Inside my NB Platform appl, I'm working with an external library which for various reasons require me to use a non-default implementation of Preferences. I do this by setting System Property 'java.util.prefs.PreferencesFactory' in my module installer class.

Unfortunately this doesn't work. The reason is long and winded but basically comes down to the fact that the Platform uses Preferences too, and although the Platform's implementation, NbPreferences, avoids to install itself as the default (allowing you to use your own Preferences implementation for the stuff not related to Platform) it nevertheless *references* the Preferences class during startup and this is enough for the JDK defaults to get set in stone from that point onwards. Setting that system property later on doesn't help. (look in the source for Preferences and you see why).

For this reason I need to set the aforementioned System Property very early, i.e. already on startup, which would mean doing it in the application's conf file. But this is an application already deployed to many, many workstations. As far as I know I cannot just push out a new conf file using the Autoupdate mechanism.

What to do?  What are my options?