com.edustructures.sifworks
Class SIFException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by com.edustructures.sifworks.ADKException
              extended by com.edustructures.sifworks.ADKMessagingException
                  extended by com.edustructures.sifworks.SIFException
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
QueryFormatterException

public class SIFException
extends ADKMessagingException

SIFException describes a SIF error condition. When handling inbound messages, the agent may throw a SIFException from a message handler to signal that an error has occurred and should be returned to the ZIS in the SIF_Ack message. The ADK will convert the SIFException to a SIF_Error element when sending the associated SIF_Ack. It is desirable to throw SIFException in your message handlers (versus generic exceptions) if you want control over setting the SIF_Error category, code, description, and extended description elements.

SIFException may also be thrown by ADK methods in response to a SIF_Ack received from the server. The actual SIF_Ack object that generated the exception can be retrieved by calling getAck. Any SIF_Error elements included in the acknowledgement can be retrieved by calling getErrors and associated methods such as hasError. Note SIF 1.0r1 allowed for multiple SIF_Error elements per SIF_Ack, but later versions of SIF do not. For backward compatibility, the ADK captures all SIF_Error elements received in SIF_Ack messages and makes them available as an array. The array can be obtained by calling the getErrors method.

Version:
ADK 1.0
See Also:
Serialized Form

Field Summary
 SIF_Ack fAck
          The SIF_Ack that caused this exception (if the exception was raised in response to an incoming message)
 
Constructor Summary
SIFException(int category, int code, java.lang.String desc, java.lang.String extDesc, Zone zone)
          Deprecated. Please use the overload that uses SIFErrorCategory as the first parameter
SIFException(int category, int code, java.lang.String desc, java.lang.String extDesc, Zone zone, java.lang.Exception innerException)
          Deprecated. Please use the overload that uses SIFErrorCategory as the first parameter
SIFException(int category, int code, java.lang.String desc, Zone zone)
          Deprecated. Please use the overload that uses SIFErrorCategory as the first parameter
SIFException(int category, int code, java.lang.String desc, Zone zone, java.lang.Exception innerException)
          Deprecated. Please use the overload that uses SIFErrorCategory as the first parameter
SIFException(SIF_Ack ack, Zone zone)
           
SIFException(SIFErrorCategory category, int code, java.lang.String desc, java.lang.String extDesc, Zone zone)
          Constructs a SIFException for delivery to the ZIS.
SIFException(SIFErrorCategory category, int code, java.lang.String desc, java.lang.String extDesc, Zone zone, java.lang.Exception innerException)
          Constructs a SifException for delivery to the ZIS
SIFException(SIFErrorCategory category, int code, java.lang.String desc, Zone zone)
          Constructs a SIFException for delivery to the ZIS.
SIFException(SIFErrorCategory category, int code, java.lang.String desc, Zone zone, java.lang.Exception innerException)
          Constructs a SifException for delivery to the ZIS
