Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2005

Tip: Looking for answers? Try searching our database.

Java Preferences

Thread view: 
jaj_developer@yahoo.co.uk - 27 Sep 2005 09:02 GMT
All,

Currently I am using Java Preferences to store preferences to the
default location (on windows the registry).

The issue is that some users will move from machine to machine and in
some cases the registry is locked down.

So the question is : Is there any easy way of altering the way Java
Preferences are stored (e.g. xml flat file, csv etc..) or do you have
to cut some code (e.g. impliment your own PreferencesFactory)??

Ta

Jaj
Roedy Green - 27 Sep 2005 09:17 GMT
>So the question is : Is there any easy way of altering the way Java
>Preferences are stored (e.g. xml flat file, csv etc..) or do you have
>to cut some code (e.g. impliment your own PreferencesFactory)??

What you might do is suck the preferences out for backup and dump them
in a platform independent format. XML should do, or perhaps a
serialised tree.

I don't think you have any control how the system preferences are
implemented.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

jaj_developer@yahoo.co.uk - 27 Sep 2005 09:40 GMT
Roedy,

Yeah that's what I thought. I think that I will have to implement my
own version of the PreferenceFactory and the AbstractPreferences.

*sigh*

Jaj
jaj_developer@yahoo.co.uk - 27 Sep 2005 11:14 GMT
Does anyone know of a good tutorial (or any tutorial) or any GPL code
that I can look at to show me how to do my own Factory ???

Ta

Jaj
Roedy Green - 27 Sep 2005 20:49 GMT
>Yeah that's what I thought. I think that I will have to implement my
>own version of the PreferenceFactory and the AbstractPreferences.

Since you are tossing Sun's preference mechanism aside, you could just
do this with a class with a static get and save method where you
specify the full node name on each get/save.

Another thought is JDK 1.5 Preferences has an xml import/export built
in.

If you want to replace the official preferences here is what to do:

Write yourself a JAIPreferences class that extends the abstract
Preferences class.

Then write a class that implements the PreferencesFactory interface.
basically all it does is return new JAIPreferences().

If the system property java.util.prefs.PreferencesFactory is defined,
then it is taken to be the fully-qualified name of a class
implementing the PreferencesFactory interface.

there is another method of registering your factory with a magic jar
entry described under Preferences.

Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.

jaj_developer@yahoo.co.uk - 29 Sep 2005 10:53 GMT
Roedy,

Thanks for your wise words....

Have implemented a system based upon the info above

Ta

Jaj


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.