com.edustructures.sifworks
Class ADKException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by com.edustructures.sifworks.ADKException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ADKConfigException, ADKMappingException, ADKMessagingException, ADKParsingException, ADKQueueException, ADKSchemaException, ADKTransportException, ADKZoneNotConnectedException

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

The base class for all exception classes defined by the ADK.

ADKExceptions have the following characteristics:

Version:
ADK 1.0
See Also:
Serialized Form

Constructor Summary
ADKException(java.lang.String msg, Zone zone)
          Constructs an exception with a detailed message that occurs in the context of a zone
ADKException(java.lang.String msg, Zone zone, java.lang.Throwable src)
          Constructs an exception with a detailed message that occurs in the context of a zone
 
Method Summary
 void add(java.lang.Throwable thr)
          Adds a child exception
 java.lang.Throwable[] getChildren()
          Gets the child exceptions, if any
 boolean getRetry()
          Determines if the ADK should attempt to retry the operation associated with this exception.
 SIFException[] getSIFExceptions()
          Gets all child SIFExceptions, if any
 Zone getZone()
          Gets the zone associated with this exception.
 java.lang.String getZoneId()
          Gets the ID of the zone associated with this exception.
 boolean hasChildren()
          Determines if this exception has nested child exceptions
 boolean hasSIFError(int category)
          Deprecated. Please use the overload of this method that accepts a SIFErrorCategory
 boolean hasSIFError(int category, int code)
          Deprecated. Please use the overload of this method that accepts a SIFErrorCategory as the first parameter
 boolean hasSIFError(SIFErrorCategory category)
          Determines if this exception contains at least one nested SIFException with the specified error category.
 boolean hasSIFError(SIFErrorCategory category, int code)
          Determines if this exception contains at least one nested SIFException with the specified error category and code.
 boolean hasSIFExceptions()
          Determines if this exception contains any SIFException children.
 void log(org.apache.log4j.Category def)
          Write this exception and all of its nested exceptions to Log4j.
 void log(org.apache.log4j.Category def, int indent)
          Logs the exception to the Category, using the "error" logging level
 void setRetry(boolean retry)
          Determines if the ADK should attempt to retry the operation associated with this exception.
 java.lang.String toString()
          Returns a string representation of this exception and all child exceptions formatted for printing to System.out.
 java.lang.String toString(int indent, boolean includeChildren)
          Returns a string representation of this exception and all child exceptions formatted for printing to System.out.
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ADKException

public ADKException(java.lang.String msg,
                    Zone zone)
Constructs an exception with a detailed message that occurs in the context of a zone

Parameters:
msg - A message describing the exception
zone - The zone associated with the exception

ADKException

public ADKException(java.lang.String msg,
                    Zone zone,
                    java.lang.Throwable src)
Constructs an exception with a detailed message that occurs in the context of a zone

Parameters:
msg - A message describing the exception
zone - The zone associated with the exception
src - The source exception
Method Detail

getZone

public Zone getZone()
Gets the zone associated with this exception.

Note: The ADK's Zone interface does not support Java RMI. Therefore, this method will return a null value when called by an RMI-based client on a marshalled ADKException object. RMI clients should instead use the getZoneId method to learn the ID of the zone passed to the constructor.

Returns:
The Zone associated with the exception
See Also:
getZoneId()

getZoneId

public java.lang.String getZoneId()
Gets the ID of the zone associated with this exception.

Returns:
the ID of the Zone passed to the constructor
See Also:
getZone()

hasChildren

public boolean hasChildren()
Determines if this exception has nested child exceptions

Returns:
true if this exception has nested child exceptions

add

public void add(java.lang.Throwable thr)
Adds a child exception

Parameters:
thr - A new child exception

getChildren

public java.lang.Throwable[] getChildren()
Gets the child exceptions, if any

Returns:
All child excpeptions. If no child exceptions are defined, an emtpy array is returned

setRetry

public void setRetry(boolean retry)
Determines if the ADK should attempt to retry the operation associated with this exception.

Parameters:
retry - When true, the exception is flagged for retry. The method that catches the exception should attempt to retry the operation in progress.

getRetry

public boolean getRetry()
Determines if the ADK should attempt to retry the operation associated with this exception.

Returns:
True if the exception is flagged for retry (the default is false). The method that catches the exception should attempt to retry the operation in progress.

hasSIFExceptions

public boolean hasSIFExceptions()
Determines if this exception contains any SIFException children. SIFException encapsulates SIF errors returned to the agent in SIF_Ack messages.

Returns:
true if this exception has at least one nested SIFException

getSIFExceptions

public SIFException[] getSIFExceptions()
Gets all child SIFExceptions, if any

Returns:
An array of SIFExceptions

hasSIFError

public boolean hasSIFError(int category)
Deprecated. Please use the overload of this method that accepts a SIFErrorCategory

Determines if this exception contains at least one nested SIFException with the specified error category.

Parameters:
category - The error category to search for
Returns:
true if this exception has nested SIFExceptions and at least one of those has the specified error category.

hasSIFError

public boolean hasSIFError(SIFErrorCategory category)
Determines if this exception contains at least one nested SIFException with the specified error category.

Parameters:
category - The error category to search for
Returns:
true if this exception has nested SIFExceptions and at least one of those has the specified error category.

hasSIFError

public boolean hasSIFError(int category,
                           int code)
Deprecated. Please use the overload of this method that accepts a SIFErrorCategory as the first parameter

Determines if this exception contains at least one nested SIFException with the specified error category and code.

Parameters:
category - The error category to search for
code - The error code to search for
Returns:
true if this exception has nested SIFExceptions and at least one of those has the specified error category and code

hasSIFError

public boolean hasSIFError(SIFErrorCategory category,
                           int code)
Determines if this exception contains at least one nested SIFException with the specified error category and code.

Parameters:
category - The error category to search for
code - The error code to search for
Returns:
true if this exception has nested SIFExceptions and at least one of those has the specified error category and code

toString

public java.lang.String toString()
Returns a string representation of this exception and all child exceptions formatted for printing to System.out. Each exception is on its own line.

Overrides:
toString in class java.lang.Throwable
Returns:
A string representation of this exception and all child exceptions

toString

public java.lang.String toString(int indent,
                                 boolean includeChildren)
Returns a string representation of this exception and all child exceptions formatted for printing to System.out. Each exception is on its own line.

Parameters:
indent - The amount of indentation to apply to the string
includeChildren - True if all children should be returned
Returns:
A string representation of this exception

log

public void log(org.apache.log4j.Category def)
Write this exception and all of its nested exceptions to Log4j. For any exception that is not associated with a zone, the supplied default Category will be used. Otherwise the Category of the zone is used.

Parameters:
def - The category to log to

log

public void log(org.apache.log4j.Category def,
                int indent)
Logs the exception to the Category, using the "error" logging level

Parameters:
def - The Category to log to
indent - The amount of indentation to apply


Copyright © 2001-2007 Edustructures LLC. All Rights Reserved. SIFWorks® and ADK® are registered trademarks of Edustructures LLC. SIF™ and Schools Interoperability Framework are trademarks of the Schools Interoperability Framework Association.