com.gridsystems.innergrid.kernel
Class KernelException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.io.IOException
              extended by java.rmi.RemoteException
                  extended by org.apache.axis.AxisFault
                      extended by com.gridsystems.innergrid.kernel.KernelException
All Implemented Interfaces:
Kernelizable, java.io.Serializable
Direct Known Subclasses:
CKernelException

public class KernelException
extends org.apache.axis.AxisFault
implements Kernelizable

Exception type for all published APIs.

All exceptions should be converted into a KernelException before being thrown in a public API method. Internal methods can also throw a KernelException if an error is considered to be of interest for a public API calling them.

Subclassing is highly encouraged for improving code readability and maintainability. For those cases where another base exception class is mandatory, see the Kernelizable interface.

IMPORTANT: The parameter list is transferred to the client side as a string list. Methods for parsing those strings will be convenient if there is a need of obtaining the original values in the client.

Author:
Rodrigo Ruiz
See Also:
Kernelizable, Serialized Form

Field Summary
protected  java.lang.String msg
          The message for this exception.
protected  java.lang.Object[] params
          The list of error message parameters.
protected  java.lang.String pattern
          The pattern used to generate the message.
 
Fields inherited from class org.apache.axis.AxisFault
faultActor, faultCode, faultDetails, faultHeaders, faultNode, faultString, faultSubCode, log
 
Fields inherited from class java.rmi.RemoteException
detail
 
Constructor Summary
KernelException(javax.xml.namespace.QName code, java.lang.String pattern, java.lang.Object[] params, java.lang.Throwable cause)
          Deprecated.  
KernelException(java.lang.String code, java.lang.String pattern, java.lang.Object[] params, java.lang.Throwable cause)
          Deprecated.  
KernelException(java.lang.Throwable cause, javax.xml.namespace.QName code, java.lang.String pattern, java.lang.Object... params)
          Creates an instance with a fixed message (no I18N).
KernelException(java.lang.Throwable cause, java.lang.String code, java.lang.String pattern, java.lang.Object... params)
          Creates an instance with a fixed message (no I18N).
 
Method Summary
static KernelException fromRemoteException(java.rmi.RemoteException e)
          Parses a RemoteException instance, and if it contains a KernelException, returns a properly initialized one.
 java.lang.String getCode()
          Gets this instance error code.
 java.lang.String getMessage()
          Gets this exception message.
 java.lang.String getNamespace()
          Gets this fault code namespace.
 java.lang.Object[] getParams()
          Gets the list of parameters for this exception message.
 java.lang.String getPattern()
          Gets this exception pattern.
 boolean hasCode(java.lang.String code)
          Compares this instance error code with the specified one and returns true if they are equals.
 void output(org.apache.axis.encoding.SerializationContext context)
          Fixes the internal AxisFault detail list with the extensions of KernelException.
protected  void prepare()
          Inserts all non-standard field values as XML elements into the details section of the SOAP exception.
 void printStackTrace(java.io.PrintStream out)
          Stripped stacktrace.
 void printStackTrace(java.io.PrintWriter out)
          Stripped stacktrace.
 KernelException toKernelException()
          Converts this instance into a KernelException.
 java.lang.String toString()
          Overrides the default implementation, returning the concatenation of this exception code and message.
 
Methods inherited from class org.apache.axis.AxisFault
addFaultDetail, addFaultDetail, addFaultDetailString, addFaultSubCode, addFaultSubCodeAsString, addHeader, addHostname, addHostnameIfNeeded, clearFaultDetails, clearFaultSubCodes, clearHeaders, dump, dumpToString, getFaultActor, getFaultCode, getFaultDetails, getFaultNode, getFaultReason, getFaultRole, getFaultString, getFaultSubCodes, getHeaders, initFaultSubCodes, lookupFaultDetail, makeFault, removeFaultDetail, removeHostname, setFaultActor, setFaultCode, setFaultCode, setFaultCodeAsString, setFaultDetail, setFaultDetailString, setFaultNode, setFaultReason, setFaultRole, setFaultString, writeDetails
 
Methods inherited from class java.rmi.RemoteException
getCause
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getLocalizedMessage, getStackTrace, initCause, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

