ConfClient provides a client-side cache for a specified list of directories
your're interested in. You can preload entire directories into cache to
enhance performance. It also provides events when a value changes.
addDirectory
public void addDirectory(String dir,
ConfClientPreloadType type)
throws ConfException
Add a directory to the list of directories the ConfClient will watch. Any
changes to keys below this directory will cause the "value_changed" event
to be fired.
clearCache
public void clearCache()
If you know you're done reading values for a while you can blow away the
cache. Note that this nullifies the effect of any preloading you may have
done. However it frees some memory.
dirExists
public boolean dirExists(String dir)
throws ConfException
Check to see if a directory exists in the GConf database.
getAllDirs
public List getAllDirs(String dir)
throws ConfException
Get a list of the subdirectories in the provided directory.
getAllEntries
public List getAllEntries(String dir)
throws ConfException
Get a list of all ConfEntries in the provided direcotry.
getBoolean
public boolean getBoolean(String key)
throws ConfException
Request the boolean value stored at the provided key.
getDefaultFromSchema
public ConfValue getDefaultFromSchema(String key)
throws ConfException
Return the default value stored in the key's schema, if the key has a
schema associated and the schema exists and the schema contains a default
value.
getDouble
public double getDouble(String key)
throws ConfException
Request the double value stored at the provided key.
getEntry
public ConfEntry getEntry(String key,
String locale,
boolean useSchemaDefault)
throws ConfException
Obtain the full ConfEntry for a value.
key
- locale
- useSchemaDefault
-
getInstance
public static ConfClient getInstance()
Method to get the default ConfClient
getInt
public int getInt(String key)
throws ConfException
Request the int value stored at the provided key.
getList
public Object[] getList(String key,
ConfValueType listType)
throws ConfException
Request the object array stored at the key. The return object array is of
the type provided.
getSchema
public ConfSchema getSchema(String key)
throws ConfException
Request the ConfSchema value stored at the provided key.
getString
public String getString(String key)
throws ConfException
Request the String value stored at the provided key.
notifyCallback
public void notifyCallback()
preload
public void preload(String directory,
ConfClientPreloadType type)
throws ConfException
Preload a directory. The directory must have been added already. This is
only useful as an optimization if you clear the cache, then later want to
do a lot a reads again.
directory
- The directory to loadtype
- How to preload the directory.
removeDirectory
public void removeDirectory(String dir)
throws ConfException
Remove a directory from the list created with addDirectory.
removeListener
public void removeListener(ConfClientListener listener,
String nameSpace)
Removes a listener.
setBoolean
public boolean setBoolean(String key,
boolean value)
throws ConfException
Change the value stored at the provided key to the provided boolean
value.
setDouble
public boolean setDouble(String key,
double value)
throws ConfException
Change the value stored at the provided key to the provided double value.
setInt
public boolean setInt(String key,
int value)
throws ConfException
Change the value stored at the provided key to the provided int value.
setSchema
public boolean setSchema(String key,
ConfSchema value)
throws ConfException
Change the value stored at the provided key to the provided ConfSchema
value.
setString
public boolean setString(String key,
String value)
throws ConfException
Change the value stored at the provided key to the provided String value.
suggestSync
public void suggestSync()
throws ConfException
Suggest to gconfd that you've just finished a block of changes and it
would be an optimal time to sync to permanent storage.
unset
public boolean unset(String key)
throws ConfException
Unsets the value of the provided key.