Pliny represents information about resources, annotations, notes, etc. using its data model. Pliny is largely built using the MVC (Model-View-Controller) paradigm, and here we speak about the "M" part of MVC -- the data model.
The Pliny-wide Model classes are found in package uk.ac.kcl.cch.jb.pliny.model. This package consists mainly of classes that represent data that Pliny is interested in -- resources, notes, reference objects, connections between them, object types, etc.. These must ableo to be persisted so that when the user returns to Pliny for another session another day the work s/he have done will be still there. There are also a few helper classes in this package which make implementation in GEF easier, but do not really have obvious persistence needs.
Persistence is achieved by storing the data in a relational database (Derby (http://db.apache.org/derby/) is used) and by creating classes that manage the DB data that are generated using a modified version of rdb2java -- a toolkit developed by me at CCH to facilitate the construction of web applications that work with RDB data. rdb2java (in its modified form) both manages persistence so that changes in values of data or relationships between instances are recorded automatically in the backing database, and it also makes sure that only a single instance of an object exists in memory that represents a particular instance of data in the DB. Once the data is created in memory for a particular instance of a DB table, this modified version of rdb2java will ensure that that same memory instance will always be given when a particular DB instance is required.
Here is an informal UML class diagram that shows the Pliny model classes and suggests the major relationships between them. Be aware that not all the associations between classes are shown here!
The role of the classes are:
Two classes in the other two Pliny plugins provide extensions to the Resource class so that information specific to the needs of those plugins can be stored there:
Deleting and Restoring rdb2java objects
A word about the use of rdb2java methods deleteMe() and reIntroduceMe() -- methods that come in all rdb2java generated classes. Recall that, in general, an instance in memory of an rdb2java class corresponds to a record in the backing store DB's corresponding table. deleteMe() requests that the record that corresponds to the instance in hand be deleted from the backing database. reIntroduceMe() requests that the memory instance in hand be introduced (perhaps "re"-introduced) into the DB as a record in the appropriate corresponding table. deleteMe(), then, by removing the record from the backing DB means that the data the memory instance holds is then no longer persistent -- it will be completely gone the next time Pliny is started although it will continue to exist in memory as long as other class instances hold references to it.
These two methods are particularly useful when operation that results in the removal of data from the DB needs to be undoable, as most delete operations in Pliny need to be. When the delete request is made against a particular instance of an rdb2java class by calling deleteMe(), the corresponding DB record is removed, but, of course the memory instance is still intact. If the user asks that the particular delete request be undone, then reIntroduceMe() can be called to recreate the same memory instance in the backing store DB.