Orbital library

orbital.util
Class Activation

java.lang.Object
  extended by java.lang.Throwable
      extended by orbital.util.Activation
All Implemented Interfaces:
java.io.Serializable

public abstract class Activation
extends java.lang.Throwable

Activation is the base class for conditional exception handling. It adds tracing, delegation and rejection to java's common terminal exception handling capabilities.

Conditional exceptions thrown with Activation semantics can be:

by implementing the raise method.

The creator should be set up as follows:

 // Activation derivative MyActivation
 Activation frame = new MyActivation(myCaller);
 try {
     // something like
     if (some_condition)
         frame.raise(some_exception_info);
 }
 catch (Activation a) {
     if (a != frame)
         throw a; // rethrow foreign conditional exceptions
     Object info = a.info();
     // deal with information somehow
 }
 

Conditional exceptions can be
resumed
after where the exception occured.
retried
when the operation that caused the exception is repeated under the new circumstances.
If their Activation instances are constructed such that they resume or retry the operations. Even ordinary terminal ones can do this, but only when used within their own try..catch blocks (and loops).

Author:
Axel-Tobias Schreiner, Bernd Kühl, André Platzer
See Also:
Throwable, Exception, Serialized Form

Constructor Summary
protected Activation(Activation caller)
          Creates a new activation.
 
Method Summary
protected  void handle(java.lang.Object information)
          Initiate normal exception handling in the corresponding catch-clause.
 java.lang.Object info()
          Get this exception's information that is to be handled.
 java.lang.Object raise(java.lang.Object information)
          Raises this conditional exception with additional information.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Activation

protected Activation(Activation caller)
Creates a new activation.

Parameters:
caller - the activation corresponding to the method that called this.
Method Detail

raise

public java.lang.Object raise(java.lang.Object information)
                       throws Activation
Raises this conditional exception with additional information. (Conditionally) sends an object up the activation chain.

This method should be overwritten in a concrete class to define reactional behaviour. It is called by a descendant to try to send an object back the activation chain. This implementation will deliver the conditional exception to the outer caller up the activation chain.

Conditional exceptions thrown with Activation semantics can be:

Parameters:
information - to be sent up the chain.
Returns:
the information sent back to descendant.
Throws:
Activation - to be caught by the creator who should retrieve the object by calling info().
java.lang.NullPointerException - if this is the first activation in a chain.

handle

protected final void handle(java.lang.Object information)
                     throws Activation
Initiate normal exception handling in the corresponding catch-clause. Sends an object back to the creator of this conditional exception in order to initiate normal exception handling in the corresponding try..catch block.

Parameters:
information - any informational data the finite catch-handler needs to know about the exception.
Throws:
Activation
See Also:
info()

info

public final java.lang.Object info()
Get this exception's information that is to be handled.

Returns:
information data to be handled, as stated in the call to handle(Object).
See Also:
handle(java.lang.Object), information

Orbital library
1.3.0: 11 Apr 2009

Copyright © 1996-2009 André Platzer
All Rights Reserved.