ABLE 2.0.0 07/02/2003 10:25:01

com.ibm.able
Class AbleException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--java.io.IOException
                    |
                    +--java.rmi.RemoteException
                          |
                          +--com.ibm.able.AbleException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AbleDataException, AbleParException

public class AbleException
extends java.rmi.RemoteException
implements java.io.Serializable

The AbleException class defines an from which all other subpackages may extend their own exceptions. Its unique features support:

  1. A message severity, expected to be Able.MSG_INFO, Able.MSG_WARNING, or Able.MSG_ERROR, or Able.MSG_UNSPECIFIED.
  2. A reference to the object that produced the error.
  3. A collection of AbleException entities.
  4. A message container which includes a key and substitution text for creating a localized message at a later time.

See Also:
Serialized Form

Field Summary
protected  AbleMessageContainer myMessageContainer
          Instead of a pre-resolved message text, an exception may contain a message container that carries enough information to resolve a message at a later time, thus enabling "late message binding".
protected  java.lang.Object object
          The object producing the error.
protected  long severity
           
 
Fields inherited from class java.rmi.RemoteException
detail
 
Constructor Summary
AbleException()
          Construct a new exception of an unspecified severity.
AbleException(AbleMessageContainer theMessageContainer, java.lang.String theMessage)
          Constructs a new exception with the specified locale-specific elements, which can be formatted into a localized message at a later time.
AbleException(AbleMessageContainer theMessageContainer, java.lang.String theMessage, java.lang.Throwable theThrowable)
          Constructs a new exception with the specified locale-specific elements, which can be formatted into a localized message at a later time.
AbleException(int theSeverity)
          Construct a new exception of the specified severity.
AbleException(int theSeverity, java.lang.String theMessage, java.lang.Throwable theThrowable)
          Construct a new exception with the specified message, Throwable, and ABLE severity.
AbleException(java.lang.String theMessage)
          Construct a new exception with the specified message of an unspecified severity.
AbleException(java.lang.String theErrorMessage, java.util.Collection collection)
          Construct a new exception with a Collection of objects.
AbleException(java.lang.String theMessage, java.lang.Object theObject)
          Construct a new exception with the specified message and object.
AbleException(java.lang.String theMessage, java.lang.Object theObject, java.lang.Throwable theThrowable)
          Construct a new exception with the specified message, object, and throwable.
AbleException(java.lang.String theMessage, java.lang.Throwable theThrowable)
          Construct a new exception with the specified message and Throwable.
 
Method Summary
static java.lang.String Copyright()
          Determine the copyright of this class.
 java.util.Collection getExceptionBeans()
          Return the beans which caused exceptions.
 java.util.Collection getExceptions()
          Return the exceptions to interrogate.
 java.lang.String getLocalizedMessage()
          Overridden because of tendency to use nested exception text as exception text.
 AbleMessageContainer getMessageContainer()
          Gets the AbleMessageContainer in this exception.
 java.lang.Object getObject()
          Returns the object for the handler to interrogate.
 long getSeverity()
          Returns the severity of the exception.
 boolean hasMessageContainer()
          Indicates whether this exception provides an AbleMessageContainer for creating a localized message at a late time rather than a pre-resolved message text.
 void setObject(java.lang.Object theObject)
          Sets the object for the exception.
 void setSeverity(int theSeverity)
          Sets the severity of the exception.
 java.lang.String toString()
          Retrieve a string describing the exception.
 
Methods inherited from class java.rmi.RemoteException
getMessage, printStackTrace, printStackTrace, printStackTrace
 
Methods inherited from class java.lang.Throwable
fillInStackTrace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

severity

protected long severity

object

protected java.lang.Object object
The object producing the error. In practice, this can be either the bean that threw the exception, or if a container, a Vector of AbleExceptions each of which represent beans that threw exceptions during some processing of a list of beans.

myMessageContainer

protected AbleMessageContainer myMessageContainer
Instead of a pre-resolved message text, an exception may contain a message container that carries enough information to resolve a message at a later time, thus enabling "late message binding".
Constructor Detail

AbleException

public AbleException()
Construct a new exception of an unspecified severity.

AbleException

public AbleException(int theSeverity)
Construct a new exception of the specified severity.
Parameters:
theSeverity - An Able message value indicating the severity of the exception.

AbleException

public AbleException(java.lang.String theMessage)
Construct a new exception with the specified message of an unspecified severity.
Parameters:
theMessage - A message passed on to RemoteException.

AbleException

public AbleException(java.lang.String theMessage,
                     java.lang.Object theObject)
Construct a new exception with the specified message and object.
Parameters:
theMessage - A message passed on to RemoteException.
theObject - An object for the handler to interrogate. In practice, this is a bean that threw the exception, or if a container, a collection of AbleExceptions each of which represent beans that threw exceptions while processing the container's list of beans.

AbleException

public AbleException(java.lang.String theMessage,
                     java.lang.Object theObject,
                     java.lang.Throwable theThrowable)
Construct a new exception with the specified message, object, and throwable.
Parameters:
theMessage - A message passed on to RemoteException.
theObject - An object for the handler to interrogate. In practice, this is a bean that threw the exception, or if a container, a collection of AbleExceptions each of which represent beans that threw exceptions while processing the container's list of beans.
theThrowable - An exception passed on to RemoteException.

