com.sun.electric.tool.sandbox
Class DummyPreferences

java.lang.Object
  extended by java.util.prefs.Preferences
      extended by java.util.prefs.AbstractPreferences
          extended by com.sun.electric.tool.sandbox.DummyPreferences

public class DummyPreferences
extends java.util.prefs.AbstractPreferences

Dummy implementation of Preferebces class.


Field Summary
 
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
protected DummyPreferences(java.util.prefs.AbstractPreferences parent, java.lang.String name)
          Creates a new instance of MyPrefernces
 
Method Summary
protected  java.lang.String[] childrenNamesSpi()
          Returns the names of the children of this preference node.
protected  java.util.prefs.AbstractPreferences childSpi(java.lang.String name)
          Returns the named child of this preference node, creating it if it does not already exist.
protected  void flushSpi()
          This method is invoked with this node locked.
protected  java.lang.String getSpi(java.lang.String key)
          Return the value associated with the specified key at this preference node, or null if there is no association for this key, or the association cannot be determined at this time.
protected  java.lang.String[] keysSpi()
          Returns all of the keys that have an associated value in this preference node.
protected  void putSpi(java.lang.String key, java.lang.String value)
          Put the given key-value association into this preference node.
protected  void removeNodeSpi()
          Removes this preference node, invalidating it and any preferences that it contains.
protected  void removeSpi(java.lang.String key)
          Remove the association (if any) for the specified key at this preference node.
protected  void syncSpi()
          This method is invoked with this node locked.
 
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

DummyPreferences

protected DummyPreferences(java.util.prefs.AbstractPreferences parent,
                           java.lang.String name)
Creates a new instance of MyPrefernces

Method Detail

putSpi

protected void putSpi(java.lang.String key,
                      java.lang.String value)
