org.eclipse.rwt.service
Class FileSettingStore
java.lang.Object
org.eclipse.rwt.service.FileSettingStore
-
All Implemented Interfaces:
-
ISettingStore
- public final class FileSettingStore
- extends
Object
- implements
ISettingStore
This
ISettingStore
implementation persists all settings on the
file system using Java
Properties
.
-
Since:
- 1.1
Field Summary
|
static
String
|
FILE_SETTING_STORE_DIR
This key (value "org.eclipse.rwt.service.FileSettingStore.dir") can be
used to configure the working directory for file settings stores. |
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
FILE_SETTING_STORE_DIR
public static final
String FILE_SETTING_STORE_DIR
- This key (value "org.eclipse.rwt.service.FileSettingStore.dir") can be
used to configure the working directory for file settings stores.
See
RWTFileSettingStoreFactory
and
WorkbenchFileSettingStoreFactory
.
-
See Also:
-
Constant Field Values
FileSettingStore
public FileSettingStore(
File workDir)
- Create a
FileSettingStore
instance. The store will be initialized
with a unique random id and will contain no attributes. Use
loadById(String)
to initialize an existing store with previously
persisted attributes.
-
Parameters:
-
workDir
- a non-null File instance denoting an existing directory,
which will be used by this class persist its settings.
-
Throws:
-
NullPointerException
- if the argument workDir is null
-
IllegalArgumentException
- if the argument workDir is not a directory -
See Also:
-
loadById(String)
getId
public
String getId()
-
Description copied from interface:
ISettingStore
- Returns the unique identifier of this setting store
-
-
Specified by:
-
getId
in interface
ISettingStore
-
-
Returns:
- a non-empty String value; never null
getAttribute
public
String getAttribute(
String name)
-
Description copied from interface:
ISettingStore
- Returns the attribute stored under the specified name in this
ISettingStore
, or null
if no attribute is stored under
that name.
-
-
Specified by:
-
getAttribute
in interface
ISettingStore
-
-
Parameters:
-
name
- a non-null String specifying the name of the attribute
-
Returns:
- a String value or
null
setAttribute
public void setAttribute(
String name,
String value)
throws
SettingStoreException
-
Description copied from interface:
ISettingStore
- Stores an attribute to this
ISettingStore
, using the name
specified. If an attribute with the same name is already stored in that
ISettingStore
the previous value is replaced.
Any attribute stored to this ISettingStore using this method is considered
persisted from that point on.
If the value argument is null
, this has the same effect
as calling
ISettingStore.removeAttribute(String)
.
SettingStoreListener
s attached to this instance will be notified
after an attribute has been stored.
-
-
Specified by:
-
setAttribute
in interface
ISettingStore
-
-
Parameters:
-
name
- the name of the attribute; cannot be null
-
value
- the String to store; may be null
-
Throws:
-
SettingStoreException
- if the load operation failed to complete
normally
getAttributeNames
public
Enumeration getAttributeNames()
-
Description copied from interface:
ISettingStore
- Returns an
Enumeration
of String objects with the names
of all attributes in this
ISettingStore
.
-
-
Specified by:
-
getAttributeNames
in interface
ISettingStore
-
-
Returns:
- an
Enumeration
; never null
loadById
public void loadById(
String id)
throws
SettingStoreException
-
Description copied from interface:
ISettingStore
- Replace the contents of this setting store with all attributes persisted
under the given
id
.
The attributes of this setting store before the load operation 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 value.
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.
It is important to note that this operation does not create a new setting
store, so that listeners still remain associated with the same store
instance. Instead the contents of this setting store are replaced
with the contents associated with the given id
.
-
-
Specified by:
-
loadById
in interface
ISettingStore
-
-
Parameters:
-
id
- a non-null; non-empty; non-whitespace-only String
-
Throws:
-
SettingStoreException
- if the load operation failed to complete
normally
removeAttribute
public void removeAttribute(
String name)
throws
SettingStoreException
-
Description copied from interface:
ISettingStore
- Removes the attribute stored under the specified name from this
ISettingStore
. 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 interface
ISettingStore
-
-
Parameters:
-
name
- the name of the attribute to remove;
cannot be null
-
Throws:
-
SettingStoreException
- if the remove operation failed to complete
normally
addSettingStoreListener
public void addSettingStoreListener(
SettingStoreListener listener)
-
Description copied from interface:
ISettingStore
- Attaches an
SettingStoreListener
to this
ISettingStore
.
Listeners attached to this instance will notified of changes in the store.
-
-
Specified by:
-
addSettingStoreListener
in interface
ISettingStore
-
-
Parameters:
-
listener
- the
SettingStoreListener
to add; non-null
removeSettingStoreListener
public void removeSettingStoreListener(
SettingStoreListener listener)
-
Description copied from interface:
ISettingStore
- Removes an
SettingStoreListener
from this
ISettingStore
.
-
-
Specified by:
-
removeSettingStoreListener
in interface
ISettingStore
-
-
Parameters:
-
listener
- the
SettingStoreListener
to remove; non-null
Copyright (c) Innoopract Informationssysteme GmbH and others 2002, 2008. All rights reserved.