|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.microsoft.tfs.core.util.MementoRepository
public final class MementoRepository
Provides persistent storage of Memento
s, identified by string keys,
in a PersistenceStore
.
This class is convenient for sharing settings between multiple users of
com.microsoft.tfs.core that may not otherwise share any standard storage (for
example, Eclipse plug-in and Explorer want to share the user's custom merge
tool assignments). To share settings, use the same PersistenceStore
,
and specify the same key from both clients. Client applications are not
required to use this class to store settings, they may use a
PersistenceStore
directly, or store settings in another place
(Eclipse workspace, etc.).
Depending on the kind of PersistenceStore
supplied, key names may be
restricted to prohibit some characters, or have a maximum length, or have
other restrictions. See PersistenceStore
for details.
Locking is used during save(String, Memento)
and
load(String)
to prevent concurrent reads and writes from other
threads as well as other processes on the same computer.
Constructor Summary | |
---|---|
MementoRepository(PersistenceStore store)
Creates a MementoRepository that stores its data inside a
child store inside the given
PersistenceStore . |
Method Summary | |
---|---|
Memento |
load(java.lang.String key)
Loads the settings Memento for the given key. |
boolean |
save(java.lang.String key,
Memento memento)
Saves the given Memento for the given key. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MementoRepository(PersistenceStore store)
MementoRepository
that stores its data inside a
child store inside the given
PersistenceStore
.
store
- the PersistenceStore
to use (must not be null
)Method Detail |
---|
public Memento load(java.lang.String key)
Memento
for the given key. If the settings
file for the given key is in use by another process, waits (potentially
forever) until the file is available.
key
- the setting key, which must be a valid PersistenceStore
item name (must not be null
or empty)
Memento
for the given key, or null if no settings
exist for the given key or an error happened reading the settings
(check the logs for an error message)public boolean save(java.lang.String key, Memento memento)
Memento
for the given key. Overwrites any data
already associated with the key.
key
- the setting key, which must be a valid PersistenceStore
item name (must not be null
or empty)memento
- the Memento
to save (must not be null
)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |