|
Eclipse Rich Ajax Platform | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ISettingStore
An ISettingStore is a mechanism persisting settings (i.e. key/value pairs) beyond the scope of a single session.
A setting store instance is always associated with the current session.
Any settings being put into the store (via setAttribute(String, String)
)
are considered persisted from that point on.
To retrieve data stored in a previous session, client can invoke
the loadById(String)
method with an appropriate id
.
This will load any data stored under that id into the current setting store.
This mechanism is intended to be used as follows: by default RWT will assign
a new setting store to each new session, based on the current session id.
After the user has authenticated, application developers can use the
loadById(String)
method to initialize the store with persisted data
stored under that id during a previous session. Obviously, any data that
is set into the store from that point on, will also be persisted under
the current id and will also be available in the future.
Clients who wish to implement own setting store must
also provide a corresponding ISettingStoreFactory
.
FileSettingStore
Method Summary | |
---|---|
void |
addSettingStoreListener(SettingStoreListener listener)
Attaches an SettingStoreListener to this ISettingStore . |
java.lang.String |
getAttribute(java.lang.String name)
Returns the attribute stored under the specified name in this ISettingStore , or null if no attribute is stored under
that name. |
java.util.Enumeration |
getAttributeNames()
Returns an Enumeration of String objects with the names
of all attributes in this ISettingStore . |
java.lang.String |
getId()
Returns the unique identifier of this setting store |
void |
loadById(java.lang.String id)
Replace the contents of this setting store with all attributes persisted under the given id . |
void |
removeAttribute(java.lang.String name)
Removes the attribute stored under the specified name from this ISettingStore . |
void |
removeSettingStoreListener(SettingStoreListener listener)
Removes an SettingStoreListener from this ISettingStore . |
void |
setAttribute(java.lang.String name,
java.lang.String value)
Stores an attribute to this ISettingStore , using the name
specified. |
Method Detail |
---|
java.lang.String getAttribute(java.lang.String name)
ISettingStore
, or null
if no attribute is stored under
that name.
name
- a non-null String specifying the name of the attribute
null
java.util.Enumeration getAttributeNames()
Enumeration
of String objects with the names
of all attributes in this ISettingStore
.
Enumeration
; never null
void setAttribute(java.lang.String name, java.lang.String value) throws SettingStoreException
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 removeAttribute(String)
.
SettingStoreListener
s attached to this instance will be notified
after an attribute has been stored.
name
- the name of the attribute; cannot be null
value
- the String to store; may be null
SettingStoreException
- if the load operation failed to complete
normally
java.lang.NullPointerException
- if name is null
void removeAttribute(java.lang.String name) throws SettingStoreException
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.
name
- the name of the attribute to remove;
cannot be null
SettingStoreException
- if the remove operation failed to complete
normally
java.lang.NullPointerException
- if name is null
void loadById(java.lang.String id) throws SettingStoreException
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
.
id
- a non-null; non-empty; non-whitespace-only String
SettingStoreException
- if the load operation failed to complete
normally
java.lang.NullPointerException
- if id
is null
java.lang.IllegalArgumentException
- if id
is empty or composed
entirely of whitespacejava.lang.String getId()
void addSettingStoreListener(SettingStoreListener listener)
SettingStoreListener
to this ISettingStore
.
Listeners attached to this instance will notified of changes in the store.
listener
- the SettingStoreListener
to add; non-nullvoid removeSettingStoreListener(SettingStoreListener listener)
SettingStoreListener
from this ISettingStore
.
listener
- the SettingStoreListener
to remove; non-null
|
Eclipse Rich Ajax Platform | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (c) EclipseSource and others 2002, 2012. All rights reserved.