public final class FileSettingStore extends java.lang.Object implements SettingStore
Properties files.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
FILE_SETTING_STORE_DIR
This key (value "org.eclipse.rap.rwt.service.FileSettingStore.dir") can be used to configure
the working directory for file settings stores.
|
| Constructor and Description |
|---|
FileSettingStore(java.io.File baseDirectory)
Creates an empty instance with a random unique ID.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addSettingStoreListener(SettingStoreListener listener)
Attaches the given listener to this setting store.
|
java.lang.String |
getAttribute(java.lang.String name)
Returns the attribute stored under the specified name in this setting store.
|
java.util.Enumeration<java.lang.String> |
getAttributeNames()
Returns an
Enumeration of strings with the names of all attributes in this setting
store. |
java.lang.String |
getId()
Returns the unique identifier of this setting store.
|
void |
loadById(java.lang.String id)
Replaces the contents of this setting store with the persisted contents associated with the
given ID.
|
void |
removeAttribute(java.lang.String name)
Removes the attribute stored under the specified name from this setting store.
|
void |
removeSettingStoreListener(SettingStoreListener listener)
Removes the given listener from this setting store.
|
void |
setAttribute(java.lang.String name,
java.lang.String value)
Stores a given attribute in this setting store, using the name specified.
|
public static final java.lang.String FILE_SETTING_STORE_DIR
FileSettingStoreFactory.public FileSettingStore(java.io.File baseDirectory)
loadById(String) to initialize
an existing store with previously persisted attributes.baseDirectory - an existing directory to persist this store's settings injava.lang.IllegalArgumentException - if the given workDir is not a directoryloadById(String)public java.lang.String getId()
SettingStoregetId in interface SettingStorenullpublic java.lang.String getAttribute(java.lang.String name)
SettingStoregetAttribute in interface SettingStorename - a non-null String specifying the name of the attributenull if no attribute is
stored under that namepublic void setAttribute(java.lang.String name,
java.lang.String value)
throws java.io.IOException
SettingStore
If the value is null, this has the same effect as calling
SettingStore.removeAttribute(String).
SettingStoreListeners attached to this instance will be notified after an attribute has
been stored.
setAttribute in interface SettingStorename - the name of the attribute, must not be null or emptyvalue - the attribute to store, may be nulljava.io.IOException - if the load operation failed to complete normallypublic java.util.Enumeration<java.lang.String> getAttributeNames()
SettingStoreEnumeration of strings with the names of all attributes in this setting
store.getAttributeNames in interface SettingStorenullpublic void loadById(java.lang.String id)
throws java.io.IOException
SettingStore
The attributes of this setting store will remain associated with the old id, but will be
removed from this store instance. SettingStoreListeners attached to this store
will receive a notification for each removed attribute.
During the load operation this store will be filled with the attributes associated with the new
ID. SettingStoreListeners attached to this store will receive a notification for each
added attribute.
After the load operation this store will only hold attributes associated with the new id value.
loadById in interface SettingStoreid - the ID of the settings to load, must not be null or emptyjava.io.IOException - if the load operation failed to complete normallypublic void removeAttribute(java.lang.String name)
throws java.io.IOException
SettingStore
SettingStoreListeners attached to this instance will be notified after an attribute has
been removed.
removeAttribute in interface SettingStorename - the name of the attribute to remove, must not be nulljava.io.IOException - if the remove operation failed to complete normallypublic void addSettingStoreListener(SettingStoreListener listener)
SettingStoreaddSettingStoreListener in interface SettingStorelistener - the listener to add, must not be nullpublic void removeSettingStoreListener(SettingStoreListener listener)
SettingStoreremoveSettingStoreListener in interface SettingStorelistener - the listener to remove, must not be null
Copyright (c) EclipseSource and others 2002, 2015.
All rights reserved. This program and the accompanying materials
are made available under the terms of the
Eclipse Public License v1.0