org.nanocontainer.persistence
Class DefaultExceptionFactory

java.lang.Object
  extended by org.nanocontainer.persistence.DefaultExceptionFactory
All Implemented Interfaces:
ExceptionFactory

public class DefaultExceptionFactory
extends Object
implements ExceptionFactory

Default factory for the persistence exceptions

Version:
$Revision: $

Constructor Summary
DefaultExceptionFactory()
           
 
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultExceptionFactory

public DefaultExceptionFactory()
Method Detail

createPersistenceException

public RuntimeException createPersistenceException(Throwable cause)
Description copied from interface: ExceptionFactory
Creates an instance of the persistence exception. You should return cause if it is already an instance of Persistence's exception.

Specified by:
createPersistenceException in interface ExceptionFactory
Parameters:
cause - Original exception.
Returns:
The desired exception instance.

createConcurrencyFailureException

public RuntimeException createConcurrencyFailureException(Throwable cause)
Description copied from interface: ExceptionFactory
Creates an instance of the exception which indicates concurrency failure.

Specified by:
createConcurrencyFailureException in interface ExceptionFactory
Parameters:
cause - Original exception.
Returns:
The desired exception instance.

createStaleObjectStateException

public RuntimeException createStaleObjectStateException(Throwable cause,
                                                        String type,
                                                        Object id)
Description copied from interface: ExceptionFactory
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.

Specified by:
createStaleObjectStateException in interface ExceptionFactory
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

public RuntimeException createObjectRetrievalFailureException(Throwable cause,
                                                              String type,
                                                              Object id)
Description copied from interface: ExceptionFactory
Creates an instance of the exception which indicates that an object retrieval failure happens.

Specified by:
createObjectRetrievalFailureException in interface ExceptionFactory
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

public RuntimeException createTransactionException(Throwable cause)
Description copied from interface: ExceptionFactory
Creates an instance of the exception which indicates that a transaction could not be begun, committed or rolled back.

Specified by:
createTransactionException in interface ExceptionFactory
Parameters:
cause - Original exception.
Returns:
The desired exception instance.


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