diff options
author | Mark Wielaard <mark@klomp.org> | 2006-07-04 07:25:44 +0000 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2006-07-04 07:25:44 +0000 |
commit | e8300a31ab3b898fb656e5be1956cd41d0d49bda (patch) | |
tree | 18754a915a39fc8b52ec48e1af8b17914d8a7880 | |
parent | 9fcf2d2352094b519bf39c483e5b72206da76eed (diff) | |
download | classpath-e8300a31ab3b898fb656e5be1956cd41d0d49bda.tar.gz |
2006-07-04 Mario Torre <neugens@limasoftware.net>
* 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.
-rw-r--r-- | ChangeLog | 17 | ||||
-rw-r--r-- | configure.ac | 25 | ||||
-rw-r--r-- | java/util/prefs/Preferences.java | 13 | ||||
-rw-r--r-- | lib/Makefile.am | 2 | ||||
-rw-r--r-- | lib/copy-vmresources.sh.in | 2 | ||||
-rw-r--r-- | resource/META-INF/services/java.util.prefs.PreferencesFactory.in | 1 |
6 files changed, 57 insertions, 3 deletions
@@ -1,3 +1,20 @@ +2006-07-04 Mario Torre <neugens@limasoftware.net> + + * 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. + 2006-07-04 Audrius Meskauskas <AudriusA@Bioinformatics.org> PR 28061 diff --git a/configure.ac b/configure.ac index 3345130f7..865b238cc 100644 --- a/configure.ac +++ b/configure.ac @@ -83,6 +83,18 @@ AC_ARG_ENABLE([core-jni], 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 GTK native peer error checking 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 @@ if test "x${COMPILE_JNI}" = xyes; then 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 @@ then 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/Makefile 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 diff --git a/java/util/prefs/Preferences.java b/java/util/prefs/Preferences.java index a78381bfa..297759d88 100644 --- a/java/util/prefs/Preferences.java +++ b/java/util/prefs/Preferences.java @@ -37,6 +37,7 @@ exception statement from your version. */ package java.util.prefs; +import gnu.classpath.ServiceFactory; import gnu.java.util.prefs.NodeReader; import java.io.IOException; @@ -45,6 +46,7 @@ import java.io.OutputStream; 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 @@ public abstract class Preferences { } }); + // 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) { diff --git a/lib/Makefile.am b/lib/Makefile.am index 31dd36aeb..3ec14890e 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -7,7 +7,7 @@ sinclude $(JAVA_DEPEND) 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) diff --git a/lib/copy-vmresources.sh.in b/lib/copy-vmresources.sh.in index 39b3292e7..dbda9de20 100644 --- a/lib/copy-vmresources.sh.in +++ b/lib/copy-vmresources.sh.in @@ -13,7 +13,7 @@ for p in ${vmdirs}; do 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 diff --git a/resource/META-INF/services/java.util.prefs.PreferencesFactory.in b/resource/META-INF/services/java.util.prefs.PreferencesFactory.in new file mode 100644 index 000000000..b9465ce54 --- /dev/null +++ b/resource/META-INF/services/java.util.prefs.PreferencesFactory.in @@ -0,0 +1 @@ +@DEFAULT_PREFS_PEER@ |