Dekoh platform API

dekoh.portal.fwk.importer
Class ImportTrasactionManager

java.lang.Object
  extended by dekoh.portal.fwk.importer.ImportTrasactionManager
All Implemented Interfaces:
ImportSubProcessObserver

public class ImportTrasactionManager
extends Object
implements ImportSubProcessObserver

PersistenceTransactionManager is used by DBOperationsSubProcess for managing transactions.Transaction policy followed is

  • If transaction is not already active begin a transaction before persisting a file
  • Commit transaction if end of a directory is reached OR
  • Commit transaction if #ImportConfig.getNumberOfFilesInBatch has reached OR
  • Commit transaction if all files scheduled for persistence have been persisted
  • Commit transaction if transaction if active when import process is interrupted by user
  • Rollback transaction if active when import process is completed

    PersistenceTransactionManager also has a instance of ProgressObjectWriter which it updates once a file has been persisted. Once a directory has been commited this also updates the hash for that directory

    Since:
    Feb 29, 2008

    Constructor Summary
    ImportTrasactionManager(ImportContext importContext, ImportProgressObject importProgressObject, ImportProcessor importProcessor, ProgressObjectWriter progressObjectWriter)
               
     
    Method Summary
     void done()
              If PersistencePool is shutdown and is not more acception ImportRequest progressObject is updated, an transactions if active are rolledback
     void handleError(ImportRequest importRequest, ImportStatus failureType, String errorMessage)
               
     void handleError(ImportRequest importRequest, ImportStatus failureType, Throwable failure, String errorMessage)
              Callback given by ImportTaskExecutor when a error has ocuured while executing an ImportRequest
     void handleFatalError(ImportRequest importRequest, Throwable failure, String errorMessage)
               
     boolean isStopped()
               
     void postExecution(ImportRequest importRequest, ImportStatus importStatus)
              Updates progress of persistence to #progressObjectWriter
     void preExecution(ImportRequest importRequest)
              begins the transaction if not already active
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Constructor Detail

    ImportTrasactionManager

    public ImportTrasactionManager(ImportContext importContext,
                                   ImportProgressObject importProgressObject,
                                   ImportProcessor importProcessor,
                                   ProgressObjectWriter progressObjectWriter)
    Method Detail

    preExecution

    public void preExecution(ImportRequest importRequest)
    begins the transaction if not already active

    Specified by:
    preExecution in interface ImportSubProcessObserver
    Parameters:
    importRequest - to be executed request

    postExecution

    public void postExecution(ImportRequest importRequest,
                              ImportStatus importStatus)
    Updates progress of persistence to #progressObjectWriter

    Specified by:
    postExecution in interface ImportSubProcessObserver
    Parameters:
    importRequest - importRequest which has been persisted
    importStatus - status of DigitalObject after persisting

    handleFatalError

    public void handleFatalError(ImportRequest importRequest,
                                 Throwable failure,
                                 String errorMessage)
    Specified by:
    handleFatalError in interface ImportSubProcessObserver

    handleError

    public void handleError(ImportRequest importRequest,
                            ImportStatus failureType,
                            Throwable failure,
                            String errorMessage)
    Description copied from interface: ImportSubProcessObserver
    Callback given by ImportTaskExecutor when a error has ocuured while executing an ImportRequest

    Specified by:
    handleError in interface ImportSubProcessObserver
    Parameters:
    importRequest - failed request
    failureType - Failure status of request
    failure - Failure Cause
    errorMessage - error message to be logged/shown to user

    handleError

    public void handleError(ImportRequest importRequest,
                            ImportStatus failureType,
                            String errorMessage)
    Specified by:
    handleError in interface ImportSubProcessObserver

    done

    public void done()
    If PersistencePool is shutdown and is not more acception ImportRequest progressObject is updated, an transactions if active are rolledback

    Specified by:
    done in interface ImportSubProcessObserver

    isStopped

    public boolean isStopped()
    Specified by:
    isStopped in interface ImportSubProcessObserver
    Returns:
    true is user has requested for a interruption

    Dekoh platform API

    © 2009 Pramati Technologies - Dekoh - Portal for Developers