Build 1.0_r1(from source)

java.util.prefs
Class FilePreferencesImpl

java.lang.Object
  extended by java.util.prefs.Preferences
      extended by java.util.prefs.AbstractPreferences
          extended by java.util.prefs.FilePreferencesImpl

 class FilePreferencesImpl
extends AbstractPreferences

Default implementation of AbstractPreferences for Linux platform, using file system as back end. TODO some sync mechanism with backend, Performance - check file edit date

Since:
1.4

Field Summary
 
Fields inherited from class java.util.prefs.AbstractPreferences
lock, newNode, userNode
 
Fields inherited from class java.util.prefs.Preferences
MAX_KEY_LENGTH, MAX_NAME_LENGTH, MAX_VALUE_LENGTH
 
Constructor Summary
FilePreferencesImpl(boolean userNode)
          Construct root FilePreferencesImpl instance, construct user root if userNode is true, system root otherwise
 
Method Summary
protected  String[] childrenNamesSpi()
          Return names of this node's all children , or empty array if this node has no child.
protected  AbstractPreferences childSpi(String name)
          Return the child preference node with the given name, and create new one if it does not exist.
protected  void flushSpi()
          Flush changes of this node to the backing store.
protected  String getSpi(String key)
          Get the preference value mapped to the given key.
protected  String[] keysSpi()
          Return all keys of this node's preferences, or empty array if no preference found on this node.
protected  void putSpi(String name, String value)
          Put the given key-value pair into this node.
protected  void removeNodeSpi()
          Remove this node from the preference hierarchy tree.
protected  void removeSpi(String key)
          Remove the preference with the given key.
protected  void syncSpi()
          Synchronize this node with the backing store.
 
Methods inherited from class java.util.prefs.AbstractPreferences
absolutePath, addNodeChangeListener, addPreferenceChangeListener, cachedChildren, childrenNames, clear, exportNode, exportSubtree, flush, get, getBoolean, getByteArray, getChild, getDouble, getFloat, getInt, getLong, isRemoved, isUserNode, keys, name, node, nodeExists, parent, put, putBoolean, putByteArray, putDouble, putFloat, putInt, putLong, remove, removeNode, removeNodeChangeListener, removePreferenceChangeListener, sync, toString
 
Methods inherited from class java.util.prefs.Preferences
importPreferences, systemNodeForPackage, systemRoot, userNodeForPackage, userRoot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FilePreferencesImpl

FilePreferencesImpl(boolean userNode)
Construct root FilePreferencesImpl instance, construct user root if userNode is true, system root otherwise

Method Detail

childrenNamesSpi

protected String[] childrenNamesSpi()
                             throws BackingStoreException
Description copied from class: AbstractPreferences
Return names of this node's all children , or empty array if this node has no child. Cached children name is not required to be returned.

Specified by:
childrenNamesSpi in class AbstractPreferences
Returns:
names of this node's all children
Throws:
BackingStoreException - if backing store is unavailable or causes operation failure

childSpi

protected AbstractPreferences childSpi(String name)
Description copied from class: AbstractPreferences
Return the child preference node with the given name, and create new one if it does not exist. Invoker of this method should assure that the given name are valid as well as this node is not removed. Invocation of this method implies that the node with given name is not cached(or, has been removed.) If the named node has just been removed, implementation of this method must create a new one instead of reactivated the removed one.

The new creation is not required to be persisted immediately until the flush method is invoked.

Specified by:
childSpi in class AbstractPreferences
Returns:
AbstractPreferences

flushSpi

protected void flushSpi()
                 throws BackingStoreException
Description copied from class: AbstractPreferences
Flush changes of this node to the backing store. This method should only flush this node, and should not include the descendant nodes. The implementation which want to flush all nodes at once should override flush() method.

Specified by:
flushSpi in class AbstractPreferences
Throws:
BackingStoreException - if backing store is unavailable or causes operation failure

getSpi

protected String getSpi(String key)
Description copied from class: AbstractPreferences
Get the preference value mapped to the given key. Invoker of this method should assure that given key are valid as well as this node is not removed. This method should not throw exceptions, but if it does, the invoker should catch it and deal with it as null return value.

Specified by:
getSpi in class AbstractPreferences
Parameters:
key - the given key to be searched for
Returns:
the preference value mapped to the given key

keysSpi

protected String[] keysSpi()
                    throws BackingStoreException
Description copied from class: AbstractPreferences
Return all keys of this node's preferences, or empty array if no preference found on this node. Invoker of this method should assure that this node is not removed.

Specified by:
keysSpi in class AbstractPreferences
Returns:
all keys of this node's preferences
Throws:
BackingStoreException - if backing store is unavailable or causes operation failure

putSpi

protected void putSpi(String name,
                      String value)
Description copied from class: AbstractPreferences
Put the given key-value pair into this node. Invoker of this method should assure that both the given values are valid as well as this node is not removed.

Specified by:
putSpi in class AbstractPreferences
Parameters:
name - the given preference key
value - the given preference value

removeNodeSpi

protected void removeNodeSpi()
                      throws BackingStoreException
Description copied from class: AbstractPreferences
Remove this node from the preference hierarchy tree. The invoker of this method should assure that this node has no child node, which means the Preferences.removeNode() should invoke this method multi-times in bottom-up pattern. The removal is not required to be persisted at once until the it is flushed.

Specified by:
removeNodeSpi in class AbstractPreferences
Throws:
BackingStoreException - if backing store is unavailable or causes operation failure

removeSpi

protected void removeSpi(String key)
Description copied from class: AbstractPreferences
Remove the preference with the given key. Invoker of this method should assure that given key are valid as well as this node is not removed.

Specified by:
removeSpi in class AbstractPreferences
Parameters:
key - the given key to removed

syncSpi

protected void syncSpi()
                throws BackingStoreException
Description copied from class: AbstractPreferences
Synchronize this node with the backing store. This method should only synchronize this node, and should not include the descendant nodes. The implementation which want to synchronize all nodes at once should override sync() method.

Specified by:
syncSpi in class AbstractPreferences
Throws:
BackingStoreException - if backing store is unavailable or causes operation failure

Build 1.0_r1(from source)

Please submit a feedback, bug or feature