SIFException(java.lang.String msg, SIF_Ack ack, Zone zone)
           
 
Method Summary
 SIF_Ack getAck()
          The SIF_Ack that is part of this exception
 SIF_Error getError()
          Gets all SIF_Errors wrapped by this exception
 int getErrorCategory()
          Deprecated. Please use getSIFErrorCategory
 int getErrorCode()
          Gets the Error Code of the first SIF_Error element, or 0xFFFFFFFF if there are no errors.
 java.lang.String getErrorDesc()
          Gets the Error Description of the first SIF_Error element, or null if there are no errors.
 java.lang.String getErrorExtDesc()
          Gets the Extended Error Description of the first SIF_Error element, or null if there are no errors.
 java.lang.String getMessage()
           
 SIFErrorCategory getSIFErrorCategory()
          Gets the Error Category of the first SIF_Error element, or 0xFFFFFFFF if there are no errors.
 boolean hasError(int category, int code)
          Deprecated. Please use the overload of this method that takes a SIFErrorCategory as the first parameter
 boolean hasError(SIFErrorCategory category, int code)
          Determines if this SIFException has an error with the specified category and code.
 boolean hasErrorCategory(int category)
          Deprecated. please use the overload that takes a SIFErrorCategory
 boolean hasErrorCategory(SIFErrorCategory category)
          Determines if this SIFException has an error with the specified category.
 boolean hasErrors()
          Determines if this SIFException describes any SIF_Errors
 void setErrorCategory(int category)
          Sets the error category code of the first SIF_Error wrapped by this exception.
 void setErrorCategory(SIFErrorCategory category)
          Sets the error category code of the first SIF_Error wrapped by this exception.
 void setErrorCode(int code)
          Sets the error code of the first SIF_Error wrapped by this exception.
 void setErrorDesc(java.lang.String desc)
          Sets the error description of the first SIF_Error wrapped by this exception.
 void setErrorExtDesc(java.lang.String extDesc)
          Sets the optional extended error description of the first SIF_Error wrapped by this exception.
 void setSIF_Error(int category, int code, java.lang.String desc, java.lang.String extDesc)
          Sets the SIF_Error element associated with this exception.
 void setSIF_Error(SIFErrorCategory category, int code, java.lang.String desc, java.lang.String extDesc)
          Sets the SIF_Error element associated with this exception.
 
Methods inherited from class com.edustructures.sifworks.ADKException
add, getChildren, getRetry, getSIFExceptions, getZone, getZoneId, hasChildren, hasSIFError, hasSIFError, hasSIFError, hasSIFError, hasSIFExceptions, log, log, setRetry, toString, toString
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fAck

public SIF_Ack fAck
The SIF_Ack that caused this exception (if the exception was raised in response to an incoming message)

Constructor Detail

SIFException

public SIFException(SIF_Ack ack,
                    Zone zone)
Parameters:
ack - The SIF_Ack to use
zone - The zone that this error applies to

SIFException

public SIFException(java.lang.String msg,
                    SIF_Ack ack,
                    Zone zone)
Parameters:
msg - The error message
ack - a SIF_Ack element to use
zone - The zone that this error applies to

SIFException

public SIFException(int category,
                    int code,
                    java.lang.String desc,
                    Zone zone)
Deprecated. Please use the overload that uses SIFErrorCategory as the first parameter

Constructs a SIFException for delivery to the ZIS. The ADK will include the error information provided by the exception when it sends a SIF_Ack in response to the message being processed. This form of constructor is typically called by the ADK, but may also be called by agent code if an exception occurs in a Publisher, Subscriber, or QueryResults message handler implementation.

Parameters:
category - A SIFErrorCodes.CAT_ error category
code - A SIFErrorCodes error code
desc - The error description
zone - The zone on which the error occurred

SIFException

public SIFException(int category,
                    int code,
                    java.lang.String desc,
                    java.lang.String extDesc,
                    Zone zone)
Deprecated. Please use the overload that uses SIFErrorCategory as the first parameter

Constructs a SIFException for delivery to the ZIS. The ADK will include the error information provided by the exception when it sends a SIF_Ack in response to the message being processed. This form of constructor is typically called by the ADK, but may also be called by agent code if an exception occurs in a Publisher, Subscriber, or QueryResults message handler implementation.

Parameters:
category - A SIFErrorCodes.CAT_ error category
code - A SIFErrorCodes error code
desc - The error description
extDesc - An option extended error description
zone - The zone on which the error occurred

SIFException

public SIFException(int category,
                    int code,
                    java.lang.String desc,
                    java.lang.String extDesc,
                    Zone zone,
                    java.lang.Exception innerException)
Deprecated. Please use the overload that uses SIFErrorCategory as the first parameter

Constructs a SifException for delivery to the ZIS

The Adk will include the error information provided by the exception when it sends a SIF_Ack in response to the message being processed. This form of constructor is typically called by the Adk, but may also be called by agent code if an exception occurs in a IPublisher, ISubscriber, or IQueryResults message handler implementation.

Parameters:
category - A SifErrorCategoryCode. error category
code - A SifErrorCodes error code
desc - The error description
extDesc - An optional extended error description
zone - The zone on which the error occurred
innerException - The internal error that was thrown by the agent

