Provide NetBeans specific implementation of Preferences API means:
java.util.prefs.PreferencesFactory
Implementation of NetBeans-dependent backing store involves making following decisions:
Implementation of stored defaults (follows documentation of Preferences API):
When a program writes a value that was previously covered by an existing stored
default, this default value is overridden by the new value. However, the stored default
itself is not changed—it is merely shadowed by the value that was explicitly added.
When a key/value pair is removed for a key that has a stored default, this default
value is uncovered by this removal.
There is no known requirement for system preferences
Preferences.systemroot()
. So, implementation of system
preferences will emulate state as if backing store was unavailable. This means
that such preferences won't be persistent and methods that throw
BackingStoreException
(like
flush()
, sync()
) will throw
it uconditionally. Even if default implementation was used
for storing system preferences there is no guarantee that these preferences
will be flushed on disk because very probably user won't have sufficient rights
especially on Unix.
Implementation of Preferences API won't expose any additional API nor SPI. There is no need to declare any dependency to be able to use NetBeans specific implementation of Preferences API.
There is important to avoid loading of Preferences
class before
installing NetBeans implementation. The best I think would be to do it even
before module system is initialized. The best candidate would be
Main
class in org.netbeans.core.startup
.
I would put then implementation of preferences either in
org.netbeans.core.startup
or into
org.netbeans.core
(then CoreBridge
would be used)