AbleException

public AbleException(java.lang.String theErrorMessage,
                     java.util.Collection collection)
Construct a new exception with a Collection of objects.
Parameters:
theErrorMessage -  
collection - A collection of AbleExceptions each of which represent beans that threw exceptions while processing a list of beans.

AbleException

public AbleException(java.lang.String theMessage,
                     java.lang.Throwable theThrowable)
Construct a new exception with the specified message and Throwable.
Parameters:
theMessage - A message passed on to RemoteException.
theThrowable - An exception passed on to RemoteException.

AbleException

public AbleException(int theSeverity,
                     java.lang.String theMessage,
                     java.lang.Throwable theThrowable)
Construct a new exception with the specified message, Throwable, and ABLE severity.
Parameters:
theSeverity - An Able message constant indicating the severity of this exception.
theMessage - A message passed on to RemoteException.
theThrowable - An exception passed on to RemoteException.

AbleException

public AbleException(AbleMessageContainer theMessageContainer,
                     java.lang.String theMessage)
Constructs a new exception with the specified locale-specific elements, which can be formatted into a localized message at a later time.
Parameters:
theMessageContainer - The elements of a locale-specific message.
theMessage - A message passed on to RemoteException.

AbleException

public AbleException(AbleMessageContainer theMessageContainer,
                     java.lang.String theMessage,
                     java.lang.Throwable theThrowable)
Constructs a new exception with the specified locale-specific elements, which can be formatted into a localized message at a later time.
Parameters:
theMessageContainer - The elements of a locale-specific message.
theMessage - A message passed on to RemoteException.
theThrowable - An exception passed on to RemoteException.
Method Detail

hasMessageContainer

public boolean hasMessageContainer()
Indicates whether this exception provides an AbleMessageContainer for creating a localized message at a late time rather than a pre-resolved message text.
Returns:
true if this exception contains an AbleMessageContainer, false otherwise.

getMessageContainer

public AbleMessageContainer getMessageContainer()
Gets the AbleMessageContainer in this exception.
Returns:
An AbleMessageContainer if this exception contains one, or null if there is no AbleMessageContainer.

setSeverity

public void setSeverity(int theSeverity)
Sets the severity of the exception.
Parameters:
theSeverity - An Able message severity constant.

getSeverity

public long getSeverity()
Returns the severity of the exception.
Returns:
An Able message severity constant.

setObject

public void setObject(java.lang.Object theObject)
Sets the object for the exception.
Parameters:
theObject - An object for the handler to interrogate. In practice, this is a bean that threw the exception, or if a container, a collection of AbleExceptions each of which represent beans that threw exceptions while processing a list of beans.

getObject

public java.lang.Object getObject()
Returns the object for the handler to interrogate.
Returns:
An object for the handler to interrogate. In practice, this is a bean that threw the exception, or if a container, a collection of AbleExceptions each of which represent beans that threw exceptions while processing a list of beans.

getExceptions

public java.util.Collection getExceptions()
Return the exceptions to interrogate. For example:

    try {
      agent.process();
    } catch (AbleException rmx) {
      Collection beans = rmx.getExceptions();
      Iterator i = beans.iterator();
      while (i.hasNext()) {
          AbleException exp = (AbleException)i.next();
          AbleBean bean = (AbleBean)exp.getObject();
          // do something to the bean to recover?
          bean.reset();
      }
    }
 
Returns:
A Collection of AbleExceptions each of which represent beans that threw exceptions while processing a list of beans. Calling getObject on each exception in turn will return the bean that caused the exception.

getExceptionBeans

public java.util.Collection getExceptionBeans()
Return the beans which caused exceptions. For example:

    try {
      agent.process();
    } catch (AbleException rmx) {
      Collection beans = rmx.getExceptionBeans();
      Iterator i = beans.iterator();
      while (i.hasNext()) {
          AbleBean bean = (AbleBean)i.next();
          // do something to the bean to recover?
          bean.reset();
      }
    }
 
Returns:
A Collection of AbleBeans each of which represent beans that threw exceptions while processing a list of beans. To obtain a reference to the container agent, use bean.getParent().

toString

public java.lang.String toString()
Retrieve a string describing the exception.

If the exception contains an object, the output consists of the exception text, a line feed, and the result of calling toString on the object.

If the object contained is actually a collection, then the output consists of the exception text, and for each object in the collection, a line feed and the result of calling toString on each object.

Note that this does not display the content of an AbleMessageContainer wart!.

Overrides:
toString in class java.lang.Throwable
Returns:
A representation of exception and its object.

getLocalizedMessage

public java.lang.String getLocalizedMessage()
Overridden because of tendency to use nested exception text as exception text. This causes duplicate display of messages since the detail in the contained exception is the same as the exception message itself. Overridden function removes any duplicate text provided by RemoteException.

Does not utilize the myMessageContainer wart even if one exists.

Overrides:
getLocalizedMessage in class java.lang.Throwable

Copyright

public static java.lang.String Copyright()
Determine the copyright of this class.
Returns:
A String containing this class's copyright statement.


ABLE 2.0.0 07/02/2003 10:25:01

(C) Copyright IBM Corporation 1999, 2003