SIFException

public SIFException(int category,
                    int code,
                    java.lang.String desc,
                    Zone zone,
                    java.lang.Exception innerException)
Deprecated. Please use the overload that uses SIFErrorCategory as the first parameter

Constructs a SifException for delivery to the ZIS

The Adk will include the error information provided by the exception when it sends a SIF_Ack in response to the message being processed. This form of constructor is typically called by the Adk, but may also be called by agent code if an exception occurs in a IPublisher, ISubscriber, or IQueryResults message handler implementation.

Parameters:
category - A SifErrorCategoryCode. error category
code - A SifErrorCodes error code
desc - The error description
zone - The zone on which the error occurred
innerException - The internal error that was thrown by the agent

SIFException

public SIFException(SIFErrorCategory category,
                    int code,
                    java.lang.String desc,
                    Zone zone)
Constructs a SIFException for delivery to the ZIS. The ADK will include the error information provided by the exception when it sends a SIF_Ack in response to the message being processed. This form of constructor is typically called by the ADK, but may also be called by agent code if an exception occurs in a Publisher, Subscriber, or QueryResults message handler implementation.

Parameters:
category - The category that applies to this type of error
code - A SIFErrorCodes error code
desc - The error description
zone - The zone on which the error occurred

SIFException

public SIFException(SIFErrorCategory category,
                    int code,
                    java.lang.String desc,
                    java.lang.String extDesc,
                    Zone zone)
Constructs a SIFException for delivery to the ZIS. The ADK will include the error information provided by the exception when it sends a SIF_Ack in response to the message being processed. This form of constructor is typically called by the ADK, but may also be called by agent code if an exception occurs in a Publisher, Subscriber, or QueryResults message handler implementation.

Parameters:
category - The category that applies to this type of error
code - A SIFErrorCodes error code
desc - The error description
extDesc - An option extended error description
zone - The zone on which the error occurred

SIFException

public SIFException(SIFErrorCategory category,
                    int code,
                    java.lang.String desc,
                    Zone zone,
                    java.lang.Exception innerException)
Constructs a SifException for delivery to the ZIS

The Adk will include the error information provided by the exception when it sends a SIF_Ack in response to the message being processed. This form of constructor is typically called by the Adk, but may also be called by agent code if an exception occurs in a Publisher, Subscriber, or QueryResults message handler implementation.

Parameters:
category - The category that applies to this type of error
code - A SifErrorCodes error code
desc - The error description
zone - The zone on which the error occurred
innerException - The internal error that was thrown by the agent

SIFException

public SIFException(SIFErrorCategory category,
                    int code,
                    java.lang.String desc,
                    java.lang.String extDesc,
                    Zone zone,
                    java.lang.Exception innerException)
Constructs a SifException for delivery to the ZIS

The Adk will include the error information provided by the exception when it sends a SIF_Ack in response to the message being processed. This form of constructor is typically called by the Adk, but may also be called by agent code if an exception occurs in a IPublisher, ISubscriber, or IQueryResults message handler implementation.

Parameters:
category - The category that applies to this type of error
code - A SifErrorCodes error code
desc - The error description
extDesc - An optional extended error description
zone - The zone on which the error occurred
innerException - The internal error that was thrown by the agent
Method Detail

getError

public SIF_Error getError()
Gets all SIF_Errors wrapped by this exception

Returns:
an array of SIF_Error elements

hasErrors

public boolean hasErrors()
Determines if this SIFException describes any SIF_Errors

Returns:
true if the exception wraps at least on SIF_Error

hasError

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

Determines if this SIFException has an error with the specified category and code. In some versions of SIF, a SIFException may describe more than one error. This method searches through all of the wrapped errors and returns true if any match the category and code.

Parameters:
category - The SIF error category to search for
code - The SIF error code to search for
Returns:
true if any errors wrapped by this exception match the category and code

hasError

public boolean hasError(SIFErrorCategory category,
                        int code)
