gnu.java.util.prefs.gconf

Class GConfNativePeer


public final class GConfNativePeer
extends Object

Native peer for GConf based preference backend.

Constructor Summary

GConfNativePeer()
Creates a new instance of GConfNativePeer

Method Summary

protected void
finalize()
protected static void
gconf_client_add_dir(String node)
Adds the given node to the list of nodes that GConf watches for changes.
protected static boolean
gconf_client_dir_exists(String node)
Queries the GConf database to see if the given node exists, returning true if the node exist, false otherwise.
protected static List
gconf_client_gconf_client_all_keys(String node)
Returns a list of all keys stored in the given node.
protected static List
gconf_client_gconf_client_all_nodes(String node)
Returns a list of all nodes under the given node.
protected static String
gconf_client_get_string(String key)
Returns the key associated to the given key.
protected static void
gconf_client_remove_dir(String node)
Removes the given node from the list of nodes that GConf watches for changes.
protected static boolean
gconf_client_set_string(String key, String value)
Sets the given key/value pair into the GConf database.
protected static void
gconf_client_suggest_sync()
Suggest to the GConf native peer a sync with the database.
protected static boolean
gconf_client_unset(String key)
Usets the given key, removing the key from the database.
List
getChildrenNodes(String node)
Lists the subnodes in node.
String
getKey(String key)
Gets the value of a configuration key.
List
getKeys(String node)
Lists the key in the given node.
boolean
nodeExist(String node)
Queries whether the node node exists in theGConf database.
boolean
setString(String key, String value)
Change the value of key to val.
void
startWatchingNode(String node)
Add the node node to the list of nodes the GConf will watch.
void
stopWatchingNode(String node)
Remove the node node to the list of nodes the GConf is watching.
void
suggestSync()
Suggest to the backend GConf daemon to synch with the database.
boolean
unset(String key)
Unsets the value of key; if key is already unset, has no effect.

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

GConfNativePeer

public GConfNativePeer()
Creates a new instance of GConfNativePeer

Method Details

finalize

protected void finalize()
            throws Throwable
Overrides:
finalize in interface Object

gconf_client_add_dir

protected static final void gconf_client_add_dir(String node)
Adds the given node to the list of nodes that GConf watches for changes.
Parameters:
node - the node to watch for changes.

gconf_client_dir_exists

protected static final boolean gconf_client_dir_exists(String node)
Queries the GConf database to see if the given node exists, returning true if the node exist, false otherwise.
Parameters:
node - the node to query for existence.
Returns:
true if the node exist, false otherwise.

gconf_client_gconf_client_all_keys

protected static final List gconf_client_gconf_client_all_keys(String node)
Returns a list of all keys stored in the given node.
Parameters:
node - the source node.
Returns:
A list of all keys stored in the given node.

gconf_client_gconf_client_all_nodes

protected static final List gconf_client_gconf_client_all_nodes(String node)
Returns a list of all nodes under the given node.
Parameters:
node - the source node.
Returns:
A list of nodes under the given source node.

gconf_client_get_string

protected static final String gconf_client_get_string(String key)
Returns the key associated to the given key. Null is returned if the key is not valid.
Parameters:
key - the key to return the value of.
Returns:
The value associated to the given key, or null.

gconf_client_remove_dir

protected static final void gconf_client_remove_dir(String node)
Removes the given node from the list of nodes that GConf watches for changes.
Parameters:
node - the node to remove from from the list of watched nodes.

gconf_client_set_string

protected static final boolean gconf_client_set_string(String key,
                                                       String value)
Sets the given key/value pair into the GConf database. The key must be a valid GConf key.
Parameters:
key - the key to store in the GConf database
value - the value to associate to the given key.
Returns:
true if the change has effect, false otherwise.

gconf_client_suggest_sync

protected static final void gconf_client_suggest_sync()
Suggest to the GConf native peer a sync with the database.

gconf_client_unset

protected static final boolean gconf_client_unset(String key)
Usets the given key, removing the key from the database.
Parameters:
key - the key to remove.
Returns:
true if the operation success, false otherwise.

getChildrenNodes

public List getChildrenNodes(String node)
            throws BackingStoreException
Lists the subnodes in node. The returned list contains allocated strings. Each string is the name relative tho the given node.
Parameters:
node - the node to get subnodes from. If there are no subnodes in the given node, a list of size 0 is returned.

getKey

public String getKey(String key)
Gets the value of a configuration key.
Parameters:
key - the configuration key.
Returns:
the values of this key, null if the key is not valid.

getKeys

public List getKeys(String node)
            throws BackingStoreException
Lists the key in the given node. Does not list subnodes. Keys names are the stripped names (name relative to the current node) of the keys stored in this node.
Parameters:
node - the node where keys are stored.
Returns:
a java.util.List of keys. If there are no keys in the given node, a list of size 0 is returned.

nodeExist

public boolean nodeExist(String node)
Queries whether the node node exists in theGConf database. Returns true or false.
Parameters:
node - the node to check.

setString

public boolean setString(String key,
                         String value)
Change the value of key to val. Automatically creates the key if it didn't exist before (ie it was unset or it only had a default value). Key names must be valid GConf key names, that is, there can be more restrictions than for normal Preference Backend.
Parameters:
key - the key to alter (or add).
value - the new value for this key.
Returns:
true if the key was updated, false otherwise.

startWatchingNode

public void startWatchingNode(String node)
Add the node node to the list of nodes the GConf will watch. An event is raised everytime this node is changed. You can add a node multiple times.
Parameters:
node - the node to track.

stopWatchingNode

public void stopWatchingNode(String node)
Remove the node node to the list of nodes the GConf is watching. Note that if a node has been added multiple times, you must remove it the same number of times before the remove takes effect.
Parameters:
node - the node you don't want to track anymore.

suggestSync

public void suggestSync()
            throws BackingStoreException
Suggest to the backend GConf daemon to synch with the database.

unset

public boolean unset(String key)
Unsets the value of key; if key is already unset, has no effect. Depending on the GConf daemon, unsetting a key may have the side effect to remove it completely form the database.
Parameters:
key - the key to unset.
Returns:
true on success, false if the key was not updated.

GConfNativePeer.java -- GConf based preference peer for native methods 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.