|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IpPersistencyManager
The IpPersistencyManager
specifies an interface that
needs to be implemented by all persistenct manager components. A
persistency manager can be used to save the state of an object to
stable storage, and then load the state at some later point in
time, for instance after a restart. The details of how this is done
is is internal to each manager implementation.
// Save state of an object IpPersistencyManager mgr = ...; mgr.save(obj, "myObj"); ... // now load the object IpObject obj = mgr.load("myObj");Persistency managers can also be used to save and load unique identifiers. This allows for instance an application process to maintain its identity after a restart.
// Get the persisted identifier of this process IpIdentifier id = mgr.getId("myProc"); // Set the PART process identifier to the loaded one. Will // cause our process id to always be the same when started. IpSystem.initialize(id);
Field Summary | |
---|---|
static int |
ON_CHANGE
|
static int |
ON_TIMER
|
Method Summary | |
---|---|
boolean |
contains(IpIdentifier objId)
Check if the state of a given object has been saved in the persistency store. |
boolean |
contains(java.lang.String name)
Check if the an object has been saved in the store under a given name. |
IpObject |
load(IpIdentifier objId)
Load and return an object which has been previously saved in the persistency store. |
IpObject |
load(java.lang.String name)
Load and return an object which has been previously saved in the persistency store. |
IpObject[] |
loadAll()
Load and return all objects saved in the persistency store. |
IpIdentifier |
loadId(java.lang.String name)
Load an identifier which has previously been saved using saveId . |
void |
persist(IpObject obj,
java.lang.String name,
int when)
Save the state of the object repeatedly as specified by the when paramater. |
void |
remove(IpIdentifier objId)
Remove the saved state of the given object from the persistency store. |
void |
remove(java.lang.String name)
Remove the saved state of an object associated to the given name. |
void |
removeAll()
Remove the content of the persistency store. |
void |
removeId(java.lang.String name)
Remove an identifier which has previously been saved using saveId . |
void |
save(IpObject obj,
java.lang.String name)
Save the state of an object in the persistency store. |
void |
saveId(IpIdentifier id,
java.lang.String name)
Save an identifier in the store and associate it to a name. |
Field Detail |
---|
static final int ON_CHANGE
static final int ON_TIMER
Method Detail |
---|
void save(IpObject obj, java.lang.String name) throws IpException
null
), which means that it can later be loaded
using the name only:
IpPersistencyManager pm = ...; pm.save(obj, "test"); .. obj = pm.load("test");If the name parameter is
null
and the object
hasn't been saved before, the object is not associated to any
name when saved. If the parameter is null
and the
object has been saved before, the object will be associated to
the same name as was given when previously saved (may be
null
).
obj
- The object whose state should be savedname
- A name to which the object will be associated, may be
null
IpException
- if an exception occurs while saving the
state.void persist(IpObject obj, java.lang.String name, int when) throws IpException
when
paramater. Will also cause the object
to be saved immediately,
If the name parameter is null
and the object
hasn't been saved before, the object is not associated to a
name when saved. If the parameter is null
and the
object has been saved before, the object will be associated to
the same name as was given when previously saved (may be
null
).
obj
- The objectname
- The name to which the object will be associated when
saved (may be null
)when
- Determines when the object will be saved
IpException
- if an exception occurs while saving the
state.IpObject load(IpIdentifier objId) throws IpException
objId
- The identifier of the object to load
IpException
- if an exception occurs while loading the
object.IpObject load(java.lang.String name) throws IpException
name
- The name that was given when the object was saved
IpException
- if an exception occurs while loading the
object.IpObject[] loadAll() throws IpException
null
is returned.
IpException
- if an exception occurs while loading the
store content.void removeAll() throws IpException
getId
.
IpException
- if an exception occurs while the content
is removed.boolean contains(java.lang.String name) throws IpException
name
- The name to which the object was associated when
saved
true
if the object's state has been saved under the given name,false
otherwiseIpException
- if an exception occurs while checking if
the object is saved in the store.boolean contains(IpIdentifier objId) throws IpException
objId
- The identifier of the object
true
if the object's state has been saved,false
otherwiseIpException
- if an exception occurs while checking if
the object is saved in the store.void remove(IpIdentifier objId) throws IpException
persist
concerning the object.
objId
- The identifier of the object to remove
IpException
- if an exception occurs while the object
is removed.void remove(java.lang.String name) throws IpException
save
or persist
methods.
name
- The name to which the object has been associated
IpException
- if an exception occurs while the object
is removed.IpIdentifier loadId(java.lang.String name) throws IpException
saveId
.
name
- The name that was given when the identifier was
saved
null
otherwise
IpException
- if an exception occurs while the
identifer is loaded.void saveId(IpIdentifier id, java.lang.String name) throws IpException
loadId
.
If an identifier is already saved under the given name, it will be overwritten.
id
- The identifier to savename
- The name to which the identifier will be
associated. May not be null
.
IpException
- if an exception occurs while the
identifer is saved.void removeId(java.lang.String name) throws IpException
saveId
.
name
- The name that was given when the identifier was
saved
IpException
- if an exception occurs while the
identifer is loaded.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |