SmartFrog 3.10.000

org.smartfrog.sfcore.common
Class SmartFrogException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by org.smartfrog.sfcore.common.SmartFrogException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
SmartFrogAssertionException, SmartFrogCompilationException, SmartFrogInitException, SmartFrogLogException, SmartFrogRuntimeException, SmartFrogUpdateException

public class SmartFrogException
extends java.lang.Exception
implements java.io.Serializable

Root of all SmartFrog-generated exceptions. All the exceptions in SmartFrog system should extend this exception.

See Also:
Serialized Form

Field Summary
static java.lang.String CONTEXT
          Attribute name for Context.
protected  Context cxt
          Context associated with the exception.
static java.lang.String DATA
          Additional informational data.
static java.lang.String EXCEPTION
          Attribute name for Exception.
static java.lang.String PRIM_COMPLETE_NAME
          Attribute name for primSFCompleteName in exceptioncontext.
static java.lang.String PRIM_CONTEXT
          Attribute name for primContect in exceptioncontext.
 
Constructor Summary
SmartFrogException()
          Constructs a SmartFrogException with no message.
SmartFrogException(java.lang.String message)
          Constructs a SmartFrogException with specified message.
SmartFrogException(java.lang.String message, Prim sfObject)
          Constructs a SmartFrogException with specified message.
SmartFrogException(java.lang.String message, java.lang.Throwable cause)
          Constructs a SmartFrogException with specified message and cause.
SmartFrogException(java.lang.String message, java.lang.Throwable cause, Prim sfObject)
          Constructs a SmartFrogException with specified message.
SmartFrogException(java.lang.Throwable cause)
          Constructs a SmartFrogException with specified cause.
SmartFrogException(java.lang.Throwable cause, Prim sfObject)
          Constructs a SmartFrogException with specified cause.
 
Method Summary
 boolean add(java.lang.Object key, java.lang.Object value)
          Adds new attritute to exception context only if it doesn't exist in the exception context.
 boolean contains(java.lang.Object value)
          Checks if some attribute exists in exception context.
 boolean containsKey(java.lang.Object value)
          Checks if some attribute exists in exception context.
static SmartFrogException forward(java.lang.String message, java.lang.Throwable thr)
          To forward SmartFrog exceptions instead of chain them.
static SmartFrogException forward(java.lang.Throwable thr)
          To forward SmartFrog exceptions instead of chain them.
 java.lang.Object get(java.lang.Object key)
          Gets the value of the attribute in the exception context.
 java.lang.String getCauseMessage(java.lang.String nm)
          Get the cause message
 Context getContext()
          Gets the context associated with the exception.
 void init(Prim sfObject)
          Initializes the exception context.
 void put(Context params)
          Puts additional context in the exception context.
 void put(java.lang.Object key, java.lang.Object value)
          Puts an attribute in key-value form in exception context.
 Context serializableContext(Context params)
          Converts a given context into a serializable one: Any value is converted toString().
 void setContext(Context newContext)
          Sets the context associated with the exception.
protected  java.lang.String shortClassName()
          Gets class name.
 java.lang.String toString()
          Gets a string representation of the exception.
 java.lang.String toString(java.lang.String nm)
          Gets a string representation of the exception.
 java.lang.String toStringAll()
          Gets a detailed string representation of the exception.
 java.lang.String toStringAll(java.lang.String nm)
          Gets a detailed string representation of the exception.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CONTEXT

public static final java.lang.String CONTEXT
Attribute name for Context.

See Also:
Constant Field Values

EXCEPTION

public static final java.lang.String EXCEPTION
Attribute name for Exception.

See Also:
Constant Field Values

DATA

public static final java.lang.String DATA
Additional informational data.

See Also:
Constant Field Values

cxt

protected Context cxt
Context associated with the exception.


PRIM_CONTEXT

public static final java.lang.String PRIM_CONTEXT
Attribute name for primContect in exceptioncontext.

See Also:
Constant Field Values

PRIM_COMPLETE_NAME

public static final java.lang.String PRIM_COMPLETE_NAME
Attribute name for primSFCompleteName in exceptioncontext.

See Also:
Constant Field Values
Constructor Detail

SmartFrogException

public SmartFrogException()
Constructs a SmartFrogException with no message.


SmartFrogException

public SmartFrogException(java.lang.String message)
Constructs a SmartFrogException with specified message.

Parameters:
message - exception message

SmartFrogException

public SmartFrogException(java.lang.Throwable cause)
Constructs a SmartFrogException with specified cause.

