Redstone Prevalent Storage is a minimalistic prevalence layer for Java SE 5.0 that may replace JDBC and RDBMS for small or mid-sized applications. It is comprised of an intentionally small set of concise interfaces and classes for immediate use or specialization.

Credit goes go to Klaus Wuestefeld and the Prevayler team from which this library is heavily influenced


For those new to the concept, prevalent systems are normally characterized by the following properties:
  • The domain model is represented by an object graph that is fully stored in memory when the application is running.
  • All modifications to the model are made exclusively by transaction objects written in Java. All transactions are executed in isolation from other transactions and queries (see below). Transaction objects are stored permanently (in files on disk, most likely) in transaction logs to support recovery.
  • All non-mutating access to the model is made in query objects that may run in parallel with other query objects.
  • At regular intervals (or at select points like before application shutdown) the model is permanently stored in a snapshot (again, likely in a file on disk depending on the implementation used). When the application starts again, the snapshot is loaded and all transactions in the log that were made after the snapshot was made are executed again on the model to recover it to its latest state.

When is it useful?

Using a prevalence layer instead of a relational database and an O/R mapping facility or JDBC, can be advantageous in a couple of scenarios;
  • There is no need for O/R mapping, everything is done in Java within the JVM, directly on the domain model. This can make some applications faster to develop especially if the developer knows little of databases.
  • Access to the model is done in Java code against a regular object graph that is entirely stored in memory. This makes accessing the model extremely fast which not only can lead to good performance but may also help developers to use coarser forms of thread synchronization which will help keep the complexity of the source code to a minimum, and result in simpler design in general.
  • Several other benefits that tend to be a matter of taste according to various discussions for and against Object Prevalence (Google)


The library is comprised of a series of interfaces that are accompanied by default implementations. The fundamental interfaces are;
  • Transaction - represents some modification to a domain model.
  • Query - represents some query against the domain model.
  • Log - represents a persistent log (or journal) of transactions made to the model.
  • Snapshot - represents a complete and persistent snapshot of the domain model.
  • Storage - represents the complete storage that can execute transactions and queries.

Default Implementations

The following classes implements the interfaces above and represent the default implementation. Each of the classes may be replaced or extended by an application.
  • LogImpl - uses a Serializer to store transactions using some kind of serialization mechanism.
  • SnapshotImpl - also uses a Serializer to store the snapshot using some kind of serialization.
  • Serializer - an interface representing some form of serialization, used by SnapshotImpl and LogImpl
  • SerializerImpl - default serializer using Java serialization.
  • StorageImpl - default implementation using any Log and Snapshot to fulfil its responsibilities.


The CVS repository does not contain any examples yet. A complete application using the prevalence layer is expected to be added in a separate CVS module within a near future. For reference, the Redstone Prevalence Layer is very similar to Prevayler which also contains a few examples. Although not compatible with this library, the idea should get through.

More to come


The source code and the pre-built JAR is kindly hosted by SourceForge

Thank You!

Copyright © 2005 Redstone Handelsbolag