msg

protected java.lang.String msg
The message for this exception.


pattern

protected java.lang.String pattern
The pattern used to generate the message.


params

protected java.lang.Object[] params
The list of error message parameters.

Constructor Detail

KernelException

public KernelException(java.lang.String code,
                       java.lang.String pattern,
                       java.lang.Object[] params,
                       java.lang.Throwable cause)
Deprecated. 

Creates an instance with a fixed message (no I18N).

Parameters:
code - The error code
pattern - The message pattern (without parameter replacement)
params - The error message parameters
cause - The root cause

KernelException

public KernelException(javax.xml.namespace.QName code,
                       java.lang.String pattern,
                       java.lang.Object[] params,
                       java.lang.Throwable cause)
Deprecated. 

Creates an instance with a fixed message (no I18N).

Parameters:
code - The fully qualified error code
pattern - The message pattern (without parameter replacement)
params - The error message parameters
cause - The root cause

KernelException

public KernelException(java.lang.Throwable cause,
                       java.lang.String code,
                       java.lang.String pattern,
                       java.lang.Object... params)
Creates an instance with a fixed message (no I18N).

Parameters:
cause - Root cause
code - Error code
pattern - Message pattern (without parameter replacement)
params - Message parameters

KernelException

public KernelException(java.lang.Throwable cause,
                       javax.xml.namespace.QName code,
                       java.lang.String pattern,
                       java.lang.Object... params)
Creates an instance with a fixed message (no I18N).

Parameters:
cause - Root cause
code - Fully qualified error code
pattern - Message pattern (without parameter replacement)
params - Message parameters
Method Detail

getCode

public java.lang.String getCode()
Gets this instance error code.

Returns:
The error code of this exception

hasCode

public boolean hasCode(java.lang.String code)
Compares this instance error code with the specified one and returns true if they are equals.

Parameters:
code - The code to compare to
Returns:
true if the specified code is equals to this instance one

getNamespace

public java.lang.String getNamespace()
Gets this fault code namespace.

Returns:
The faul code namespace

getParams

public java.lang.Object[] getParams()
Gets the list of parameters for this exception message.

Returns:
The message parameters list

getMessage

public java.lang.String getMessage()
Gets this exception message.

The message is obtained from the pattern and the list of parameters.

Overrides:
getMessage in class java.rmi.RemoteException
Returns:
the message for this exception

getPattern

public java.lang.String getPattern()
Gets this exception pattern.

Returns:
This exception pattern.

toString

public java.lang.String toString()
Overrides the default implementation, returning the concatenation of this exception code and message.

Overrides:
toString in class org.apache.axis.AxisFault
Returns:
a human-readable description of this instance

fromRemoteException

public static KernelException fromRemoteException(java.rmi.RemoteException e)
Parses a RemoteException instance, and if it contains a KernelException, returns a properly initialized one. Otherwise, it wraps the Exception into a KernelException with UNK000 code

Parameters:
e - The source remote exception
Returns:
A properly initialized KernelException instance

toKernelException

public KernelException toKernelException()
Converts this instance into a KernelException.

Specified by:
toKernelException in interface Kernelizable
Returns:
a KernelException instance equivalent to this

output

public void output(org.apache.axis.encoding.SerializationContext context)
            throws java.lang.Exception
Fixes the internal AxisFault detail list with the extensions of KernelException.

Overrides:
output in class org.apache.axis.AxisFault
Parameters:
context - The serialization context passed from the Axis servlet
Throws:
java.lang.Exception - if an error occurs while serializing the exception

prepare

protected void prepare()
Inserts all non-standard field values as XML elements into the details section of the SOAP exception.


printStackTrace

public void printStackTrace(java.io.PrintWriter out)
Stripped stacktrace.

Overrides:
printStackTrace in class org.apache.axis.AxisFault

printStackTrace

public void printStackTrace(java.io.PrintStream out)
Stripped stacktrace.

Overrides:
printStackTrace in class org.apache.axis.AxisFault


Copyright © 2007-2008 Grid Systems, S.A.. All Rights Reserved.