Parameters:
cause - exception causing this exception

SmartFrogException

public SmartFrogException(java.lang.String message,
                          java.lang.Throwable cause)
Constructs a SmartFrogException with specified message and cause.

Parameters:
message - exception message
cause - exception causing this exception

SmartFrogException

public SmartFrogException(java.lang.String message,
                          Prim sfObject)
Constructs a SmartFrogException with specified message. Also initializes the exception context with component details.

Parameters:
message - exception message
sfObject - The Component that has encountered the exception

SmartFrogException

public SmartFrogException(java.lang.Throwable cause,
                          Prim sfObject)
Constructs a SmartFrogException with specified cause. Also initializes the exception context with component details.

Parameters:
cause - cause of the exception
sfObject - The Component that has encountered the exception

SmartFrogException

public SmartFrogException(java.lang.String message,
                          java.lang.Throwable cause,
                          Prim sfObject)
Constructs a SmartFrogException with specified message. Also initializes the exception context with component details.

Parameters:
message - message
cause - exception causing this exception
sfObject - The Component that has encountered the exception
Method Detail

forward

public static SmartFrogException forward(java.lang.Throwable thr)
To forward SmartFrog exceptions instead of chain them.

Parameters:
thr - throwable object to be forwarded
Returns:
Throwable that is a SmartFrogException

forward

public static SmartFrogException forward(java.lang.String message,
                                         java.lang.Throwable thr)
To forward SmartFrog exceptions instead of chain them. If thr is an instance of SmartFrogException then the exception is returned without any modification, if not a new SmartFrogException is created with message as a paramenter

Parameters:
message - String message
thr - throwable object to be forwarded
Returns:
Throwable that is a SmartFrogException

getContext

public Context getContext()
Gets the context associated with the exception.

Returns:
Exception context
See Also:
setContext(org.smartfrog.sfcore.common.Context)

setContext

public void setContext(Context newContext)
Sets the context associated with the exception.

Parameters:
newContext - The context associated with exception
See Also:
getContext()

put

public void put(Context params)
Puts additional context in the exception context. This method can be used to add more information as exception propagates in the call chain.

Parameters:
params - Additional Context

serializableContext

public Context serializableContext(Context params)
Converts a given context into a serializable one: Any value is converted toString().

Parameters:
params - Additional Context
Returns:
Context

get

public java.lang.Object get(java.lang.Object key)
Gets the value of the attribute in the exception context.

Parameters:
key - name of the attribute to be retrieved from the error context
Returns:
value of the attribute

put

public void put(java.lang.Object key,
                java.lang.Object value)
Puts an attribute in key-value form in exception context.

Parameters:
key - name of the attribute
value - value of the attribute

add

public boolean add(java.lang.Object key,
                   java.lang.Object value)
Adds new attritute to exception context only if it doesn't exist in the exception context.

Parameters:
key - name of the attribute
value - value of the attribute
Returns:
boolean true if the attribute was added.

contains

public boolean contains(java.lang.Object value)
Checks if some attribute exists in exception context.

Parameters:
value - value of the attribute
Returns:
boolean true if the attribute exists

containsKey

public boolean containsKey(java.lang.Object value)
Checks if some attribute exists in exception context.

Parameters:
value - attribute name
Returns:
boolean true if the attribute exists

init

public void init(Prim sfObject)
Initializes the exception context.

Parameters:
sfObject - SmartFrog Component

toString

public java.lang.String toString()
Gets a string representation of the exception.

Overrides:
toString in class java.lang.Throwable
Returns:
string representation of the exception

toString

public java.lang.String toString(java.lang.String nm)
Gets a string representation of the exception.

Parameters:
nm - Message separator (ex. "\n");
Returns:
String this object to String.

getCauseMessage

public java.lang.String getCauseMessage(java.lang.String nm)
Get the cause message

Parameters:
nm - Message separator (ex. "\n");
Returns:
cause message

toStringAll

public java.lang.String toStringAll()
Gets a detailed string representation of the exception.

Returns:
string representation of the exception

toStringAll

public java.lang.String toStringAll(java.lang.String nm)
Gets a detailed string representation of the exception.

Parameters:
nm - Message separator (ex. "\n");
Returns:
string representation of the exception

shortClassName

protected java.lang.String shortClassName()
Gets class name.

Returns:
Class name

SmartFrog CORE 3.10.000

(C) Copyright 1998-2006 Hewlett-Packard Development Company, LP