Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: 'code' markup some object names

...

As part of the same effort, I have done some work on making the Context less data-layer dependent (by having it hold a org.dspace.storage.dao.GlobalDAO rather than a java.sql.Connection, etc). I've also introduced a proxy for the Item that is a bit smarter about when it retrieves content from the data layer, and an ArchiveManager class that takes care of some core "archive operations" (so that other core classes don't need to).

...

The Item class will be broken up into the following classes:

  • org.dspace.content.Item: core class that doesn't go near the database (it doesn't even know about the DAOs); behaves much like the current implementation.
  • org.dspace.content.dao.ItemDAO: interface defining DAO API
  • org.dspace.content.dao.ItemDAOFactory: factory for dishing out implementations of the above interface
  • org.dspace.content.dao.postgres.ItemDAOPostgres: default implementation of the above interface for use with PostgreSQL
  • org.dspace.content.proxy.ItemProxy: subclass of Item that needs to know about the DAO. It will be used for (eg) only loading metadata on demand, to reduce the memory footprint of Items etc.

The following classes have also been introduced:

  • org.dspace.core.ArchiveManager
  • org.dspace.storage.dao.GlobalDAO
  • org.dspace.storage.dao.GlobalDAOFactory
  • org.dspace.storage.dao.GlobalDAOPostgres

Note that it might be preferable to have a more generic implementation of the ItemDAO interface that supports both PostgreSQL and Oracle, but given that one motivation for adopting DAOs is to remove db-specificities from the code making it easier to port, I thought it was sensible to start with just PostgreSQL. Eventually, it ought to be possible to drop in ItemDAOHibernate (etc) implementations that make db portability far easier.

...

This isn't final, but it's a good start. 

Code Block
public interface ItemDAO extends ContentDAO
    implements CRUD<Item>, Link<Item, Bundle>
{
    public Item create() throws AuthorizeException;
    public Item retrieve(int id);
    public Item retrieve(UUID uuid);
    public void update(Item item) throws AuthorizeException;
    public void delete(int id) throws AuthorizeException;
    public List<Item> getItems();
    public List<Item> getItemsBySubmitter(EPerson eperson);
    public List<Item> getItemsByCollection(Collection collection);
    public List<Item> getParentItems(Bundle bundle);
}

...