This class is an implementation of the TransactionalPersistenceManager
interface. It manages the persistency, the concurrency and the caching of
persistent objects. To do this it uses several other components:
- a cache manager,
- a concurrency manager,
- a storage manager,
- a state manager,
- a memory instance manager,
- a working set manager.
This implementation is compliant to fractal by implementing the
BindingController interface permitting the management of bindings between
components.
CACHE_MANAGER_BINDING
public static final String CACHE_MANAGER_BINDING
CONCURRENCY_MANAGER_BINDING
public static final String CONCURRENCY_MANAGER_BINDING
MEMORY_INSTANCE_MANAGER_BINDING
public static final String MEMORY_INSTANCE_MANAGER_BINDING
STATE_MANAGER_BINDING
public static final String STATE_MANAGER_BINDING
STORAGE_MANAGER_BINDING
public static final String STORAGE_MANAGER_BINDING
UNBIND_MANAGER_BINDING
public static final String UNBIND_MANAGER_BINDING
WORKINGSET_MANAGER_BINDING
public static final String WORKINGSET_MANAGER_BINDING
cache
protected CacheManager cache
The cache of the persistent object.
cm
protected ConcurrencyManager cm
The concurrency manager
logger
protected Logger logger
stateManager
protected StateManager stateManager
The manager of state of persistent object.
storage
protected StorageManager storage
The storage manager in charge of the I/O to the data support, and the
naming management.
unbindManager
protected UnbindManager unbindManager
bindCeInWS
protected void bindCeInWS(State state,
WorkingSet ws,
byte mode)
throws PersistenceException
Attaches a state to a working Set.
state
- is the state of the persistent object which must be attached
to working set.ws
- is the working set to attach the state.
bindFc
public void bindFc(String s,
Object o)
checkCacheEntry
protected void checkCacheEntry(CacheEntry ce)
throws PersistenceException
Check if a cache entry is already referenced in the cache. If the entry
has not been found, the entry is bound in the cache.
ce
- is the cache entry to check
PersistenceException
- if the cache is full or if another cache
entry has been found in the cache with the same identifier.
export
public State export(WorkingSet ws,
Object obj)
throws PersistenceException
Given an object, this method creates the corresponding copy in
permanent support. At the same time, it establishes a binding
between the object in main-memory and the permanent copy.
Roughly, the internal tasks include:
- Reserving space on permanent support,
- Establishing a binding between the object in main memory and
the permanent copy,
- Marking the object as dirty, (internal or by the concurrency
control module?)
- Adding the object to the cache
- export in interface PersistenceManager
obj
- The object whose state is to be copied to
PersistenceException
- Whenever the object is invalid
(e.g. NULL) or it has been previously bound to another oid.
export
public State export(WorkingSet ws,
Object obj,
Object hints)
throws PersistenceException
This method permits to given some information to build the identifier of
the new persistent object.
- export in interface PersistenceManager
obj
- The object whose state is to be copied tohints
- can be used to build the identifier of the object.
getCacheEntry
protected CacheEntry getCacheEntry(WorkingSet ws,
Object oid)
throws PersistenceException
finds or creates the CacheEntry matching to an identifier. If no cache
antry matching the identifier is found in the cache, an new instance
is created without state.
ws
- if the WorkingSet requiring a CacheEntry.oid
- the identifier of the expected cache entry
- a cache entry instance (never null).
PersistenceException
- if it is not possible to instanciate a
persistent object
listFc
public String[] listFc()
lookupFc
public Object lookupFc(String s)
refresh
public void refresh(WorkingSet ws,
CacheEntry ce)
throws PersistenceException
Forget modifications of a dirty persistent object. The state is re-read
from the cache or later from the database. Be carefull the lock for
the concurrency (read | write) is kept until the end of the context.
- refresh in interface PersistenceManager
ws
- is the current working setce
- is the cache entry of the persistent object
PersistenceException
-
refresh
public void refresh(WorkingSet ws,
Object oid)
throws PersistenceException
Forget modifications of a dirty persistent object. The state is re-read
from the cache or later from the database. Be carefull the lock for
the concurrency (read | write) is kept until the end of the context.
- refresh in interface PersistenceManager
ws
- is the current working setoid
- is the identifier of the persistent object
PersistenceException
-
unbind
public void unbind(WorkingSet ws,
CacheEntry ce)
throws PersistenceException
Detach a persistent object from the persistent support. After calling
this method the persistent object is no more associated to the context
and this instance is no more in the cache. If the persistent object has
been modified, it is flushed. Be carefull the lock for the concurrency
(read | write) is kept until the end of the context.
- unbind in interface PersistenceManager
ws
- is the current working setce
- is the cache entry of the persistent object
PersistenceException
-
unbind
public void unbind(WorkingSet ws,
Object oid)
throws PersistenceException
Detach a persistent object from the persistent support. After calling
this method the persistent object is no more associated to the context
and this instance is no more in the cache. If the persistent object has
been modified, it is flushed. Be carefull the lock for the concurrency
(read | write) is kept until the end of the context.
- unbind in interface PersistenceManager
ws
- is the current working setoid
- is the identifier of the persistent object
PersistenceException
-
unbindFc
public void unbindFc(String s)
unexport
public State unexport(WorkingSet ws,
CacheEntry ce)
throws PersistenceException
Deletes the binding between an in main-memory object, and its
corresponding copy in permanent support. At the same time, it
frees (may be) the space in the permanent support allocated to
the permanent copy.
- unexport in interface PersistenceManager
ce
- The identifier of the corresponding object to be
destroyed.
PersistenceException
-
unexport
public State unexport(WorkingSet ws,
Object oid)
throws PersistenceException
Deletes the binding between an in main-memory object, and its
corresponding copy in permanent support. At the same time, it
frees (may be) the space in the permanent support allocated to
the permanent copy.
- unexport in interface PersistenceManager
oid
- The identifier of the corresponding object to be
destroyed.
PersistenceException
-