aboutsummaryrefslogtreecommitdiff
path: root/src/uk/org/ury/backend/database/exceptions
diff options
context:
space:
mode:
authorMatt Windsor <mattwindsor@btinternet.com>2011-03-21 21:54:31 +0000
committerMatt Windsor <mattwindsor@btinternet.com>2011-03-21 21:54:31 +0000
commitdf7d7981b56a4560c95ea7e9b194080e93398ecf (patch)
treeb3ae4f02d23ae1f7f4951c776ee8d91b0047dd6f /src/uk/org/ury/backend/database/exceptions
parent2d073129857a42ab4195cd433c8be152e357033f (diff)
GREAT PACKAGE RESHUFFLE: Everything is now organised into frontend, backend and common (to frontend and backend) packages. Things may have been broken. Doc refresh.
Diffstat (limited to 'src/uk/org/ury/backend/database/exceptions')
-rw-r--r--src/uk/org/ury/backend/database/exceptions/ConnectionFailureException.java44
-rw-r--r--src/uk/org/ury/backend/database/exceptions/MissingCredentialsException.java52
-rw-r--r--src/uk/org/ury/backend/database/exceptions/MissingPropertyException.java47
-rw-r--r--src/uk/org/ury/backend/database/exceptions/QueryFailureException.java45
-rw-r--r--src/uk/org/ury/backend/database/exceptions/package.html11
5 files changed, 199 insertions, 0 deletions
diff --git a/src/uk/org/ury/backend/database/exceptions/ConnectionFailureException.java b/src/uk/org/ury/backend/database/exceptions/ConnectionFailureException.java
new file mode 100644
index 0000000..393f3ce
--- /dev/null
+++ b/src/uk/org/ury/backend/database/exceptions/ConnectionFailureException.java
@@ -0,0 +1,44 @@
+/**
+ *
+ */
+package uk.org.ury.backend.database.exceptions;
+
+/**
+ * Exception thrown when the database backend fails to connect to
+ * the database server, in absence of a more specific exception.
+ *
+ * @author Matt Windsor
+ */
+
+public class ConnectionFailureException extends Exception
+{
+ /**
+ *
+ */
+ private static final long serialVersionUID = -7353531873142099828L;
+
+
+/**
+ * Construct a new ConnectionFailureException with a
+ * default reason.
+ */
+
+ public
+ ConnectionFailureException ()
+ {
+ super ("Connection failure.");
+ }
+
+
+ /**
+ * Construct a new ConnectionFailureException.
+ *
+ * @param reason The explanation for the exception.
+ */
+
+ public
+ ConnectionFailureException (String reason)
+ {
+ super (reason);
+ }
+}
diff --git a/src/uk/org/ury/backend/database/exceptions/MissingCredentialsException.java b/src/uk/org/ury/backend/database/exceptions/MissingCredentialsException.java
new file mode 100644
index 0000000..4c73683
--- /dev/null
+++ b/src/uk/org/ury/backend/database/exceptions/MissingCredentialsException.java
@@ -0,0 +1,52 @@
+/**
+ *
+ */
+package uk.org.ury.backend.database.exceptions;
+
+/**
+ * Exception thrown when the database credentials required to
+ * log into the URY database under a user class are missing,
+ * and thus the log-in cannot continue.
+ *
+ * The best practice for handling a MissingCredentialsException
+ * is to attempt to log into the database with a less privileged
+ * user class or, if the credentials for read-only access are
+ * missing, give up.
+ *
+ * @author Matt Windsor
+ */
+
+public class MissingCredentialsException extends Exception
+{
+
+ /**
+ *
+ */
+
+ private static final long serialVersionUID = -397479334359858162L;
+
+
+ /**
+ * Construct a new MissingCredentialsException with a
+ * default reason.
+ */
+
+ public
+ MissingCredentialsException ()
+ {
+ super ("Missing credentials.");
+ }
+
+
+ /**
+ * Construct a new MissingCredentialsException.
+ *
+ * @param reason The explanation for the exception.
+ */
+
+ public
+ MissingCredentialsException (String reason)
+ {
+ super (reason);
+ }
+}
diff --git a/src/uk/org/ury/backend/database/exceptions/MissingPropertyException.java b/src/uk/org/ury/backend/database/exceptions/MissingPropertyException.java
new file mode 100644
index 0000000..485771b
--- /dev/null
+++ b/src/uk/org/ury/backend/database/exceptions/MissingPropertyException.java
@@ -0,0 +1,47 @@
+/**
+ *
+ */
+package uk.org.ury.backend.database.exceptions;
+
+
+/**
+ * Exception thrown when a DatabaseItem is queried for a property
+ * that does not exist.
+ *
+ * This is (usually) not a fatal error.
+ *
+ * @author Matt Windsor
+ */
+
+public class MissingPropertyException extends Exception
+{
+ /**
+ *
+ */
+ private static final long serialVersionUID = -7353531873142099828L;
+
+
+/**
+ * Construct a new MissingPropertyException with a
+ * default reason.
+ */
+
+ public
+ MissingPropertyException ()
+ {
+ super ("Query failure.");
+ }
+
+
+ /**
+ * Construct a new MissingPropertyException.
+ *
+ * @param reason The explanation for the exception.
+ */
+
+ public
+ MissingPropertyException (String reason)
+ {
+ super (reason);
+ }
+}
diff --git a/src/uk/org/ury/backend/database/exceptions/QueryFailureException.java b/src/uk/org/ury/backend/database/exceptions/QueryFailureException.java
new file mode 100644
index 0000000..6c01e61
--- /dev/null
+++ b/src/uk/org/ury/backend/database/exceptions/QueryFailureException.java
@@ -0,0 +1,45 @@
+/**
+ *
+ */
+package uk.org.ury.backend.database.exceptions;
+
+
+/**
+ * Exception thrown when the database backend fails to execute
+ * a query.
+ *
+ * @author Matt Windsor
+ */
+
+public class QueryFailureException extends Exception
+{
+ /**
+ *
+ */
+ private static final long serialVersionUID = -7353531873142099828L;
+
+
+/**
+ * Construct a new QueryFailureException with a
+ * default reason.
+ */
+
+ public
+ QueryFailureException ()
+ {
+ super ("Query failure.");
+ }
+
+
+ /**
+ * Construct a new QueryFailureException.
+ *
+ * @param reason The explanation for the exception.
+ */
+
+ public
+ QueryFailureException (String reason)
+ {
+ super (reason);
+ }
+}
diff --git a/src/uk/org/ury/backend/database/exceptions/package.html b/src/uk/org/ury/backend/database/exceptions/package.html
new file mode 100644
index 0000000..b5e7cac
--- /dev/null
+++ b/src/uk/org/ury/backend/database/exceptions/package.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+"http://www.w3.org/TR/html4/strict.dtd">
+
+<HTML>
+ <HEAD>
+ <TITLE>uk.org.ury.database.exceptions</TITLE>
+ </HEAD>
+ <BODY>
+ <P>Exceptions thrown by the database services classes.</P>
+ </BODY>
+</HTML> \ No newline at end of file