Return-Path: Delivered-To: apmail-harmony-dev-archive@www.apache.org Received: (qmail 30371 invoked from network); 31 Dec 2008 05:32:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 31 Dec 2008 05:32:12 -0000 Received: (qmail 91258 invoked by uid 500); 31 Dec 2008 05:32:08 -0000 Delivered-To: apmail-harmony-dev-archive@harmony.apache.org Received: (qmail 91232 invoked by uid 500); 31 Dec 2008 05:32:08 -0000 Mailing-List: contact dev-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list dev@harmony.apache.org Received: (qmail 91217 invoked by uid 99); 31 Dec 2008 05:32:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Dec 2008 21:32:08 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of nbeyer@gmail.com designates 209.85.217.10 as permitted sender) Received: from [209.85.217.10] (HELO mail-gx0-f10.google.com) (209.85.217.10) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Dec 2008 05:32:01 +0000 Received: by gxk3 with SMTP id 3so4421758gxk.12 for ; Tue, 30 Dec 2008 21:31:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=nS4bsUMeKUmtIn9bGt96gQCYkmiT96N1ELeb0S6qALU=; b=sk5lzkpElEItK5yFSjY7CIKdYQaleTIxvaQcqJ2I9KfpanyUBsjZP/INUMiE6uM/1C oz/QjOhsPDvGPK2A+7FFO+2JwPPrnFmFRCppGwp3hp19Lezy69am0Q4jTu5V9EI+ncF4 8DBPnDO9qxHmDjBYLKP1DxmcYqWcp9NayVUXM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=roSWwzUynnB+J9YRRg/vPTGPagIRujwpEUVp9b7deJkg8eXziYJk+BRx3dJs5qHdGb kr3ia9ORfwgIv8kDAmKkNRnIGePUvVyp1Psuj0fZCfNu4NbsxpREVHpQDS7KtPsj8J++ 5oTU1rvfiNZ2tpwWge/ewN92B+OkVgOg2iLqM= Received: by 10.65.44.11 with SMTP id w11mr11976893qbj.58.1230701500809; Tue, 30 Dec 2008 21:31:40 -0800 (PST) Received: by 10.65.73.19 with HTTP; Tue, 30 Dec 2008 21:31:40 -0800 (PST) Message-ID: <3b3f27c60812302131i503df6aax398c72322dec4710@mail.gmail.com> Date: Tue, 30 Dec 2008 23:31:40 -0600 From: "Nathan Beyer" To: dev@harmony.apache.org Subject: Re: [classlib][prefs] default provider of prefs In-Reply-To: <5948b71e0812301718n7371c522td910303120d7f718@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4959F70B.7080504@gmail.com> <3b3f27c60812300737o2940a2dkdd219bd8b04eb9d9@mail.gmail.com> <5948b71e0812301718n7371c522td910303120d7f718@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org 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 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 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 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 >