...
Update (23-05-2007): I've totally reimplemented persistent identifiers in DSpace as well (see PersistentIdentifiers ). As well as removing the Handle System dependency, they also use DAOs. -JR
Update (20-06-2007): After a bit of a hiatus while I PersistentIdentifiers I've come back to DAOs, and I've now (mostly) got them in place for Bitstreams as well. The two major classes that still need doing are EPerson and Group_; once they're done, there are a few others (eg:_ SupervisedItem_,_ WorkspaceItem_, etc) but they should be relatively simple._ -JR
...
The idea behind this class came from the realisation that Item.withdraw()
and Item.reinstate()
don't really make sense. What I'd much rather do is call (eg) ArchiveManager.withdrawItem(Item item)
.
I've been thinking that the ArchiveManager
could be used for certain maintenance operations as well, such as moving Items
between Collections
, and maybe acting as a wrapper for the CommunityFiliator
.
Code Block |
---|
public class ArchiveManager { public static void withdrawItem(Context context, Item item) { // ... } public static void reinstateItem(Context context, Item item) { // ... } public static void moveItem(Context context, Item item, Collection source, Collection dest) { // ... } } |
...
As suggested by Richard Jones, there probably ought to be a top-level general-purpose DAO interface that has implementations for the various storage mechanisms (GlobalDAOPostgres
etc). The idea is to have this top-level object capture any implementation-specific details in a single top-level object, rather than in every Postgres DAO implementation. For example, with the current database "abstraction layer", the top-level implementation of GlobalDAO
understands the Context
object, whereas a Hibernate implementation would know what a SessionFactory
is.
Code Block |
---|
public interface GlobalDAO { // The following methods actually currently throw SQLExceptions to // keep things simple, but in future SQLExceptions should be // eliminated from any code that doesn't directly touch a database. public void startTransaction() throws GlobalDAOException; public void endTransaction() throws GlobalDAOException; public void saveTransaction() throws GlobalDAOException; public void abortTransaction(); public boolean transactionOpen(); @Deprecated Connection getConnection(); } |
org.dspace.storage.dao.GlobalDAOFactory
Super-simple GlobalDAO
factory.
org.dspace.storage.dao.GlobalDAOPostgres
Implementation of the GlobalDAO
interface for PostgreSQL.
...