harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Beyer" <nbe...@gmail.com>
Subject Re: [classlib][prefs] default provider of prefs
Date Wed, 31 Dec 2008 05:31:40 GMT
That wasn't what was asked, nor was that what I commented about,
unless I'm missing something. What does putting the platform default
into native code have to do with the order of service provider load?

Any reason the algorithm can't be implemented all in Java with the
following steps.
1. Check System Property, if set, construct; if not set or failure, do step 2
2. Check SPI files, if available, load, construct, etc; if not set or
all fail, do step 3
3. Determine OS, load OS-specific provider

I haven't looked at the code yet - is the code setting the system
property to communicate the classname?

-Nathan

On Tue, Dec 30, 2008 at 7:18 PM, Charles Lee <littlee1032@gmail.com> wrote:
> Hi Nathan,Prefs has its priority list to load a factory builder. The first
> priority is System Property, the second is service info in any jar file, and
> the last the is platform default.
> If we have set the platform default value to the System Property in the luni
> before the prefs's constructor, that will make platform default be the first
> priority. And user can not specify the factory builder by service info in
> the jar file.
>
> On Tue, Dec 30, 2008 at 11:37 PM, Nathan Beyer <ndbeyer@apache.org> wrote:
>
>> I doubt there is any significant reason for it other than the default
>> is based on the OS and the native might have been an easy decision
>> point.
>>
>> Moving it to Java code is probably fine - the code just needs to use a
>> default based on the OS.
>>
>> -Nathan
>>
>> On Tue, Dec 30, 2008 at 4:25 AM, Regis <xu.regis@gmail.com> wrote:
>> > Hi,
>> >
>> > The provider of prefs is controlled by the property
>> > "java.util.prefs.PreferencesFactory" in Harmony, and we also have
>> different
>> > default values for it on Linux and Windows, but the default values are
>> set
>> > in luni module at modules/luni/src/main/native/luni/shared/luniglob.c,
>> > are there any special concerns that we must do it in luni native code? Or
>> is
>> > it possible set it in prefs module with java code, like this:
>> >
>> >         if (factoryClassName == null) {
>> >             if (isWindows) {
>> >                 factoryClassName =
>> > "java.util.prefs.RegistryPreferencesFactoryImpl";
>> >             } else {
>> >                 factoryClassName =
>> > "java.util.prefs.FilePreferencesFactoryImpl";
>> >             }
>> >         }
>> >
>> > I think there must be a way to get current platform at runtime in java.
>> >
>> > --
>> > Best Regards,
>> > Regis.
>> >
>>
>
>
>
> --
> Yours sincerely,
> Charles Lee
> China Software Development Lab, IBM
>

Mime
View raw message