org.fuin.utils4j
Class PropertiesFilePreferences

java.lang.Object
  extended by java.util.prefs.Preferences
      extended by java.util.prefs.AbstractPreferences
          extended by org.fuin.utils4j.PropertiesFilePreferences

public final class PropertiesFilePreferences
extends AbstractPreferences

A directory and PropertiesFile based Preferences API implementation.


Field Summary
static String FILENAME
          Filename the properties of this node are stored under.
 
Fields inherited from class java.util.prefs.AbstractPreferences
lock, newNode
 
Fields inherited from class java.util.prefs.Preferences
MAX_KEY_LENGTH, MAX_NAME_LENGTH, MAX_VALUE_LENGTH
 
Constructor Summary
PropertiesFilePreferences(File dir)
          Constructor with directory.
PropertiesFilePreferences(PropertiesFilePreferences parent, File dir)
          Constructor with parent node and directory.
 
Method Summary
protected  String[] childrenNamesSpi()
          
protected  AbstractPreferences childSpi(String name)
          
protected  void flushSpi()
          
protected  String getSpi(String key)
          
protected  String[] keysSpi()
          
protected  void putSpi(String key, String value)
          
protected  void removeNodeSpi()
          
protected  void removeSpi(String key)
          
protected  void syncSpi()
          
 Properties toProperties()
          Returns a copy of all properties.
 
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
 

Field Detail

FILENAME

public static final String FILENAME
Filename the properties of this node are stored under.

See Also:
Constant Field Values
Constructor Detail

PropertiesFilePreferences

public PropertiesFilePreferences(File dir)
Constructor with directory. This is constructing the "root" node.

Parameters:
dir - Directory where the preferences are stored.

PropertiesFilePreferences

public PropertiesFilePreferences(PropertiesFilePreferences parent,
                                 File dir)
Constructor with parent node and directory.

Parameters:
parent - Parent node.
dir - Directory where the preferences are stored.
Method Detail

childSpi

protected final AbstractPreferences childSpi(String name)

Specified by:
childSpi in class AbstractPreferences

childrenNamesSpi

protected final String[] childrenNamesSpi()
                                   throws BackingStoreException

Specified by:
childrenNamesSpi in class AbstractPreferences
Throws:
BackingStoreException

flushSpi

protected void flushSpi()
                 throws BackingStoreException

Specified by:
flushSpi in class AbstractPreferences
Throws:
BackingStoreException

getSpi

protected final String getSpi(String key)

Specified by:
getSpi in class AbstractPreferences

keysSpi

protected final String[] keysSpi()
                          throws BackingStoreException

Specified by:
keysSpi in class AbstractPreferences
Throws:
BackingStoreException

putSpi

protected final void putSpi(String key,
                            String value)

Specified by:
putSpi in class AbstractPreferences

removeNodeSpi

protected final void removeNodeSpi()
                            throws BackingStoreException

Specified by:
removeNodeSpi in class AbstractPreferences
Throws:
BackingStoreException

removeSpi

protected final void removeSpi(String key)

Specified by:
removeSpi in class AbstractPreferences

syncSpi

protected final void syncSpi()
                      throws BackingStoreException

Specified by:
syncSpi in class AbstractPreferences
Throws:
BackingStoreException

toProperties

public final Properties toProperties()
Returns a copy of all properties.

Returns:
All key/values without deleted ones.


Copyright © 2011 Future Invent Informationsmanagement GmbH. All Rights Reserved.