001    package com.sptci.prevayler;
002    
003    import java.util.Date;
004    
005    /**
006     * An interface that captures the interactions supported by the object
007     * database system.
008     *
009     * <p>&copy; Copyright 2008 <a href='http://sptci.com/' target='_top'>Sans
010     * Pareil Technologies, Inc.</a></p>
011     *
012     * @author Rakesh 2008-11-19
013     * @version $Id: DatabaseSystem.java 22 2008-11-24 19:04:25Z sptrakesh $
014     */
015    public interface DatabaseSystem extends AbstractDatabase<PrevalentObject>
016    {
017      /**
018       * Save the specified prevalent object to the prevalent system.  Objects
019       * not already persistent are added to the system, while already persistent
020       * objects are updated.
021       *
022       * @param object The prevalent object to be saved in the system.
023       * @param executionTime The time at which the transaction was executed.
024       * @return The potentially modified prevalent object.
025       * @throws PrevalentException If errors are encountered while
026       *   adding/updating the object.  Errors thrown could indicate constraint
027       *   violations.
028       */
029      PrevalentObject save( final PrevalentObject object,
030          final Date executionTime ) throws PrevalentException;
031    
032      /**
033       * Delete the specified prevalent object from the prevalent system.
034       * Processes cascading delete rules if so configured.
035       *
036       * @param object The prevalent object to delete.
037       * @param executionTime The datetime at which the transaction was executed.
038       * @return The deleted object with potential modifications.
039       * @throws com.sptci.prevayler.PrevalentException If errors are encountered while deleting the
040       *   prevalent object.
041       */
042      PrevalentObject delete( PrevalentObject object, Date executionTime )
043          throws PrevalentException;
044    }