at.gv.egovernment.moa.spss.server.invoke
Class IaikExceptionMapper

java.lang.Object
  |
  +--at.gv.egovernment.moa.spss.server.invoke.IaikExceptionMapper

public class IaikExceptionMapper
extends Object

Map an exception from the iaik namespace to a MOAException.

Version:
$Id$
Author:
Patrick Peck

Constructor Summary
protected IaikExceptionMapper()
          Create a new IaikExceptionMapper.
 
Method Summary
protected  MOAException createMoaException(Exception iaikException)
          Create a MOAException from a given IAIKException by looking it up in the mapping.
static IaikExceptionMapper getInstance()
          Get the single instance of this class.
protected  at.gv.egovernment.moa.spss.server.invoke.ExceptionMappingInfo lookupMessage(Class iaikExceptionClass)
          Recursively look up the message associated with an IAIKException.
 MOAException map(iaik.IAIKException iaikException)
          Map an IAIKException to a MOAException.
 MOAException map(iaik.IAIKRuntimeException iaikException)
          Map an IAIKRuntimeException to a MOAException.
protected  void registerMessage(Class iaikExceptionClass, String messageId, Class moaExceptionClass)
          Register a single IAIKException to message mapping.
protected  void registerMessages()
          Build the complete IAIKException to message code mapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IaikExceptionMapper

protected IaikExceptionMapper()
Create a new IaikExceptionMapper. Protected to disallow multple instances.
Method Detail

getInstance

public static IaikExceptionMapper getInstance()
Get the single instance of this class.
Returns:
The single instance of this class.

registerMessages

protected void registerMessages()
Build the complete IAIKException to message code mapping.

registerMessage

protected void registerMessage(Class iaikExceptionClass,
                               String messageId,
                               Class moaExceptionClass)
Register a single IAIKException to message mapping.
Parameters:
iaikExceptionClass - An exception from the iaik package.
messageId - The corresponding error message id.
moaExceptionClass - The type of MOAException that the IAIKException is mapped to (usually MOAApplicationException or MOASystemException).

map

public MOAException map(iaik.IAIKException iaikException)
Map an IAIKException to a MOAException.
Parameters:
iaikException - The IAIKException to map.
Returns:
A MOAException containing the message for the given IAIKException.

map

public MOAException map(iaik.IAIKRuntimeException iaikException)
Map an IAIKRuntimeException to a MOAException.
Parameters:
iaikException - The IAIKException to map.
Returns:
A MOAException containing the message for the given IAIKRuntimeException.

createMoaException

protected MOAException createMoaException(Exception iaikException)
Create a MOAException from a given IAIKException by looking it up in the mapping.
Parameters:
iaikException - The IAIKException to map.
Returns:
A MOAException with an error code corresponding to the given IAIKException. Returns null, if no mapping could be found.

lookupMessage

protected at.gv.egovernment.moa.spss.server.invoke.ExceptionMappingInfo lookupMessage(Class iaikExceptionClass)
Recursively look up the message associated with an IAIKException. This method walks up the exception inheritance hierarchy until it finds a mapping.
Parameters:
iaikExceptionClass - The IAIKException to look up.
Returns:
Information about the message id and MOAException class that the iaikExceptionClass maps to. If no mapping could be found, null is returned.