Class FileSettingStore
- All Implemented Interfaces:
SettingStore
Properties
files.- Since:
- 2.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
This key (value "org.eclipse.rap.rwt.service.FileSettingStore.dir") can be used to configure the working directory for file settings stores. -
Constructor Summary
ConstructorDescriptionFileSettingStore
(File baseDirectory) Creates an empty instance with a random unique ID. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addSettingStoreListener
(SettingStoreListener listener) Attaches the given listener to this setting store.getAttribute
(String name) Returns the attribute stored under the specified name in this setting store.Returns anEnumeration
of strings with the names of all attributes in this setting store.getId()
Returns the unique identifier of this setting store.void
Replaces the contents of this setting store with the persisted contents associated with the given ID.void
removeAttribute
(String name) Removes the attribute stored under the specified name from this setting store.void
Removes the given listener from this setting store.void
setAttribute
(String name, String value) Stores a given attribute in this setting store, using the name specified.
-
Field Details
-
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. SeeFileSettingStoreFactory
.- See Also:
-
-
Constructor Details
-
FileSettingStore
Creates an empty instance with a random unique ID. UseloadById(String)
to initialize an existing store with previously persisted attributes.- Parameters:
baseDirectory
- an existing directory to persist this store's settings in- Throws:
IllegalArgumentException
- if the givenworkDir
is not a directory- See Also:
-
-
Method Details
-
getId
Description copied from interface:SettingStore
Returns the unique identifier of this setting store.- Specified by:
getId
in interfaceSettingStore
- Returns:
- a non-empty string, never
null
-
getAttribute
Description copied from interface:SettingStore
Returns the attribute stored under the specified name in this setting store.- Specified by:
getAttribute
in interfaceSettingStore
- Parameters:
name
- a non-null String specifying the name of the attribute- Returns:
- the attribute stored under the given name or
null
if no attribute is stored under that name
-
setAttribute
Description copied from interface:SettingStore
Stores a given attribute in this setting store, using the name specified. If an attribute with the same name is already stored in this setting store, the previous value is replaced. The attribute is considered persisted when after this method completes.If the value is
null
, this has the same effect as callingSettingStore.removeAttribute(String)
.SettingStoreListener
s attached to this instance will be notified after an attribute has been stored.- Specified by:
setAttribute
in interfaceSettingStore
- Parameters:
name
- the name of the attribute, must not benull
or emptyvalue
- the attribute to store, may benull
- Throws:
IOException
- if the load operation failed to complete normally
-
getAttributeNames
Description copied from interface:SettingStore
Returns anEnumeration
of strings with the names of all attributes in this setting store.- Specified by:
getAttributeNames
in interfaceSettingStore
- Returns:
- an enumeration with the attribute names in this setting store, never
null
-
loadById
Description copied from interface:SettingStore
Replaces the contents of this setting store with the persisted contents associated with the given ID.The attributes of this setting store will remain associated with the old id, but will be removed from this store instance.
SettingStoreListener
s 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.
SettingStoreListener
s 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.
- Specified by:
loadById
in interfaceSettingStore
- Parameters:
id
- the ID of the settings to load, must not benull
or empty- Throws:
IOException
- if the load operation failed to complete normally
-
removeAttribute
Description copied from interface:SettingStore
Removes the attribute stored under the specified name from this setting store. If no attribute is stored under the specified name, this method does nothing.SettingStoreListener
s attached to this instance will be notified after an attribute has been removed.- Specified by:
removeAttribute
in interfaceSettingStore
- Parameters:
name
- the name of the attribute to remove, must not benull
- Throws:
IOException
- if the remove operation failed to complete normally
-
addSettingStoreListener
Description copied from interface:SettingStore
Attaches the given listener to this setting store. Listeners will be notified of changes in the store. If the listener has already been added to this store, this method does nothing.- Specified by:
addSettingStoreListener
in interfaceSettingStore
- Parameters:
listener
- the listener to add, must not benull
-
removeSettingStoreListener
Description copied from interface:SettingStore
Removes the given listener from this setting store. If the listener has not been added, this method does nothing.- Specified by:
removeSettingStoreListener
in interfaceSettingStore
- Parameters:
listener
- the listener to remove, must not benull
-