org.nanocontainer.persistence
Interface ExceptionFactory

All Known Implementing Classes:
DefaultExceptionFactory

public interface ExceptionFactory

Factory component used by ExceptionHandler in order to create exceptions.

Version:
$Revision: $

Method Summary
 RuntimeException createConcurrencyFailureException(Throwable cause)
          Creates an instance of the exception which indicates concurrency failure.
 RuntimeException createObjectRetrievalFailureException(Throwable cause, String type, Object id)
          Creates an instance of the exception which indicates that an object retrieval failure happens.
 RuntimeException createPersistenceException(Throwable cause)
          Creates an instance of the persistence exception.
 RuntimeException createStaleObjectStateException(Throwable cause, String type, Object id)
          Creates an instance of the exception which indicates that the version number or timestamp check failed or try delete or update a row that does not exist anymore.
 RuntimeException createTransactionException(Throwable cause)
          Creates an instance of the exception which indicates that a transaction could not be begun, committed or rolled back.
 

Method Detail

createPersistenceException

RuntimeException createPersistenceException(Throwable cause)
Creates an instance of the persistence exception. You should return cause if it is already an instance of Persistence's exception.

Parameters:
cause - Original exception.
Returns:
The desired exception instance.

createConcurrencyFailureException

RuntimeException createConcurrencyFailureException(Throwable cause)
Creates an instance of the exception which indicates concurrency failure.

Parameters:
cause - Original exception.
Returns:
The desired exception instance.

createStaleObjectStateException

RuntimeException createStaleObjectStateException(Throwable cause,
                                                 String type,
                                                 Object id)
Creates an instance of the exception which indicates that the version number or timestamp check failed or try delete or update a row that does not exist anymore. It should be subclass of the one which indicates concurrency failure.

Parameters:
cause - Original exception.
type - A string which indicate which entity it has happened or null if it can't be determined.
id - The id representation of its object or null if it can't be determined.
Returns:
The desired exception instance.

createObjectRetrievalFailureException

RuntimeException createObjectRetrievalFailureException(Throwable cause,
                                                       String type,
                                                       Object id)
Creates an instance of the exception which indicates that an object retrieval failure happens.

Parameters:
cause - Original exception.
type - A string which indicate which entity it has happened or null if it can't be determined.
id - The id representation of its object or null if it can't be determined.
Returns:
The desired exception instance.

createTransactionException

RuntimeException createTransactionException(Throwable cause)
Creates an instance of the exception which indicates that a transaction could not be begun, committed or rolled back.

Parameters:
cause - Original exception.
Returns:
The desired exception instance.


Copyright 2003-2003-2006 Codehaus. All Rights Reserved.