admin@glassfish.java.net

Re: Preferences API

From: Ken Paulsen <Ken.Paulsen_at_Sun.COM>
Date: Thu, 21 Aug 2008 16:51:46 -0700

I decided to see how hard it was to define a new backing store... it's
not. See attached .jar file w/
META-INF/services/java.util.prefs.PreferencesFactory file, which points
to the Preferences Factory. The factory instantiates the
"MyPreferences" object, which controls where how preferences are
persisted and all other features. My impl simply stores the data in
HashMaps and does not bother to persist anything or worry about
synchronization. It does demonstrate that the default behavior of
writing to the register or filesystem does NOT happen.

To run:

    1) Copy KensPrefs.jar and Pref.class into "."
    2) java -classpath KensPrefs.jar:. Pref add foo bar

You can omit the "-classpath KensPrefs.jar" part to see the "default"
behavior which will persist the info in your ~/.java/.userPrefs/*
directory (or windows registry on windows -- possibly another location
on other OS's).

Thanks,

Ken

Ken Paulsen wrote:
>
> +1
>
> Kedar, Lloyd, Byron, (others?): perhaps we can organize a meeting to
> discuss this? I can meet tomorrow afternoon or anytime Monday. After
> that I'm out for a week.
>
> Ken
>
> Bill Shannon wrote:
>> Kedar Mhaswade wrote:
>>> Hi Ken,
>>>
>>> Ah, right, we need an enterprise equivalent of Java Preferences API,
>>> rather than inventing our own. I don't think either Java EE or
>>> GlassFish
>>> provides this although I imagine we need an implementation of the
>>> Preferences API in enterprise case rather than having a completely new
>>> API.
>>>
>>> TSS had this article in this regard:
>>> http://www.theserverside.com/news/thread.tss?thread_id=47886
>>>
>>> Maybe we can leverage what they have done?
>>
>> I've wanted to add something like this as a requirement for Java EE,
>> but it just hasn't been important enough so far. I'd love it if we
>> could experiment with this in GlassFish and add it as a requirement
>> in a future version of Java EE.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>