Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #2094 > unrolled thread
| Started by | Marcin <nomail@nospam.com> |
|---|---|
| First post | 2012-09-19 22:51 +0200 |
| Last post | 2012-09-21 10:19 -0700 |
| Articles | 8 — 5 participants |
Back to article view | Back to comp.lang.java.help
Database implementation of java.util.prefs.Preferences? Marcin <nomail@nospam.com> - 2012-09-19 22:51 +0200
Re: Database implementation of java.util.prefs.Preferences? markspace <-@.> - 2012-09-19 15:28 -0700
Re: Database implementation of java.util.prefs.Preferences? "John B. Matthews" <nospam@nospam.invalid> - 2012-09-19 20:59 -0400
Re: Database implementation of java.util.prefs.Preferences? markspace <-@.> - 2012-09-19 19:07 -0700
Re: Database implementation of java.util.prefs.Preferences? "John B. Matthews" <nospam@nospam.invalid> - 2012-09-20 12:20 -0400
Re: Database implementation of java.util.prefs.Preferences? Roedy Green <see_website@mindprod.com.invalid> - 2012-09-21 07:12 -0700
Re: Database implementation of java.util.prefs.Preferences? "John B. Matthews" <nospam@nospam.invalid> - 2012-09-21 21:10 -0400
Re: Database implementation of java.util.prefs.Preferences? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-09-21 10:19 -0700
| From | Marcin <nomail@nospam.com> |
|---|---|
| Date | 2012-09-19 22:51 +0200 |
| Subject | Database implementation of java.util.prefs.Preferences? |
| Message-ID | <505a3037$0$1299$65785112@news.neostrada.pl> |
Hello I have a Java program that uses java.util.prefs.Preferences to store configuration data. Everything is OK if one user works on one computer but if one user can use many computers the data is not shared between workstations and "environment" is different dependent on which computer user is logged in. I think I can store the same data in database because application uses connection to database for other purposes. Do you know any implementation of abstract class java.util.prefs.Preferences that uses SQL to store the configuration data? I cannot google anything interesting... Regards, Mar
[toc] | [next] | [standalone]
| From | markspace <-@.> |
|---|---|
| Date | 2012-09-19 15:28 -0700 |
| Message-ID | <k3dgu8$k1h$1@dont-email.me> |
| In reply to | #2094 |
On 9/19/2012 1:51 PM, Marcin wrote: > > I have a Java program that uses java.util.prefs.Preferences to store > configuration data. Everything is OK if one user works on one computer > but if one user can use many computers the data is not shared between > workstations and "environment" is different dependent on which computer > user is logged in. I think I can store the same data in database because > application uses connection to database for other purposes. Do you know > any implementation of abstract class java.util.prefs.Preferences that > uses SQL to store the configuration data? I cannot google anything I would kind of doubt there is one. In a situation like this, I would consider using Preferences::exportSubtree() and Preferences::importPreferences() to read and write to a blob in a database. I'd think carefully about it first though, as something about it feels like a mismatch for a preferences module in general.
[toc] | [prev] | [next] | [standalone]
| From | "John B. Matthews" <nospam@nospam.invalid> |
|---|---|
| Date | 2012-09-19 20:59 -0400 |
| Message-ID | <nospam-A9311B.20595019092012@news.aioe.org> |
| In reply to | #2095 |
In article <k3dgu8$k1h$1@dont-email.me>, markspace <-@.> wrote: > On 9/19/2012 1:51 PM, Marcin wrote: > > > > I have a Java program that uses java.util.prefs.Preferences to > > store configuration data. Everything is OK if one user works on one > > computer but if one user can use many computers the data is not > > shared between workstations and "environment" is different > > dependent on which computer user is logged in. I think I can store > > the same data in database because application uses connection to > > database for other purposes. Do you know any implementation of > > abstract class java.util.prefs.Preferences that uses SQL to store > > the configuration data? I cannot google anything > > > I would kind of doubt there is one. In a situation like this, I > would consider using Preferences::exportSubtree() and > Preferences::importPreferences() to read and write to a blob in a > database. > > I'd think carefully about it first though, as something about it > feels like a mismatch for a preferences module in general. "There are two separate trees of preference nodes, one for user preferences and one for system preferences." Instead of SQL, just start from systemRoot() for shared preferences. <http://docs.oracle.com/javase/7/docs/api/java/util/prefs/Preferences.html> -- John B. Matthews trashgod at gmail dot com <http://sites.google.com/site/drjohnbmatthews>
[toc] | [prev] | [next] | [standalone]
| From | markspace <-@.> |
|---|---|
| Date | 2012-09-19 19:07 -0700 |
| Message-ID | <k3dtpq$lmn$1@dont-email.me> |
| In reply to | #2096 |
On 9/19/2012 5:59 PM, John B. Matthews wrote: > In article <k3dgu8$k1h$1@dont-email.me>, markspace <-@.> wrote: > >> On 9/19/2012 1:51 PM, Marcin wrote: >>> if one user can use many computers the data is not >>> shared between workstations and "environment" is different >>> dependent on which computer user is logged in. > > Instead of SQL, just start > from systemRoot() for shared preferences. > System = one computer. The op wants to share user configurations between multiple computers. Using systemRoot won't help because it's limited to a single system.
[toc] | [prev] | [next] | [standalone]
| From | "John B. Matthews" <nospam@nospam.invalid> |
|---|---|
| Date | 2012-09-20 12:20 -0400 |
| Message-ID | <nospam-ED29F6.12202320092012@news.aioe.org> |
| In reply to | #2097 |
In article <k3dtpq$lmn$1@dont-email.me>, markspace <-@.> wrote: > On 9/19/2012 5:59 PM, John B. Matthews wrote: > > In article <k3dgu8$k1h$1@dont-email.me>, markspace <-@.> wrote: > > > >> On 9/19/2012 1:51 PM, Marcin wrote: > >>> if one user can use many computers the data is not shared between > >>> workstations and "environment" is different dependent on which > >>> computer user is logged in. > > > > Instead of SQL, just start from systemRoot() for shared > > preferences. > > > > System = one computer. The op wants to share user configurations > between multiple computers. Using systemRoot won't help because > it's limited to a single system. D'oh, I misunderstood the question; thanks for clarifying. I wonder if a javax.jnlp.PersistenceService might be useful in this context. <http://pscode.org/jws/api.html#ps> <http://docs.oracle.com/javase/7/docs/jre/api/javaws/jnlp/javax/jnlp/Pers istenceService.html> <http://docs.oracle.com/javase/7/docs/technotes/guides/javaws/developersg uide/examples.html> -- John B. Matthews trashgod at gmail dot com <http://sites.google.com/site/drjohnbmatthews>
[toc] | [prev] | [next] | [standalone]
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2012-09-21 07:12 -0700 |
| Message-ID | <ldto581bsn26ok3c4vbg5eghf4q6p9o78l@4ax.com> |
| In reply to | #2094 |
On Wed, 19 Sep 2012 22:51:03 +0200, Marcin <nomail@nospam.com> wrote, quoted or indirectly quoted someone who said : > Do you know >any implementation of abstract class java.util.prefs.Preferences that >uses SQL to store the configuration data? On windows, it uses the registry. on Linux it has a little database. see http://mindprod.com/jgloss/preferences.html -- Roedy Green Canadian Mind Products http://mindprod.com The iPhone 5 is a low end Rolex.
[toc] | [prev] | [next] | [standalone]
| From | "John B. Matthews" <nospam@nospam.invalid> |
|---|---|
| Date | 2012-09-21 21:10 -0400 |
| Message-ID | <nospam-B20B66.21101721092012@news.aioe.org> |
| In reply to | #2099 |
In article <ldto581bsn26ok3c4vbg5eghf4q6p9o78l@4ax.com>,
Roedy Green <see_website@mindprod.com.invalid> wrote:
> On Wed, 19 Sep 2012 22:51:03 +0200, Marcin <nomail@nospam.com> wrote,
> quoted or indirectly quoted someone who said :
>
> > Do you know any implementation of abstract class
> > java.util.prefs.Preferences that uses SQL to store the
> > configuration data?
>
> On windows, it uses the registry. on Linux it has a little database.
>
> see http://mindprod.com/jgloss/preferences.html
Given a declaration such as this:
Preferences p = Preferences
.userRoot().node("org").node("gcs").node("RobotChase");
Mac OS X uses a single XML file for the leaf node:
~/Library/Preferences/org.gcs.robotchase.plist
<http://www.apple.com/DTDs/PropertyList-1.0.dtd>
In contrast, linux uses a directory sub-tree that reflects the node
structure:
~/.java.userPrefs/org/gcs/RobotChase/prefs.xml
<http://java.sun/dtd/preferences.dtd>
Given the disparate implementations, it's a pretty good abstraction.
--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>
[toc] | [prev] | [next] | [standalone]
| From | Daniel Pitts <newsgroup.nospam@virtualinfinity.net> |
|---|---|
| Date | 2012-09-21 10:19 -0700 |
| Message-ID | <qk17s.2$D77.0@newsfe15.iad> |
| In reply to | #2094 |
On 9/19/12 1:51 PM, Marcin wrote: > Hello > > I have a Java program that uses java.util.prefs.Preferences to store > configuration data. Everything is OK if one user works on one computer > but if one user can use many computers the data is not shared between > workstations and "environment" is different dependent on which computer > user is logged in. I think I can store the same data in database because > application uses connection to database for other purposes. Do you know > any implementation of abstract class java.util.prefs.Preferences that > uses SQL to store the configuration data? I cannot google anything > interesting... > > Regards, > Mar If you need to store preferences across computers, java.util.prefs.Preferences is not the class to do it with. java.util.prefs.Preferences was basically meant to be a Java interface into the Windows Registry (with a more system-independent back-end). You will want to create your own way of persisting user preferences which involves storing them on some server somewhere. You could put it into the same database as your application's domain database, though it isn't a good excuse that "I'm already connecting to it." It may be a better implementation to have a separate Preferences database, or web-service, or whatever makes sense in your environment(s). Personally, I like the "web-service" approach, but that is 80% of what I do on a daily basis, so my preference (no pun intended) is biased.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.help
csiph-web