Class FilePreferencesImpl


  • public class FilePreferencesImpl
    extends AbstractPreferences
    The default implementation of AbstractPreferences for the Linux platform, using the file system as its back end. TODO some sync mechanism with backend, Performance - check file edit date
    Since:
    1.4
    • Constructor Detail

      • FilePreferencesImpl

        public FilePreferencesImpl​(String path,
                                   boolean isUserNode)
        Construct root FilePreferencesImpl instance rooted at the given path.
    • Method Detail

      • childrenNamesSpi

        protected String[] childrenNamesSpi()
                                     throws BackingStoreException
        Description copied from class: AbstractPreferences
        Returns the names of all of the child nodes of this node or an empty array if this node has no children. The names of cached children are not required to be returned.
        Specified by:
        childrenNamesSpi in class AbstractPreferences
        Returns:
        the names of this node's children.
        Throws:
        BackingStoreException - if the backing store is unavailable or causes an operation failure.
      • childSpi

        protected AbstractPreferences childSpi​(String name)
        Description copied from class: AbstractPreferences
        Returns the child preference node with the given name, creating it if it does not exist. The caller of this method should ensure that the given name is valid and that this node has not been removed or cached. If the named node has just been removed, the implementation of this method must create a new one instead of reactivating the removed one.

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

        Specified by:
        childSpi in class AbstractPreferences
        Parameters:
        name - the name of the child preference to be returned.
        Returns:
        the child preference node.
      • flushSpi

        protected void flushSpi()
                         throws BackingStoreException
        Description copied from class: AbstractPreferences
        Flushes changes of this node to the backing store. This method should only flush this node and should not include the descendant nodes. Any implementation that wants to provide functionality to flush all nodes at once should override the method flush().
        Specified by:
        flushSpi in class AbstractPreferences
        Throws:
        BackingStoreException - if the backing store is unavailable or causes an operation failure.
      • getSpi

        protected String getSpi​(String key)
        Description copied from class: AbstractPreferences
        Gets the preference value mapped to the given key. The caller of this method should ensure that the given key is valid and that this node has not been removed. This method should not throw any exceptions but if it does, the caller will ignore the exception, regarding it as a 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
        Returns an array of all preference keys of this node or an empty array if no preferences have been found. The caller of this method should ensure that this node has not been removed.
        Specified by:
        keysSpi in class AbstractPreferences
        Returns:
        the array of all preference keys.
        Throws:
        BackingStoreException - if the backing store is unavailable or causes an operation failure.
      • putSpi

        protected void putSpi​(String name,
                              String value)
        Description copied from class: AbstractPreferences
        Puts the given key-value pair into this node. Caller of this method should ensure that both of the given values are valid and that this node has not been 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
        Removes this node from the preference hierarchy tree. The caller of this method should ensure that this node has no child nodes, which means the method Preferences.removeNode() should invoke this method multiple-times in bottom-up pattern. The removal is not required to be persisted until after it is flushed.
        Specified by:
        removeNodeSpi in class AbstractPreferences
        Throws:
        BackingStoreException - if the backing store is unavailable or causes an operation failure.
      • removeSpi

        protected void removeSpi​(String key)
        Description copied from class: AbstractPreferences
        Removes the preference with the specified key. The caller of this method should ensure that the given key is valid and that this node has not been removed.
        Specified by:
        removeSpi in class AbstractPreferences
        Parameters:
        key - the key of the preference that is to be removed.
      • syncSpi

        protected void syncSpi()
                        throws BackingStoreException
        Description copied from class: AbstractPreferences
        Synchronizes this node with the backing store. This method should only synchronize this node and should not include the descendant nodes. An implementation that wants to provide functionality to synchronize all nodes at once should override the method sync().
        Specified by:
        syncSpi in class AbstractPreferences
        Throws:
        BackingStoreException - if the backing store is unavailable or causes an operation failure.