net.sourceforge.hiveutils.service.impl
Class DefaultExceptionMapper

java.lang.Object
  extended by net.sourceforge.hiveutils.service.impl.DefaultExceptionMapper
All Implemented Interfaces:
ExceptionMapper

public class DefaultExceptionMapper
extends java.lang.Object
implements ExceptionMapper

Default implementation of ExceptionMapper, based on a ClassMatcher to do the exception translation.

It can be instantiated directly by the AdapterBuilderFactory depending on the parameters specified in the module descriptor.

Author:
Jean-Francois Poilpret

Field Summary
protected static int CTOR_ALL
           
protected static int CTOR_STRING
           
protected static int CTOR_THROWABLE
           
protected static int NUM_CTORS
           
 
Constructor Summary
DefaultExceptionMapper(org.apache.commons.logging.Log logger, ClassMatcher matcher)
          Constructs the ExceptionMapper from the passed ClassMatcher.
 
Method Summary
protected static java.lang.reflect.Constructor getConstructor(java.lang.Class clazz, java.lang.Class[] args)
           
protected static java.lang.reflect.Constructor[] getConstructors(java.lang.Class clazz)
           
 java.lang.Throwable translate(java.lang.Throwable t)
          Converts a Throwable into another.
protected  java.lang.Throwable wrapThrowable(java.lang.Class clazz, java.lang.Throwable source)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CTOR_ALL

protected static final int CTOR_ALL
See Also:
Constant Field Values

CTOR_THROWABLE

protected static final int CTOR_THROWABLE
See Also:
Constant Field Values

CTOR_STRING

protected static final int CTOR_STRING
See Also:
Constant Field Values

NUM_CTORS

protected static final int NUM_CTORS
See Also:
Constant Field Values
Constructor Detail

DefaultExceptionMapper

public DefaultExceptionMapper(org.apache.commons.logging.Log logger,
                              ClassMatcher matcher)
Constructs the ExceptionMapper from the passed ClassMatcher.

Parameters:
logger - logger to be used for warnings
matcher - the matcher used to find how to translate thrown exceptions
Method Detail

translate

public java.lang.Throwable translate(java.lang.Throwable t)
Description copied from interface: ExceptionMapper
Converts a Throwable into another.

Specified by:
translate in interface ExceptionMapper
Parameters:
t - Throwable that is to be converted
Returns:
the new Throwable that replaces t

wrapThrowable

protected java.lang.Throwable wrapThrowable(java.lang.Class clazz,
                                            java.lang.Throwable source)

getConstructors

protected static java.lang.reflect.Constructor[] getConstructors(java.lang.Class clazz)

getConstructor

protected static java.lang.reflect.Constructor getConstructor(java.lang.Class clazz,
                                                              java.lang.Class[] args)