Determines if this SIFException has an error with the specified category and code. In some versions of SIF, a SIFException may describe more than one error. This method searches through all of the wrapped errors and returns true if any match the category and code.

Parameters:
category - The SIF error category to search for
code - The SIF error code to search for
Returns:
true if any errors wrapped by this exception match the category and code

hasErrorCategory

public boolean hasErrorCategory(int category)
Deprecated. please use the overload that takes a SIFErrorCategory

Determines if this SIFException has an error with the specified category. In some versions of SIF, a SIFException may describe more than one error. This method searches through all of the wrapped errors and returns true if any match the category.

Parameters:
category - The SIF error category to search for
Returns:
true if any errors wrapped by this exception match the category

hasErrorCategory

public boolean hasErrorCategory(SIFErrorCategory category)
Determines if this SIFException has an error with the specified category. In some versions of SIF, a SIFException may describe more than one error. This method searches through all of the wrapped errors and returns true if any match the category.

Parameters:
category - The SIF error category to search for
Returns:
true if any errors wrapped by this exception match the category

setSIF_Error

public void setSIF_Error(int category,
                         int code,
                         java.lang.String desc,
                         java.lang.String extDesc)
Sets the SIF_Error element associated with this exception.

Parameters:
category - A SIFErrorCodes.CAT_ error category
code - A SIFErrorCodes_ error code
desc -
extDesc -

setSIF_Error

public void setSIF_Error(SIFErrorCategory category,
                         int code,
                         java.lang.String desc,
                         java.lang.String extDesc)
Sets the SIF_Error element associated with this exception.

Parameters:
category - The category associated with this error
code - A SIFErrorCodes_ error code
desc -
extDesc -

setErrorCategory

public void setErrorCategory(int category)
Sets the error category code of the first SIF_Error wrapped by this exception. If no SIF_Errors are wrapped by this exception, a new one is created.

Parameters:
category - A SIFErrorCodes.CAT_ error category

setErrorCategory

public void setErrorCategory(SIFErrorCategory category)
Sets the error category code of the first SIF_Error wrapped by this exception. If no SIF_Errors are wrapped by this exception, a new one is created.

Parameters:
category - The category to set to this exception

setErrorCode

public void setErrorCode(int code)
Sets the error code of the first SIF_Error wrapped by this exception. If no SIF_Errors are wrapped by this exception, a new one is created.

Parameters:
code - A SIFErrorCodes error code

setErrorDesc

public void setErrorDesc(java.lang.String desc)
Sets the error description of the first SIF_Error wrapped by this exception. If no SIF_Errors are wrapped by this exception, a new one is created.

Parameters:
desc - The error description

setErrorExtDesc

public void setErrorExtDesc(java.lang.String extDesc)
Sets the optional extended error description of the first SIF_Error wrapped by this exception. If no SIF_Errors are wrapped by this exception, a new one is created.

Parameters:
extDesc - The extended error description

getErrorCategory

public int getErrorCategory()
Deprecated. Please use getSIFErrorCategory

Gets the Error Category of the first SIF_Error element, or 0xFFFFFFFF if there are no errors.

Returns:
The Category associated with this error

getSIFErrorCategory

public SIFErrorCategory getSIFErrorCategory()
Gets the Error Category of the first SIF_Error element, or 0xFFFFFFFF if there are no errors.

Returns:
The Category associated with this error

getErrorCode

public int getErrorCode()
Gets the Error Code of the first SIF_Error element, or 0xFFFFFFFF if there are no errors.

Returns:
The Code associated with this error

getErrorDesc

public java.lang.String getErrorDesc()
Gets the Error Description of the first SIF_Error element, or null if there are no errors.

Returns:
The description of the error

getErrorExtDesc

public java.lang.String getErrorExtDesc()
Gets the Extended Error Description of the first SIF_Error element, or null if there are no errors.

Returns:
The extended error description

getAck

public SIF_Ack getAck()
The SIF_Ack that is part of this exception

Returns:
The SIF_Ack that is part of this exception

getMessage

public java.lang.String getMessage()
Overrides:
getMessage in class java.lang.Throwable


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.