gnu.java.util.prefs
Class GConfBasedPreferences
This is a GConf based preference implementation which writes the preferences
as GConf key-value pairs. System Root is defined to be the
"/system"
directory of GConf for the current user, while User
Root is
"/apps/java"
. These defaults can be modified by
defining two system properties:
User Root:
gnu.java.util.prefs.gconf.user_root
and System Root:
gnu.java.util.prefs.gconf.system_root
protected AbstractPreferences | childSpi(String name) - Returns a child node with the given name.
|
protected String[] | childrenNamesSpi() - Returns an array of names of the children of this preference node.
|
void | flush() - Suggest a flush to the backend.
|
protected void | flushSpi() - Request a flush.
|
protected String | getSpi(String key) - Returns the value of the given key.
|
boolean | isUserNode() - Returns
true if this preference node is a user node,
false if is a system preference node.
|
protected String[] | keysSpi() - Returns all of the key in this preference node.
|
protected void | putSpi(String key, String value) - Stores the given key-value pair into this preference node.
|
protected void | removeNodeSpi() - Removes this preference node, including all its children.
|
protected void | removeSpi(String key) - Removes the given key from this preference node.
|
void | sync() - Suggest a sync to the backend.
|
protected void | syncSpi() - Request a sync.
|
absolutePath , addNodeChangeListener , addPreferenceChangeListener , cachedChildren , childSpi , childrenNames , childrenNamesSpi , clear , exportNode , exportSubtree , flush , flushSpi , get , getBoolean , getByteArray , getChild , getDouble , getFloat , getInt , getLong , getSpi , isRemoved , isUserNode , keys , keysSpi , name , node , nodeExists , parent , put , putBoolean , putByteArray , putDouble , putFloat , putInt , putLong , putSpi , remove , removeNode , removeNodeChangeListener , removeNodeSpi , removePreferenceChangeListener , removeSpi , sync , syncSpi , toString |
absolutePath , addNodeChangeListener , addPreferenceChangeListener , childrenNames , clear , exportNode , exportSubtree , flush , get , getBoolean , getByteArray , getDouble , getFloat , getInt , getLong , importPreferences , isUserNode , keys , name , node , nodeExists , parent , put , putBoolean , putByteArray , putDouble , putFloat , putInt , putLong , remove , removeNode , removeNodeChangeListener , removePreferenceChangeListener , sync , systemNodeForPackage , systemRoot , toString , userNodeForPackage , userRoot |
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
GConfBasedPreferences
public GConfBasedPreferences(boolean isUser)
Creates a preference root node. When isUser
is true it will
be user node otherwise it will be a system node.
GConfBasedPreferences
public GConfBasedPreferences(AbstractPreferences parent,
String name,
boolean isUser)
Creates a new preference node given a parent node and a name, which has to
be relative to its parent. When isUser
is true it will be user
node otherwise it will be a system node.
parent
- The parent node of this newly created node.name
- A name relative to the parent node.isUser
- Set to true
initializes this node to be
a user node, false
initialize it to be a system node.
childSpi
protected AbstractPreferences childSpi(String name)
Returns a child node with the given name.
If the child node does not exists, it will be created.
- childSpi in interface AbstractPreferences
name
- The name of the requested node.
- A new reference to the node, creating the node if it is necessary.
flush
public void flush()
throws BackingStoreException
Suggest a flush to the backend. Actually, this is only a suggestion as
GConf handles this for us asynchronously. More over, both sync and flush
have the same meaning in this class, so calling sync has exactly the same
effect.
- flush in interface AbstractPreferences
getSpi
protected String getSpi(String key)
Returns the value of the given key.
If the keys does not have a value, or there is an error in the backing
store, null
is returned instead.
- getSpi in interface AbstractPreferences
key
- The key to retrieve.
- The value associated with the given key.
isUserNode
public boolean isUserNode()
Returns true
if this preference node is a user node,
false
if is a system preference node.
- isUserNode in interface AbstractPreferences
true
if this preference node is a user node,
false
if is a system preference node.
putSpi
protected void putSpi(String key,
String value)
Stores the given key-value pair into this preference node.
- putSpi in interface AbstractPreferences
key
- The key of this preference.value
- The value of this preference.
sync
public void sync()
throws BackingStoreException
Suggest a sync to the backend. Actually, this is only a suggestion as GConf
handles this for us asynchronously. More over, both sync and flush have the
same meaning in this class, so calling flush has exactly the same effect.
- sync in interface AbstractPreferences
BackingStoreException
- if this operation cannot be completed due to
a failure in the backing store, or inability to communicate with
it.
GConfBasedPreferences.java -- GConf based Preferences implementation
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.