JWarp Persistence - The
Components
The Components
The JWarp persistence framework consists of
several components that have to implement the following features. For
more detailed information click on the components' names (where a
link is available).
- Persistence Context . The
Persistence Context is the main component that actually loads all
the following modules. The classes of the modules can be
configured within the XML configuration. The persistence context
passes the corresponding tags (and all respective sub-tags) to the
created modules through their configuration
interface.
- Locks incorporate access rights
granted to transaction on an object. Read locks are shared,
whereas exclusive read locks and write locks do not allow the
existence of any other locks on the same object.
- Transactions are the instances that
are actually holding a set of locks. Transactions are started,
stopped, can be commited, aborted or rollback-ed.
- Lock Engine. The Lock Engine is
responsible for managing all objects' states, active transactions
and corresponding transactional locks. If objects are created or
loaded from the underlying persistence, the current object state
is stored in the lock engine. The Lock Engine also creates and
checks Object locks. The default implementation -- you can plug in
your own lock engine when you implement the
org.jwarp.persist.engine.ILockEngine interface --
additionally supports timeouts for transactions and locks in order
to avoid that not-handled locks and transactions are accumulated
and jam the application in case of errors.
- Instance Cache. The Instance Cache
is used to store the loaded objects. If an object is read by an
operation or referenced through another object, the cache is first
called to examine if the object is still present. The given cache
implementation uses the generic cache from JWarp core.
- Type Manager. The Type Manager is a
kind of alias manager that manages the mapping of strings within
the XML configuration. If, for example, you type
"String" ,
it will be mapped to 'java.lang.String',
or if you type "int", it will be mapped to the
'int.class or java.lang.Integer'.
Additional mappings can also be configured.
- Class Descriptor Engine. The Class
Descriptor Engine is responsible for reading the descriptions of
the classes that are to be mapped with the persistence framework.
Note that the descriptions are shared for all mappings. The
descriptors also offer accessor objects to access the object's
value so the persistence drivers that operate on the objects can
operate on these accessors. The Generator Manager Part is also
part of the Descriptor Engine. It manages the field value
generators. A common use case is reading and inserting database
generated identity numbers. Yet, since generators can be executed
at any time before or after a database operation, the mechanism is
a simple field level trigger mechanism.
- Driver Manager. The Driver Manager
holds all persistence drivers that should be loaded through this
JDO. For each driver the driver manager tries to load a mapping.
If you like to completely reimplement a persistence driver, you
have to implement the
org.jwarp.persist.driver.IPersistenceDriver.