This patch makes the gconf backend the default. The configure part of the patch is the same as the one discussed early, but now the backend name is stored under META-INF and loaded at runtime using ServiceFactory.
A new file is introduced in the META-INF directory that is used to build the actual real resource file, so there is a change in copy-vmresources.sh to avoid the copy of this new file into the meta directory. The Makefile.am in the lib directory also reflects this change. 2006-07-02 Mario Torre <[EMAIL PROTECTED]> * configure.ac: Added new option --enable-default-preferences-peer to pass user specified default preference backend. If the GConf peer is built, GConf become the default backend. * resource/META-INF/services/java.util.prefs.PreferencesFactory.in: new file. * lib/Makefile.am: excludes files terminating in 'in' from the metafiles list. * lib/copy-vmresources.sh.in: excludes files terminating in 'in' from copy into META-INF. * java/util/prefs/Preferences.java: added two new import classes gnu.classpath.ServiceFactory and java.util.Iterator. (getFactory): Now try to check for a system defined default preference backend before to fall back on FileBasedPreference. -- Lima Software, SO.PR.IND. s.r.l. http://www.limasoftware.net/ pgp key: http://subkeys.pgp.net/ Please, support open standards: http://opendocumentfellowship.org/petition/ http://www.nosoftwarepatents.com/
Index: configure.ac =================================================================== RCS file: /sources/classpath/classpath/configure.ac,v retrieving revision 1.168 diff -u -r1.168 configure.ac --- configure.ac 30 Jun 2006 11:39:15 -0000 1.168 +++ configure.ac 2 Jul 2006 21:45:09 -0000 @@ -83,6 +83,18 @@ AM_CONDITIONAL(CREATE_CORE_JNI_LIBRARIES, test "x${COMPILE_CORE_JNI}" = xyes) dnl ----------------------------------------------------------- +dnl Default Preference Backend +dnl ----------------------------------------------------------- +AC_ARG_ENABLE(default-preferences-peer, + AS_HELP_STRING([--enable-default-preferences-peer], + [fully qualified class name of default Preferences API Backend])) +DEFAULT_PREFS_PEER=$enable_default_preferences_peer +if test "$DEFAULT_PREFS_PEER" = ""; then + DEFAULT_PREFS_PEER=gnu.java.util.prefs.FileBasedFactory +fi +dnl AC_SUBST(DEFAULT_PREFS_PEER) + +dnl ----------------------------------------------------------- dnl GConf native peer (enabled by default) dnl ----------------------------------------------------------- AC_ARG_ENABLE([gconf-peer], @@ -100,7 +112,6 @@ dnl ----------------------------------------------------------- AC_ARG_ENABLE([gconf-peers],,AC_MSG_ERROR([No --enable-gconf-peers (or --disable-gconf-peers) option; you want --enable-gconf-peer])) - dnl ------------------------------------------------------------ dnl Whether to compile with -Werror or not (disabled by default) dnl ------------------------------------------------------------ @@ -456,6 +467,13 @@ PKG_CHECK_MODULES(GCONF, gconf-2.0 >= 2.11.2) AC_SUBST(GCONF_CFLAGS) AC_SUBST(GCONF_LIBS) + dnl check if the config value was given form the command line, + dnl if not, overwrite the default if we have the gconf backend + dnl compiled in + USE_GCONF_PREFS_PEER=$enable_default_preferences_peer + if test "$USE_GCONF_PREFS_PEER" = ""; then + DEFAULT_PREFS_PEER=gnu.java.util.prefs.GConfBasedFactory + fi fi dnl Check for AWT related Qt4 @@ -745,6 +763,10 @@ fi AM_CONDITIONAL(ENABLE_LOCAL_SOCKETS, test "x$ENABLE_LOCAL_SOCKETS" = "xyes") +dnl ----------------------------------------------------------- +dnl Add the default preference peer +dnl ----------------------------------------------------------- +AC_SUBST(DEFAULT_PREFS_PEER) dnl ----------------------------------------------------------- dnl output files @@ -780,6 +802,7 @@ native/target/Linux/Makefile native/target/generic/Makefile resource/Makefile +resource/META-INF/services/java.util.prefs.PreferencesFactory scripts/Makefile scripts/classpath.spec lib/Makefile Index: java/util/prefs/Preferences.java =================================================================== RCS file: /sources/classpath/classpath/java/util/prefs/Preferences.java,v retrieving revision 1.14 diff -u -r1.14 Preferences.java --- java/util/prefs/Preferences.java 1 Mar 2006 17:10:18 -0000 1.14 +++ java/util/prefs/Preferences.java 2 Jul 2006 21:45:18 -0000 @@ -37,6 +37,7 @@ package java.util.prefs; +import gnu.classpath.ServiceFactory; import gnu.java.util.prefs.NodeReader; import java.io.IOException; @@ -45,6 +46,7 @@ import java.security.AccessController; import java.security.Permission; import java.security.PrivilegedAction; +import java.util.Iterator; /** * Preference node containing key value entries and subnodes. @@ -205,6 +207,17 @@ } }); + // Still no factory? Try to see if we have one defined + // as a System Preference + if (factory == null) + { + Iterator iter = ServiceFactory.lookupProviders + (PreferencesFactory.class, null); + + if (iter != null && iter.hasNext()) + factory = (PreferencesFactory) iter.next(); + } + // Still no factory? Use our default. if (factory == null) { Index: lib/Makefile.am =================================================================== RCS file: /sources/classpath/classpath/lib/Makefile.am,v retrieving revision 1.122 diff -u -r1.122 Makefile.am --- lib/Makefile.am 30 Jun 2006 11:39:15 -0000 1.122 +++ lib/Makefile.am 2 Jul 2006 21:45:21 -0000 @@ -7,7 +7,7 @@ propertydirs := $(shell cd $(top_srcdir)/resource && $(FIND) gnu java javax org META-INF -type d ! -name CVS -print) propertyfiles := $(shell cd $(top_srcdir)/resource && $(FIND) gnu java javax org -name \*\.properties -print) -metafiles := $(shell cd $(top_srcdir)/resource && $(FIND) META-INF -name CVS -prune -o -type f -print) +metafiles := $(shell cd $(top_srcdir)/resource && $(FIND) META-INF -name CVS -prune -o -name \*\.in -prune -o -type f -print) iconfiles := $(shell cd $(top_srcdir) && $(FIND) gnu/javax/swing/plaf/gtk/icons -name *.png -type f -print) compile_classpath = $(vm_classes):$(top_srcdir):$(top_srcdir)/external/w3c_dom:$(top_srcdir)/external/sax:$(top_srcdir)/external/relaxngDatatype:.:$(USER_CLASSLIB):$(PATH_TO_ESCHER) Index: lib/copy-vmresources.sh.in =================================================================== RCS file: /sources/classpath/classpath/lib/copy-vmresources.sh.in,v retrieving revision 1.4 diff -u -r1.4 copy-vmresources.sh.in --- lib/copy-vmresources.sh.in 17 Dec 2005 22:56:37 -0000 1.4 +++ lib/copy-vmresources.sh.in 2 Jul 2006 21:45:21 -0000 @@ -13,7 +13,7 @@ for u in ${dirs}; do mkdir -p ${destMetaDir}/${u}; done; - files=`find . -name "CVS" -prune -o -type f -print`; + files=`find . -name "CVS" -prune -o -name "*.in" -prune -o -type f -print`; for u in ${files}; do cp ${u} ${destMetaDir}/${u}; done Index: resource/META-INF/services/java.util.prefs.PreferencesFactory.in =================================================================== RCS file: resource/META-INF/services/java.util.prefs.PreferencesFactory.in diff -N resource/META-INF/services/java.util.prefs.PreferencesFactory.in --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ resource/META-INF/services/java.util.prefs.PreferencesFactory.in 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,1 @@ [EMAIL PROTECTED]@
signature.asc
Description: Questa รจ una parte del messaggio firmata digitalmente