|
Gridarta Editor
|
Maintains a set of preference values. More...
Collaboration diagram for net.sf.gridarta.preferences.Storage:Public Member Functions | |
| String [] | childrenNames (@NotNull final String path) |
| Return the names of the children of a node. More... | |
| String [] | getKeys (@NotNull final String path) |
| Return all of the keys that have an associated value in a node. More... | |
| String | getValue (@NotNull final String path, @NotNull final String key) |
| Return the value associated with the specified key at a node, or. More... | |
| void | newNode (@NotNull final String path) |
| Make sure a node exists. More... | |
| void | putValue (@NotNull final String path, @NotNull final String key, @NotNull final String value) |
| Put the given key-value association into a node. More... | |
| void | removeNode (@NotNull final String path) |
| Remove a preference node including all preferences that it contains. More... | |
| void | removeValue (@NotNull final String path, @NotNull final String key) |
| Remove the association (if any) for the specified key at a node. More... | |
| Storage (@NotNull final String defaultPath, @Nullable final File file) | |
| Create a new instance. More... | |
| void | sync (final boolean sync) throws BackingStoreException |
| Save changes to the underlying file. More... | |
Private Member Functions | |
| void | loadValues () |
| Load the values from the backing file. More... | |
| void | loadValues (@NotNull final LineNumberReader lnr) throws IOException |
| Load the values from a LineNumberReader. More... | |
| void | saveValues () throws IOException |
| Save the values to the backing file. More... | |
| void | setChanged () |
| This function is called whenever the contents of values has changed. More... | |
Static Private Member Functions | |
| static void | saveNode (@NotNull final BufferedWriter writer, @Nullable final String path, @NotNull final Map< String, String > node) throws IOException |
| Save one node. More... | |
Private Attributes | |
| final String | defaultPath |
| The default key name for loading/saving values. More... | |
| final File | file |
| The file for loading/saving values. More... | |
| boolean | noSave = true |
| If set, do not save changes into file. More... | |
| final Map< String, Map< String, String > > | values = new TreeMap<>() |
| The stored values. More... | |
Static Private Attributes | |
| static final Category | LOG = Logger.getLogger(Storage.class) |
| The Logger for printing log messages. More... | |
| static final Pattern | PATTERN_EQUAL = Pattern.compile("=") |
| The pattern that matches a single equal sign ("="). More... | |
| static final Pattern | PATTERN_IGNORE = Pattern.compile("[\\[].*") |
| Pattern to ignore in path names. More... | |
Maintains a set of preference values.
The values are stored in a flat file.
Definition at line 48 of file Storage.java.
| net.sf.gridarta.preferences.Storage.Storage | ( | @NotNull final String | defaultPath, |
| @Nullable final File | file | ||
| ) |
Create a new instance.
| defaultPath | the default key name for loading/saving values |
| file | the file for loading/saving values or null |
Definition at line 97 of file Storage.java.
References net.sf.gridarta.preferences.Storage.defaultPath, net.sf.gridarta.preferences.Storage.file, and net.sf.gridarta.preferences.Storage.loadValues().
Here is the call graph for this function:| String [] net.sf.gridarta.preferences.Storage.childrenNames | ( | @NotNull final String | path | ) |
Return the names of the children of a node.
The returned array will be of size zero if the node has no children.
| path | the node path name |
Definition at line 130 of file Storage.java.
Referenced by net.sf.gridarta.preferences.FilePreferences.childrenNamesSpi().
Here is the caller graph for this function:| String [] net.sf.gridarta.preferences.Storage.getKeys | ( | @NotNull final String | path | ) |
Return all of the keys that have an associated value in a node.
The returned array will be of size zero if the node has no preferences.
| path | the node path name |
Definition at line 170 of file Storage.java.
Referenced by net.sf.gridarta.preferences.FilePreferences.keysSpi().
Here is the caller graph for this function:| String net.sf.gridarta.preferences.Storage.getValue | ( | @NotNull final String | path, |
| @NotNull final String | key | ||
| ) |
Return the value associated with the specified key at a node, or.
if there is no association for this key.
| path | the node path name |
| key | the key to get value for |
Definition at line 153 of file Storage.java.
Referenced by net.sf.gridarta.preferences.FilePreferences.getSpi().
Here is the caller graph for this function:
|
private |
Load the values from the backing file.
Definition at line 268 of file Storage.java.
Referenced by net.sf.gridarta.preferences.Storage.Storage().
Here is the caller graph for this function:
|
private |
Load the values from a LineNumberReader.
| lnr | the line number reader |
| IOException | if an I/O error occurs |
Definition at line 308 of file Storage.java.
References net.sf.gridarta.preferences.Codec.decode(), net.sf.gridarta.preferences.Storage.defaultPath, net.sf.gridarta.preferences.Storage.newNode(), and net.sf.gridarta.preferences.Storage.putValue().
Here is the call graph for this function:| void net.sf.gridarta.preferences.Storage.newNode | ( | @NotNull final String | path | ) |
Make sure a node exists.
| path | the node path name |
Definition at line 113 of file Storage.java.
Referenced by net.sf.gridarta.preferences.Storage.loadValues().
Here is the caller graph for this function:| void net.sf.gridarta.preferences.Storage.putValue | ( | @NotNull final String | path, |
| @NotNull final String | key, | ||
| @NotNull final String | value | ||
| ) |
Put the given key-value association into a node.
| path | the node path name |
| key | the key to store |
| value | the value to store |
Definition at line 187 of file Storage.java.
References net.sf.gridarta.preferences.Storage.setChanged().
Referenced by net.sf.gridarta.preferences.Storage.loadValues(), and net.sf.gridarta.preferences.FilePreferences.putSpi().
Here is the call graph for this function:
Here is the caller graph for this function:| void net.sf.gridarta.preferences.Storage.removeNode | ( | @NotNull final String | path | ) |
Remove a preference node including all preferences that it contains.
| path | the node path name |
Definition at line 204 of file Storage.java.
References net.sf.gridarta.preferences.Storage.setChanged().
Referenced by net.sf.gridarta.preferences.FilePreferences.removeNodeSpi().
Here is the call graph for this function:
Here is the caller graph for this function:| void net.sf.gridarta.preferences.Storage.removeValue | ( | @NotNull final String | path, |
| @NotNull final String | key | ||
| ) |
Remove the association (if any) for the specified key at a node.
| path | the node path name to remove from |
| key | the key to remove |
Definition at line 219 of file Storage.java.
References net.sf.gridarta.preferences.Storage.setChanged().
Referenced by net.sf.gridarta.preferences.FilePreferences.removeSpi().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Save one node.
| writer | the Writer |
| path | the node path name |
| node | the node to save |
| IOException | if the node cannot be saved |
Definition at line 392 of file Storage.java.
References net.sf.gridarta.preferences.Codec.encode().
Referenced by net.sf.gridarta.preferences.Storage.saveValues().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Save the values to the backing file.
| IOException | if the values cannot be saved |
Definition at line 342 of file Storage.java.
References net.sf.gridarta.preferences.Storage.saveNode().
Referenced by net.sf.gridarta.preferences.Storage.setChanged(), and net.sf.gridarta.preferences.Storage.sync().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
This function is called whenever the contents of values has changed.
Definition at line 253 of file Storage.java.
References net.sf.gridarta.preferences.Storage.saveValues().
Referenced by net.sf.gridarta.preferences.Storage.putValue(), net.sf.gridarta.preferences.Storage.removeNode(), and net.sf.gridarta.preferences.Storage.removeValue().
Here is the call graph for this function:
Here is the caller graph for this function:| void net.sf.gridarta.preferences.Storage.sync | ( | final boolean | sync | ) | throws BackingStoreException |
Save changes to the underlying file.
| sync | not currently used |
| BackingStoreException | in case sync was not possible, i.e. due to I/O problems |
Definition at line 237 of file Storage.java.
References net.sf.gridarta.preferences.Storage.saveValues().
Referenced by net.sf.gridarta.preferences.FilePreferences.flush(), and net.sf.gridarta.preferences.FilePreferences.sync().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
The default key name for loading/saving values.
Definition at line 66 of file Storage.java.
Referenced by net.sf.gridarta.preferences.Storage.loadValues(), and net.sf.gridarta.preferences.Storage.Storage().
|
private |
The file for loading/saving values.
Definition at line 72 of file Storage.java.
Referenced by net.sf.gridarta.preferences.Storage.Storage().
|
staticprivate |
The Logger for printing log messages.
Definition at line 60 of file Storage.java.
|
private |
If set, do not save changes into file.
Definition at line 77 of file Storage.java.
|
staticprivate |
The pattern that matches a single equal sign ("=").
Definition at line 54 of file Storage.java.
|
staticprivate |
Pattern to ignore in path names.
Definition at line 83 of file Storage.java.
|
private |