org.ceryle.wiki.plugin.assertion
Class AssertionException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by org.ceryle.wiki.plugin.query.QueryException
              extended by org.ceryle.wiki.plugin.assertion.AssertionException
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
FilterException

public class AssertionException
extends QueryException

A simple typed exception for use by the AssertionPlugin.

Author:
Murray Altheim
See Also:
Serialized Form

Field Summary
static int MULTIPLE_UNDEFINED
          An exception type constant indicating more than one undefined expression term.
static int OBJECT_UNDEFINED
          An exception type constant indicating an undefined expression object.
static int PAGE_DOES_NOT_EXIST
          An exception type constant indicating that the asserted 'about' page does not exist.
static int PAGENAME_UNDEFINED
          An exception type constant indicating an undefined page name.
static int PREDICATE_UNDEFINED
          An exception type constant indicating an undefined expression predicate.
static int PROCESS_ERROR
          An exception type constant indicating an error occurring during assertion processing.
static int SUBJECT_UNDEFINED
          An exception type constant indicating an undefined expression subject.
static int TEMPLATE_ERROR
          An exception type constant indicating an error due to template misconfiguration.
static int TERM_UNDEFINED
          An exception type constant indicating an undefined expression term (subject, predicate, and/or object).
 
Fields inherited from class org.ceryle.wiki.plugin.query.QueryException
GRAMMAR_ERROR, m_type, PARAMETER_ERROR, QUERY_ERROR, SYNTAX_ERROR, UNKNOWN_ERROR
 
Constructor Summary
AssertionException(int type)
          Constructor for an AssertionException with a type and no message.
AssertionException(int type, String message)
          Constructor for an AssertionException with a type and message.
AssertionException(String pagename, int type)
          Constructor for an AssertionException with an optional page name, a type, and no message.
AssertionException(String pagename, int type, String message)
          Constructor for an AssertionException with an optional page name, a type, and message.
AssertionException(String pagename, String subject, String predicate, String object, String message)
          Constructor for an AssertionException with a page name, subject, predicate, object, and message.
 
Method Summary
 String getObject()
          Returns the object of the assertion.
 String getPageName()
          Returns the page name that is a possible cause (by its absence, incorrect type, etc.) of the exception.
 String getPredicate()
          Returns the predicate of the assertion.
 String getSubject()
          Returns the subject of the assertion.
 String getTypeDescription()
          Return a textual description of the exception type, suitable as an exception "title".
static String getTypeDescription(int type, Throwable throwable)
          Return a textual description of the exception type, suitable as an exception "title".
protected  void setType(int type)
          Sets the type of this AssertionException.
 
Methods inherited from class org.ceryle.wiki.plugin.query.QueryException
getType
 
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
 

Field Detail

TERM_UNDEFINED

public static final int TERM_UNDEFINED
An exception type constant indicating an undefined expression term (subject, predicate, and/or object).

See Also:
Constant Field Values

PAGENAME_UNDEFINED

public static final int PAGENAME_UNDEFINED
An exception type constant indicating an undefined page name.

See Also:
Constant Field Values

SUBJECT_UNDEFINED

public static final int SUBJECT_UNDEFINED
An exception type constant indicating an undefined expression subject.

See Also:
Constant Field Values

PREDICATE_UNDEFINED

public static final int PREDICATE_UNDEFINED
An exception type constant indicating an undefined expression predicate.

See Also:
Constant Field Values

OBJECT_UNDEFINED

public static final int OBJECT_UNDEFINED
An exception type constant indicating an undefined expression object.

See Also:
Constant Field Values

MULTIPLE_UNDEFINED

public static final int MULTIPLE_UNDEFINED
An exception type constant indicating more than one undefined expression term.

See Also:
Constant Field Values

PAGE_DOES_NOT_EXIST

public static final int PAGE_DOES_NOT_EXIST
An exception type constant indicating that the asserted 'about' page does not exist.

See Also:
Constant Field Values

TEMPLATE_ERROR

public static final int TEMPLATE_ERROR
An exception type constant indicating an error due to template misconfiguration.

See Also:
Constant Field Values

PROCESS_ERROR

public static final int PROCESS_ERROR
An exception type constant indicating an error occurring during assertion processing.

See Also:
Constant Field Values
Constructor Detail

AssertionException

public AssertionException(int type)
Constructor for an AssertionException with a type and no message. The unlocalized message will be set to the value provided from getTypeDescription(int,Throwable).


AssertionException

public AssertionException(String pagename,
                          int type)
Constructor for an AssertionException with an optional page name, a type, and no message. Note the parameter order. The unlocalized message will be set to the value provided from getTypeDescription(int,Throwable).


AssertionException

public AssertionException(int type,
                          String message)
Constructor for an AssertionException with a type and message.


AssertionException

public AssertionException(String pagename,
                          int type,
                          String message)
Constructor for an AssertionException with an optional page name, a type, and message.


AssertionException

public AssertionException(String pagename,
                          String subject,
                          String predicate,
                          String object,
                          String message)
Constructor for an AssertionException with a page name, subject, predicate, object, and message. The type will be set to MULTIPLE_UNDEFINED.

Method Detail

setType

protected void setType(int type)
Sets the type of this AssertionException.

Overrides:
setType in class QueryException

getPageName

public String getPageName()
Returns the page name that is a possible cause (by its absence, incorrect type, etc.) of the exception. This returns the same String as getSubject(). If not set, returns null.


getSubject

public String getSubject()
Returns the subject of the assertion. If not set, returns null.


getPredicate

public String getPredicate()
Returns the predicate of the assertion. If not set, returns null.


getObject

public String getObject()
Returns the object of the assertion. If not set, returns null.


getTypeDescription

public String getTypeDescription()
Return a textual description of the exception type, suitable as an exception "title". This is localized only for English. For other localizations, use the int type values.

Overrides:
getTypeDescription in class QueryException
See Also:
getTypeDescription(int,Throwable)

getTypeDescription

public static String getTypeDescription(int type,
                                        Throwable throwable)
Return a textual description of the exception type, suitable as an exception "title". This is localized only to English. For other localizations, use the page name and int type values. The optional throwable is used only for untyped/unknown exceptions to indicate the Exception class.

Parameters:
type - the type of the description
throwable - an optional Throwable (e.g., Exception)
See Also:
TERM_UNDEFINED, SUBJECT_UNDEFINED, PAGENAME_UNDEFINED, PREDICATE_UNDEFINED, OBJECT_UNDEFINED, MULTIPLE_UNDEFINED, PAGE_DOES_NOT_EXIST, PROCESS_ERROR, QueryException.getTypeDescription(int,Throwable)


The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.