Put the given key-value association into this preference node. It is guaranteed that key and value are non-null and of legal length. Also, it is guaranteed that this node has not been removed. (The implementor needn't check for any of these things.)

This method is invoked with the lock on this node held.

Specified by:
putSpi in class java.util.prefs.AbstractPreferences

getSpi

protected java.lang.String getSpi(java.lang.String key)
Return the value associated with the specified key at this preference node, or null if there is no association for this key, or the association cannot be determined at this time. It is guaranteed that key is non-null. Also, it is guaranteed that this node has not been removed. (The implementor needn't check for either of these things.)

Generally speaking, this method should not throw an exception under any circumstances. If, however, if it does throw an exception, the exception will be intercepted and treated as a null return value.

This method is invoked with the lock on this node held.

Specified by:
getSpi in class java.util.prefs.AbstractPreferences
Returns:
the value associated with the specified key at this preference node, or null if there is no association for this key, or the association cannot be determined at this time.

removeSpi

protected void removeSpi(java.lang.String key)
Remove the association (if any) for the specified key at this preference node. It is guaranteed that key is non-null. Also, it is guaranteed that this node has not been removed. (The implementor needn't check for either of these things.)

This method is invoked with the lock on this node held.

Specified by:
removeSpi in class java.util.prefs.AbstractPreferences

removeNodeSpi

protected void removeNodeSpi()
                      throws java.util.prefs.BackingStoreException
Removes this preference node, invalidating it and any preferences that it contains. The named child will have no descendants at the time this invocation is made (i.e., the Preferences.removeNode() method invokes this method repeatedly in a bottom-up fashion, removing each of a node's descendants before removing the node itself).

This method is invoked with the lock held on this node and its parent (and all ancestors that are being removed as a result of a single invocation to Preferences.removeNode()).

The removal of a node needn't become persistent until the flush method is invoked on this node (or an ancestor).

If this node throws a BackingStoreException, the exception will propagate out beyond the enclosing AbstractPreferences.removeNode() invocation.

Specified by:
removeNodeSpi in class java.util.prefs.AbstractPreferences
Throws:
java.util.prefs.BackingStoreException - if this operation cannot be completed due to a failure in the backing store, or inability to communicate with it.

keysSpi

protected java.lang.String[] keysSpi()
                              throws java.util.prefs.BackingStoreException
Returns all of the keys that have an associated value in this preference node. (The returned array will be of size zero if this node has no preferences.) It is guaranteed that this node has not been removed.

This method is invoked with the lock on this node held.

If this node throws a BackingStoreException, the exception will propagate out beyond the enclosing AbstractPreferences.keys() invocation.

Specified by:
keysSpi in class java.util.prefs.AbstractPreferences
Returns:
an array of the keys that have an associated value in this preference node.
Throws:
java.util.prefs.BackingStoreException - if this operation cannot be completed due to a failure in the backing store, or inability to communicate with it.

childrenNamesSpi

protected java.lang.String[] childrenNamesSpi()
                                       throws java.util.prefs.BackingStoreException
Returns the names of the children of this preference node. (The returned array will be of size zero if this node has no children.) This method need not return the names of any nodes already cached, but may do so without harm.

This method is invoked with the lock on this node held.

If this node throws a BackingStoreException, the exception will propagate out beyond the enclosing AbstractPreferences.childrenNames() invocation.

Specified by:
childrenNamesSpi in class java.util.prefs.AbstractPreferences
Returns:
an array containing the names of the children of this preference node.
Throws:
java.util.prefs.BackingStoreException - if this operation cannot be completed due to a failure in the backing store, or inability to communicate with it.

childSpi

protected java.util.prefs.AbstractPreferences childSpi(java.lang.String name)
Returns the named child of this preference node, creating it if it does not already exist. It is guaranteed that name is non-null, non-empty, does not contain the slash character ('/'), and is no longer than Preferences.MAX_NAME_LENGTH characters. Also, it is guaranteed that this node has not been removed. (The implementor needn't check for any of these things.)

Finally, it is guaranteed that the named node has not been returned by a previous invocation of this method or AbstractPreferences.getChild(String) after the last time that it was removed. In other words, a cached value will always be used in preference to invoking this method. Subclasses need not maintain their own cache of previously returned children.

The implementer must ensure that the returned node has not been removed. If a like-named child of this node was previously removed, the implementer must return a newly constructed AbstractPreferences node; once removed, an AbstractPreferences node cannot be "resuscitated."

If this method causes a node to be created, this node is not guaranteed to be persistent until the flush method is invoked on this node or one of its ancestors (or descendants).

This method is invoked with the lock on this node held.

Specified by:
childSpi in class java.util.prefs.AbstractPreferences
Parameters:
name - The name of the child node to return, relative to this preference node.
Returns:
The named child node.

syncSpi

protected void syncSpi()
                throws java.util.prefs.BackingStoreException
This method is invoked with this node locked. The contract of this method is to synchronize any cached preferences stored at this node with any stored in the backing store. (It is perfectly possible that this node does not exist on the backing store, either because it has been deleted by another VM, or because it has not yet been created.) Note that this method should not synchronize the preferences in any subnodes of this node. If the backing store naturally syncs an entire subtree at once, the implementer is encouraged to override sync(), rather than merely overriding this method.

If this node throws a BackingStoreException, the exception will propagate out beyond the enclosing AbstractPreferences.sync() invocation.

Specified by:
syncSpi in class java.util.prefs.AbstractPreferences
Throws:
java.util.prefs.BackingStoreException - if this operation cannot be completed due to a failure in the backing store, or inability to communicate with it.

flushSpi

protected void flushSpi()
                 throws java.util.prefs.BackingStoreException
This method is invoked with this node locked. The contract of this method is to force any cached changes in the contents of this preference node to the backing store, guaranteeing their persistence. (It is perfectly possible that this node does not exist on the backing store, either because it has been deleted by another VM, or because it has not yet been created.) Note that this method should not flush the preferences in any subnodes of this node. If the backing store naturally flushes an entire subtree at once, the implementer is encouraged to override flush(), rather than merely overriding this method.

If this node throws a BackingStoreException, the exception will propagate out beyond the enclosing AbstractPreferences.flush() invocation.

Specified by:
flushSpi in class java.util.prefs.AbstractPreferences
Throws:
java.util.prefs.BackingStoreException - if this operation cannot be completed due to a failure in the backing store, or inability to communicate with it.