You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@empire-db.apache.org by do...@apache.org on 2011/07/23 18:09:43 UTC

svn commit: r1150139 [2/3] - in /incubator/empire-db/branches/EMPIREDB-99: empire-db-examples/empire-db-example-advanced/src/main/java/org/apache/empire/samples/db/advanced/ empire-db-examples/empire-db-example-basic/src/main/java/org/apache/empire/sam...

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/DBSQLScript.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/DBSQLScript.java?rev=1150139&r1=1150138&r2=1150139&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/DBSQLScript.java (original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/DBSQLScript.java Sat Jul 23 16:09:27 2011
@@ -23,7 +23,7 @@ import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.Iterator;
 
-import org.apache.empire.commons.EmpireException;
+import org.apache.empire.db.exceptions.InternalSQLException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -87,7 +87,7 @@ public class DBSQLScript implements Iter
     }
     
     /**
-     * Clears the script and delets all statements
+     * Clears the script by removing all statements
      */
     public void clear()
     {
@@ -99,7 +99,6 @@ public class DBSQLScript implements Iter
      * @param driver the driver used for statement execution
      * @param conn the connection
      * @param ignoreErrors true if errors should be ignored
-     * @return true if the script has been run successful or false otherwise 
      */
     public void run(DBDatabaseDriver driver, Connection conn, boolean ignoreErrors)
     {
@@ -115,8 +114,7 @@ public class DBSQLScript implements Iter
                 log.error(e.toString(), e);
                 if (ignoreErrors==false)
                 {   // forward exception
-                    String msg = driver.extractErrorMessage(e);
-                    throw new EmpireException(DBErrors.SQLException, new Object[] { msg }, e);
+                    throw new InternalSQLException(driver, e);
                 }    
                 // continue
                 log.debug("Ignoring error. Continuing with script...");
@@ -126,6 +124,16 @@ public class DBSQLScript implements Iter
     }
     
     /**
+     * Runs all SQL Statements using the supplied driver and connection.
+     * @param driver the driver used for statement execution
+     * @param conn the connection
+     */
+    public void run(DBDatabaseDriver driver, Connection conn)
+    {
+        run(driver, conn, false);
+    }
+    
+    /**
      * Returns an iterator
      */
     public Iterator<String> iterator()

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/DBTable.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/DBTable.java?rev=1150139&r1=1150138&r2=1150139&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/DBTable.java (original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/DBTable.java Sat Jul 23 16:09:27 2011
@@ -25,10 +25,14 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import org.apache.empire.commons.EmpireException;
-import org.apache.empire.commons.Errors;
 import org.apache.empire.data.DataMode;
 import org.apache.empire.data.DataType;
+import org.apache.empire.db.exceptions.NoPrimaryKeyException;
+import org.apache.empire.db.exceptions.RecordDeleteFailedException;
+import org.apache.empire.db.exceptions.RecordUpdateInvalidException;
+import org.apache.empire.exceptions.InvalidArgumentException;
+import org.apache.empire.exceptions.ItemExistsException;
+import org.apache.empire.exceptions.UnexpectedReturnValueException;
 
 
 /**
@@ -171,9 +175,9 @@ public class DBTable extends DBRowSet im
     protected void addColumn(DBTableColumn column)
     { // find column by name
         if (column==null || column.getRowSet()!=this)
-            throw new EmpireException(Errors.InvalidArg, column, "column");
+            throw new InvalidArgumentException("column", column);
         if (columns.contains(column) == true)
-            throw new EmpireException(Errors.ItemExists, column.getName());
+            throw new ItemExistsException(column.getName());
         // add now
         columns.add(column);
     }
@@ -270,11 +274,11 @@ public class DBTable extends DBRowSet im
     public void setPrimaryKey(DBColumn[] columns)
     {
         if (columns==null || columns.length==0)
-            throw new EmpireException(Errors.InvalidArg, columns, "columns");
+            throw new InvalidArgumentException("columns", columns);
         // All columns must belong to this table
         for (int i=0; i<columns.length; i++)
             if (columns[i].getRowSet()!=this)
-                throw new EmpireException(Errors.InvalidArg, columns[i].getFullName(), "columns");
+                throw new InvalidArgumentException("columns["+String.valueOf(i)+"]", columns[i].getFullName());
         // Set primary Key now
         primaryKey = new DBIndex(name + "_PK", DBIndex.PRIMARYKEY, columns);
     }
@@ -315,18 +319,18 @@ public class DBTable extends DBRowSet im
     /**
      * Adds an index.
      * 
-     * @param indexName the index name
+     * @param name the index name
      * @param unique is this a unique index
-     * @param indexColumns the columns indexed by this index
+     * @param columns the columns indexed by this index
      * 
      * @return true on success
      */
-    public void addIndex(String indexName, boolean unique, DBColumn[] indexColumns)
+    public void addIndex(String name, boolean unique, DBColumn[] columns)
     {
-        if (indexName==null || indexColumns==null || indexColumns.length==0)
-            throw new EmpireException(Errors.InvalidArg, null, "name|columns");
+        if (name==null || columns==null || columns.length==0)
+            throw new InvalidArgumentException("name|columns", null);
         // add Index now
-        indexes.add(new DBIndex(indexName, (unique) ? DBIndex.UNIQUE : DBIndex.STANDARD, indexColumns));
+        indexes.add(new DBIndex(name, (unique) ? DBIndex.UNIQUE : DBIndex.STANDARD, columns));
     }
 
     /**
@@ -430,12 +434,12 @@ public class DBTable extends DBRowSet im
     {
         // Check Primary key
         if (primaryKey == null )
-            throw new EmpireException(DBErrors.NoPrimaryKey, getName());
+            throw new NoPrimaryKeyException(this);
 
         // Check Columns
         DBColumn[] keyColumns = primaryKey.getColumns();
         if (key == null || key.length != keyColumns.length)
-            throw new EmpireException(Errors.InvalidArg, key); // Invalid Argument
+            throw new InvalidArgumentException("key", key);
 
         // Delete References
         if (isCascadeDelete())
@@ -450,15 +454,15 @@ public class DBTable extends DBRowSet im
         int affected  = db.executeSQL(sqlCmd, cmd.getParamValues(), conn);
         if (affected < 0)
         { // Delete Failed
-            throw new EmpireException(Errors.UnexpectedValue, affected, "db.executeSQL()");
+            throw new UnexpectedReturnValueException(affected, "db.executeSQL()");
         } 
         else if (affected == 0)
         { // Record not found
-            throw new EmpireException(DBErrors.RecordDeleteFailed, name);
+            throw new RecordDeleteFailedException(this, key);
         } 
         else if (affected > 1)
         { // Multiple Records affected
-            throw new EmpireException(DBErrors.RecordUpdateInvalid, name);
+            throw new RecordUpdateInvalidException(this, key);
         }
     }
 

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/DBTableColumn.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/DBTableColumn.java?rev=1150139&r1=1150138&r2=1150139&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/DBTableColumn.java (original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/DBTableColumn.java Sat Jul 23 16:09:27 2011
@@ -24,10 +24,12 @@ import java.text.SimpleDateFormat;
 import java.util.Date;
 
 import org.apache.empire.commons.Attributes;
-import org.apache.empire.commons.EmpireException;
-import org.apache.empire.commons.Errors;
 import org.apache.empire.data.DataMode;
 import org.apache.empire.data.DataType;
+import org.apache.empire.db.exceptions.FieldIllegalValueException;
+import org.apache.empire.db.exceptions.FieldNotNullException;
+import org.apache.empire.db.exceptions.FieldValueTooLongException;
+import org.apache.empire.exceptions.PropertyReadOnlyException;
 import org.apache.empire.xml.XMLUtil;
 import org.w3c.dom.Element;
 
@@ -210,7 +212,7 @@ public class DBTableColumn extends DBCol
     {
         if (isAutoGenerated())
         {	// cannot change auto-generated columns
-            throw new EmpireException(Errors.NoAccess); 
+            throw new PropertyReadOnlyException("required"); 
         }
         else
         {	// Set DataMode
@@ -264,7 +266,7 @@ public class DBTableColumn extends DBCol
     {
         // Check for NULL
         if (isRequired() && (value == null || value.toString().length() < 1))
-            throw new EmpireException(DBErrors.FieldNotNull, getName());
+            throw new FieldNotNullException(this);
         // Is value valid
         switch (type)
         {
@@ -280,8 +282,8 @@ public class DBTableColumn extends DBCol
                         // OK
                     } catch (ParseException e)
                     {   // Error
-                        log.error("checkValue exception: " + e.toString() + " column=" + getName() + " value=" + value);
-                        throw new EmpireException(DBErrors.FieldInvalidDateFormat, getName());
+                        log.error("checkValue failed: " + e.toString() + " column=" + getName() + " value=" + value);
+                        throw new FieldIllegalValueException(this, String.valueOf(value), e);
                     }
                 }    
                 break;
@@ -295,10 +297,10 @@ public class DBTableColumn extends DBCol
                         if (val.length() > 0)
                             Double.parseDouble(val);
                         // thows NumberFormatException if not a number!
-                    } catch (NumberFormatException nfe)
+                    } catch (NumberFormatException e)
                     {
-                        log.error("checkValue exception: " + nfe.toString() + " column=" + getName() + " value=" + value);
-                        throw new EmpireException(DBErrors.FieldNotNumeric, getName());
+                        log.error("checkValue exception: " + e.toString() + " column=" + getName() + " value=" + value);
+                        throw new FieldIllegalValueException(this, String.valueOf(value), e);
                     }
                 }
                 break;
@@ -311,10 +313,10 @@ public class DBTableColumn extends DBCol
                         if (val.length() > 0)
                             Long.parseLong(val);
                         // throws NumberFormatException if not an integer!
-                    } catch (NumberFormatException nfe)
+                    } catch (NumberFormatException e)
                     {
-                        log.error("checkValue exception: " + nfe.toString() + " column=" + getName() + " value=" + String.valueOf(value));
-                        throw new EmpireException(DBErrors.FieldNotNumeric, getName());
+                        log.error("checkValue exception: " + e.toString() + " column=" + getName() + " value=" + String.valueOf(value));
+                        throw new FieldIllegalValueException(this, String.valueOf(value), e);
                     }
                 }
                 break;
@@ -322,7 +324,7 @@ public class DBTableColumn extends DBCol
             case TEXT:
             case CHAR:
                 if (value!=null && value.toString().length() > size)
-                    throw new EmpireException(DBErrors.FieldValueTooLong, getName(), (int)size);
+                    throw new FieldValueTooLongException(this);
                 break;
                 
             default:

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/DBView.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/DBView.java?rev=1150139&r1=1150138&r2=1150139&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/DBView.java (original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/DBView.java Sat Jul 23 16:09:27 2011
@@ -21,11 +21,12 @@ package org.apache.empire.db;
 import java.sql.Connection;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import org.apache.empire.commons.EmpireException;
-import org.apache.empire.commons.Errors;
 import org.apache.empire.commons.Options;
 import org.apache.empire.data.DataType;
 import org.apache.empire.db.expr.column.DBValueExpr;
+import org.apache.empire.exceptions.InvalidArgumentException;
+import org.apache.empire.exceptions.ItemExistsException;
+import org.apache.empire.exceptions.NotSupportedException;
 import org.apache.empire.xml.XMLUtil;
 import org.w3c.dom.Element;
 
@@ -287,9 +288,9 @@ public abstract class DBView extends DBR
     protected void addColumn(DBViewColumn col)
     { // find column by name
         if (col == null || col.getRowSet() != this)
-            throw new EmpireException(Errors.InvalidArg, col, "col");
+            throw new InvalidArgumentException("col", col);
         if (columns.contains(col) == true)
-            throw new EmpireException(Errors.ItemExists, col.getName());
+            throw new ItemExistsException(col.getName());
         // add now
         columns.add(col);
     }
@@ -383,7 +384,7 @@ public abstract class DBView extends DBR
     public void updateRecord(DBRecord rec, Connection conn)
     {
         if (updateable==false)
-            throw new EmpireException(Errors.NotSupported, "updateRecord");
+            throw new NotSupportedException(this, "updateRecord");
         // Update the record
         super.updateRecord(rec, conn);
     }
@@ -396,7 +397,7 @@ public abstract class DBView extends DBR
     @Override
     public void createRecord(DBRecord rec, Connection conn)
     {
-        throw new EmpireException(Errors.NotSupported, "addRecord");
+        throw new NotSupportedException(this, "addRecord");
     }
 
     /*
@@ -407,6 +408,6 @@ public abstract class DBView extends DBR
     @Override
     public void deleteRecord(Object[] keys, Connection conn)
     {
-        throw new EmpireException(Errors.NotSupported, "deleteRecord");
+        throw new NotSupportedException(this, "deleteRecord");
     }
 }
\ No newline at end of file

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/derby/DBDatabaseDriverDerby.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/derby/DBDatabaseDriverDerby.java?rev=1150139&r1=1150138&r2=1150139&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/derby/DBDatabaseDriverDerby.java (original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/derby/DBDatabaseDriverDerby.java Sat Jul 23 16:09:27 2011
@@ -22,8 +22,6 @@ import java.sql.Connection;
 import java.util.GregorianCalendar;
 import java.util.Iterator;
 
-import org.apache.empire.commons.EmpireException;
-import org.apache.empire.commons.Errors;
 import org.apache.empire.commons.StringUtils;
 import org.apache.empire.data.DataType;
 import org.apache.empire.db.DBCmdType;
@@ -41,6 +39,9 @@ import org.apache.empire.db.DBSQLScript;
 import org.apache.empire.db.DBTable;
 import org.apache.empire.db.DBTableColumn;
 import org.apache.empire.db.DBView;
+import org.apache.empire.exceptions.InvalidArgumentException;
+import org.apache.empire.exceptions.NotImplementedException;
+import org.apache.empire.exceptions.NotSupportedException;
 
 
 /**
@@ -288,7 +289,7 @@ public class DBDatabaseDriverDerby exten
     {
         // The Object's database must be attached to this driver
         if (dbo == null || dbo.getDatabase().getDriver() != this)
-            throw new EmpireException(Errors.InvalidArg, dbo, "dbo");
+            throw new InvalidArgumentException("dbo", String.valueOf(dbo));
         // Check Type of object
         if (dbo instanceof DBDatabase)
         { // Database
@@ -301,7 +302,7 @@ public class DBDatabaseDriverDerby exten
                     dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
                     return;
                 default:
-                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new NotImplementedException(this, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTable)
@@ -315,7 +316,7 @@ public class DBDatabaseDriverDerby exten
                     dropObject(((DBTable) dbo).getName(), "TABLE", script);
                     return;
                 default:
-                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new NotImplementedException(this, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBView)
@@ -329,7 +330,7 @@ public class DBDatabaseDriverDerby exten
                     dropObject(((DBView) dbo).getName(), "VIEW", script);
                     return;
                 default:
-                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new NotImplementedException(this, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBRelation)
@@ -343,7 +344,7 @@ public class DBDatabaseDriverDerby exten
                     dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
                     return;
                 default:
-                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new NotImplementedException(this, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTableColumn)
@@ -352,8 +353,8 @@ public class DBDatabaseDriverDerby exten
             return;
         } 
         else
-        { // an invalid argument has been supplied
-            throw new EmpireException(Errors.InvalidArg, dbo, "dbo");
+        { // dll generation not supported for this type
+            throw new NotSupportedException(this, "getDDLScript() for "+dbo.getClass().getName());
         }
     }
 
@@ -699,7 +700,7 @@ public class DBDatabaseDriverDerby exten
         {   // Check whether Error information is available
             log.error("No command has been supplied for view " + v.getName());
             // No error information available: Use Errors.NotImplemented
-            throw new EmpireException(Errors.NotImplemented, v.getName() + ".createCommand");
+            throw new NotImplementedException(this, v.getName() + ".createCommand");
         }
         // Make sure there is no OrderBy
         cmd.clearOrderBy();
@@ -733,7 +734,7 @@ public class DBDatabaseDriverDerby exten
     protected void dropObject(String name, String objType, DBSQLScript script)
     {
         if (name == null || name.length() == 0)
-            throw new EmpireException(Errors.InvalidArg, name, "name");
+            throw new InvalidArgumentException("name", name);
         // Create Drop Statement
         StringBuilder sql = new StringBuilder();
         sql.append("DROP ");

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/
------------------------------------------------------------------------------
    eol-style = native

Added: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/DatabaseNotOpenException.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/DatabaseNotOpenException.java?rev=1150139&view=auto
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/DatabaseNotOpenException.java (added)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/DatabaseNotOpenException.java Sat Jul 23 16:09:27 2011
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.db.exceptions;
+
+import org.apache.empire.commons.ErrorType;
+import org.apache.empire.commons.StringUtils;
+import org.apache.empire.db.DBDatabase;
+import org.apache.empire.exceptions.EmpireException;
+
+public class DatabaseNotOpenException extends EmpireException
+{
+    /**
+     * Comment for <code>serialVersionUID</code>
+     */
+    private static final long serialVersionUID = 1L;
+    
+    public static final ErrorType errorType = new ErrorType("error.db.databasenotopen",    "the database {0} has not been opened.");
+    
+    public DatabaseNotOpenException(DBDatabase db)
+    {
+        super(errorType, new Object[] { (db!=null && StringUtils.isNotEmpty(db.getSchema())) ? db.getSchema() : "{NO_SCHEMA}"  });
+    }
+}

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/DatabaseNotOpenException.java
------------------------------------------------------------------------------
    eol-style = native

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/DatabaseNotOpenException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldIllegalValueException.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldIllegalValueException.java?rev=1150139&view=auto
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldIllegalValueException.java (added)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldIllegalValueException.java Sat Jul 23 16:09:27 2011
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.db.exceptions;
+
+import org.apache.empire.commons.ErrorType;
+import org.apache.empire.db.DBColumn;
+
+public class FieldIllegalValueException extends FieldValueException
+{
+    /**
+     * Comment for <code>serialVersionUID</code>
+     */
+    private static final long serialVersionUID = 1L;
+    
+    public static final ErrorType errorType = new ErrorType("error.db.fieldillegalvalue",  "The value {1} for field {0} is invalid.");
+    
+    public FieldIllegalValueException(DBColumn column, String value, Throwable cause)
+    {
+        super(column, errorType, new Object[] { column.getFullName(), value }, cause);
+    }
+    
+    public FieldIllegalValueException(DBColumn column, String value)
+    {
+        super(column, errorType, new Object[] { column.getFullName(), value }, null);
+    }
+}

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldIllegalValueException.java
------------------------------------------------------------------------------
    eol-style = native

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldIllegalValueException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldIsReadOnlyException.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldIsReadOnlyException.java?rev=1150139&view=auto
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldIsReadOnlyException.java (added)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldIsReadOnlyException.java Sat Jul 23 16:09:27 2011
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.db.exceptions;
+
+import org.apache.empire.commons.ErrorType;
+import org.apache.empire.db.DBColumn;
+import org.apache.empire.exceptions.EmpireException;
+
+public class FieldIsReadOnlyException extends EmpireException
+{
+    /**
+     * Comment for <code>serialVersionUID</code>
+     */
+    private static final long serialVersionUID = 1L;
+    
+    public static final ErrorType errorType = new ErrorType("error.db.fieldisreadonly",    "The field {0} is read only.");
+    
+    public FieldIsReadOnlyException(DBColumn col)
+    {
+        super(errorType, new Object[] { col.getFullName() });
+    }
+}

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldIsReadOnlyException.java
------------------------------------------------------------------------------
    eol-style = native

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldIsReadOnlyException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldNotNullException.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldNotNullException.java?rev=1150139&view=auto
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldNotNullException.java (added)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldNotNullException.java Sat Jul 23 16:09:27 2011
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.db.exceptions;
+
+import org.apache.empire.commons.ErrorType;
+import org.apache.empire.db.DBColumn;
+import org.apache.empire.exceptions.EmpireException;
+
+public class FieldNotNullException extends EmpireException
+{
+    /**
+     * Comment for <code>serialVersionUID</code>
+     */
+    private static final long serialVersionUID = 1L;
+    
+    public static final ErrorType errorType = new ErrorType("error.db.fieldnotnull",       "The field {0} must not be null.");
+    
+    public FieldNotNullException(DBColumn col)
+    {
+        super(errorType, new Object[] { col.getFullName() });
+    }
+}

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldNotNullException.java
------------------------------------------------------------------------------
    eol-style = native

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldNotNullException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldValueException.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldValueException.java?rev=1150139&view=auto
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldValueException.java (added)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldValueException.java Sat Jul 23 16:09:27 2011
@@ -0,0 +1,31 @@
+/*
+ * ESTEAM Software GmbH, 23.07.2011
+ */
+package org.apache.empire.db.exceptions;
+
+import org.apache.empire.commons.ErrorType;
+import org.apache.empire.db.DBColumn;
+import org.apache.empire.exceptions.EmpireException;
+
+public abstract class FieldValueException extends EmpireException
+{
+    /**
+     * Comment for <code>serialVersionUID</code>
+     */
+    private static final long serialVersionUID = 1L;
+    
+    private transient final DBColumn column;
+
+    protected FieldValueException(final DBColumn column, final ErrorType errType, final Object[] params, final Throwable cause)
+    {
+        super(errType, params, cause);
+        // save type and params for custom message formatting
+        this.column = column;
+    }
+    
+    public DBColumn getColumn()
+    {
+        return column;
+    }
+
+}

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldValueException.java
------------------------------------------------------------------------------
    eol-style = native

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldValueException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldValueTooLongException.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldValueTooLongException.java?rev=1150139&view=auto
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldValueTooLongException.java (added)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldValueTooLongException.java Sat Jul 23 16:09:27 2011
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.db.exceptions;
+
+import org.apache.empire.commons.ErrorType;
+import org.apache.empire.db.DBColumn;
+import org.apache.empire.exceptions.EmpireException;
+
+public class FieldValueTooLongException extends EmpireException
+{
+    /**
+     * Comment for <code>serialVersionUID</code>
+     */
+    private static final long serialVersionUID = 1L;
+    
+    public static final ErrorType errorType = new ErrorType("error.db.fieldvaluetoolong",  "The value supplied for field {0} is too long. The maximum number of characters is {1}.");
+    
+    public FieldValueTooLongException(DBColumn col)
+    {
+        super(errorType, new Object[] { col.getFullName(), (int)col.getSize() });
+    }
+}

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldValueTooLongException.java
------------------------------------------------------------------------------
    eol-style = native

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/FieldValueTooLongException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/InternalSQLException.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/InternalSQLException.java?rev=1150139&view=auto
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/InternalSQLException.java (added)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/InternalSQLException.java Sat Jul 23 16:09:27 2011
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.db.exceptions;
+
+import java.sql.SQLException;
+
+import org.apache.empire.commons.ErrorType;
+import org.apache.empire.db.DBDatabaseDriver;
+import org.apache.empire.db.DBObject;
+import org.apache.empire.exceptions.EmpireException;
+
+public class InternalSQLException extends EmpireException
+{
+    /**
+     * Comment for <code>serialVersionUID</code>
+     */
+    private static final long serialVersionUID = 1L;
+    
+    public static final ErrorType errorType = new ErrorType("error.db.sqlexception", "The database operation failed. Native error is {0}.");
+
+    protected static String messageFromSQLException(DBDatabaseDriver driver, SQLException sqle)
+    {   // Set the error Message
+        return (driver!=null ? driver.extractErrorMessage(sqle) : sqle.getMessage());
+    }
+
+    protected static DBDatabaseDriver driverFromObject(DBObject obj)
+    {   // Set the error Message
+        return (obj.getDatabase()!=null ? obj.getDatabase().getDriver() : (DBDatabaseDriver)null);
+    }
+    
+    public InternalSQLException(DBDatabaseDriver driver, SQLException cause)
+    {
+        super(errorType, new Object[] { messageFromSQLException(driver, cause) }, cause );
+    }
+    
+    public InternalSQLException(DBObject obj, SQLException cause)
+    {
+        this(driverFromObject(obj), cause);
+    }
+    
+    // Derived classes only
+    protected InternalSQLException(ErrorType type, Object[] params, SQLException cause)
+    {
+        super(type, params, cause);
+    }
+    
+}

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/InternalSQLException.java
------------------------------------------------------------------------------
    eol-style = native

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/InternalSQLException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/InvalidKeyException.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/InvalidKeyException.java?rev=1150139&view=auto
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/InvalidKeyException.java (added)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/InvalidKeyException.java Sat Jul 23 16:09:27 2011
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.db.exceptions;
+
+import org.apache.empire.commons.ErrorType;
+import org.apache.empire.commons.StringUtils;
+import org.apache.empire.db.DBRowSet;
+import org.apache.empire.exceptions.EmpireException;
+
+public class InvalidKeyException extends EmpireException
+{
+    /**
+     * Comment for <code>serialVersionUID</code>
+     */
+    private static final long serialVersionUID = 1L;
+    
+    public static final ErrorType errorType = new ErrorType("error.db.recordinvalidkey",   "Invalid record key {0} for rowset {1}.");
+    
+    public InvalidKeyException(DBRowSet rowset, Object[] key)
+    {
+        super(errorType, new Object[] { StringUtils.toString(key), StringUtils.coalesce(rowset.getName(), rowset.getAlias()) });
+    }
+}

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/InvalidKeyException.java
------------------------------------------------------------------------------
    eol-style = native

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/InvalidKeyException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/NoPrimaryKeyException.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/NoPrimaryKeyException.java?rev=1150139&view=auto
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/NoPrimaryKeyException.java (added)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/NoPrimaryKeyException.java Sat Jul 23 16:09:27 2011
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.db.exceptions;
+
+import org.apache.empire.commons.ErrorType;
+import org.apache.empire.commons.StringUtils;
+import org.apache.empire.db.DBRowSet;
+import org.apache.empire.exceptions.EmpireException;
+
+public class NoPrimaryKeyException extends EmpireException
+{
+    /**
+     * Comment for <code>serialVersionUID</code>
+     */
+    private static final long serialVersionUID = 1L;
+    
+    public static final ErrorType errorType = new ErrorType("error.db.noprimarykey", "No primary key is defined for {0}.");
+    
+    public NoPrimaryKeyException(DBRowSet rowset)
+    {
+        super(errorType, new Object[] { StringUtils.coalesce(rowset.getName(), rowset.getAlias()) });
+    }
+}

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/NoPrimaryKeyException.java
------------------------------------------------------------------------------
    eol-style = native

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/NoPrimaryKeyException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/QueryFailedException.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/QueryFailedException.java?rev=1150139&view=auto
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/QueryFailedException.java (added)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/QueryFailedException.java Sat Jul 23 16:09:27 2011
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.db.exceptions;
+
+import java.sql.SQLException;
+
+import org.apache.empire.commons.ErrorType;
+import org.apache.empire.db.DBObject;
+import org.apache.empire.exceptions.EmpireException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class QueryFailedException extends EmpireException
+{
+    // Logger
+    private static final Logger log = LoggerFactory.getLogger(QueryFailedException.class);
+    
+    /**
+     * Comment for <code>serialVersionUID</code>
+     */
+    private static final long serialVersionUID = 1L;
+    
+    public static final ErrorType errorType = new ErrorType("error.db.queryfailed",  "Error executing query {0}.\r\nNative error is {0}.");
+    
+    public QueryFailedException(DBObject obj, String sqlCmd, SQLException cause)
+    {
+        super(errorType, new Object[] { sqlCmd, InternalSQLException.messageFromSQLException(InternalSQLException.driverFromObject(obj), cause) }, cause);
+    }
+    
+    /**
+     * log the error
+     */
+    @Override
+    protected void log()
+    {
+       if ( log.isErrorEnabled() )
+            log.error(getMessage());
+       else
+           super.log();
+    }
+}

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/QueryFailedException.java
------------------------------------------------------------------------------
    eol-style = native

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/QueryFailedException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/QueryNoResultException.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/QueryNoResultException.java?rev=1150139&view=auto
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/QueryNoResultException.java (added)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/QueryNoResultException.java Sat Jul 23 16:09:27 2011
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.db.exceptions;
+
+import org.apache.empire.commons.ErrorType;
+import org.apache.empire.exceptions.EmpireException;
+
+public class QueryNoResultException extends EmpireException
+{
+    /**
+     * Comment for <code>serialVersionUID</code>
+     */
+    private static final long serialVersionUID = 1L;
+    
+    public static final ErrorType errorType = new ErrorType("error.db.querynoresult",  "No records found for query {0}.");
+    
+    public QueryNoResultException(String sqlCmd)
+    {
+        super(errorType, new Object[] { sqlCmd });
+    }
+}

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/QueryNoResultException.java
------------------------------------------------------------------------------
    eol-style = native

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/QueryNoResultException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/RecordDeleteFailedException.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/RecordDeleteFailedException.java?rev=1150139&view=auto
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/RecordDeleteFailedException.java (added)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/RecordDeleteFailedException.java Sat Jul 23 16:09:27 2011
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.db.exceptions;
+
+import org.apache.empire.commons.ErrorType;
+import org.apache.empire.commons.StringUtils;
+import org.apache.empire.db.DBRowSet;
+import org.apache.empire.exceptions.EmpireException;
+
+public class RecordDeleteFailedException extends EmpireException
+{
+    /**
+     * Comment for <code>serialVersionUID</code>
+     */
+    private static final long serialVersionUID = 1L;
+    
+    public static final ErrorType errorType = new ErrorType("error.db.recorddeletefailed", "Deleting the record {0} in {1} failed. The record might have been deleted already by another user.");
+    
+    public RecordDeleteFailedException(DBRowSet rowset, Object[] key)
+    {
+        super(errorType, new Object[] { StringUtils.toString(key), StringUtils.coalesce(rowset.getName(), rowset.getAlias()) });
+    }
+}

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/RecordDeleteFailedException.java
------------------------------------------------------------------------------
    eol-style = native

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/RecordDeleteFailedException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/RecordNotFoundException.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/RecordNotFoundException.java?rev=1150139&view=auto
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/RecordNotFoundException.java (added)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/RecordNotFoundException.java Sat Jul 23 16:09:27 2011
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.db.exceptions;
+
+import org.apache.empire.commons.ErrorType;
+import org.apache.empire.commons.StringUtils;
+import org.apache.empire.db.DBRowSet;
+import org.apache.empire.exceptions.EmpireException;
+
+public class RecordNotFoundException extends EmpireException
+{
+    /**
+     * Comment for <code>serialVersionUID</code>
+     */
+    private static final long serialVersionUID = 1L;
+    
+    public static final ErrorType errorType = new ErrorType("error.db.recordnotfound", "The record {0} does not exist in {1}. It might have been deleted by another user.");
+    
+    public RecordNotFoundException(DBRowSet rowset, Object[] key)
+    {
+        super(errorType, new Object[] { StringUtils.toString(key), StringUtils.coalesce(rowset.getName(), rowset.getAlias()) });
+    }
+}

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/RecordNotFoundException.java
------------------------------------------------------------------------------
    eol-style = native

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/RecordNotFoundException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/RecordUpdateFailedException.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/RecordUpdateFailedException.java?rev=1150139&view=auto
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/RecordUpdateFailedException.java (added)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/RecordUpdateFailedException.java Sat Jul 23 16:09:27 2011
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.db.exceptions;
+
+import org.apache.empire.commons.ErrorType;
+import org.apache.empire.commons.StringUtils;
+import org.apache.empire.db.DBRowSet;
+import org.apache.empire.exceptions.EmpireException;
+
+public class RecordUpdateFailedException extends EmpireException
+{
+    /**
+     * Comment for <code>serialVersionUID</code>
+     */
+    private static final long serialVersionUID = 1L;
+    
+    public static final ErrorType errorType = new ErrorType("error.db.recordupateinvalid", "Updating the record {0} in {1} failed. The given record key is ambiguous.");
+    
+    public RecordUpdateFailedException(DBRowSet rowset, Object[] key)
+    {
+        super(errorType, new Object[] { StringUtils.toString(key), StringUtils.coalesce(rowset.getName(), rowset.getAlias()) });
+    }
+}

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/RecordUpdateFailedException.java
------------------------------------------------------------------------------
    eol-style = native

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/RecordUpdateFailedException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/RecordUpdateInvalidException.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/RecordUpdateInvalidException.java?rev=1150139&view=auto
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/RecordUpdateInvalidException.java (added)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/RecordUpdateInvalidException.java Sat Jul 23 16:09:27 2011
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.empire.db.exceptions;
+
+import org.apache.empire.commons.ErrorType;
+import org.apache.empire.commons.StringUtils;
+import org.apache.empire.db.DBRowSet;
+import org.apache.empire.exceptions.EmpireException;
+
+public class RecordUpdateInvalidException extends EmpireException
+{
+    /**
+     * Comment for <code>serialVersionUID</code>
+     */
+    private static final long serialVersionUID = 1L;
+    
+    public static final ErrorType errorType = new ErrorType("error.db.recordupatefailed",  "Updating the record {0} in {1} failed. It might have been changed or deleted by another user.");
+    
+    public RecordUpdateInvalidException(DBRowSet rowset, Object[] key)
+    {
+        super(errorType, new Object[] { StringUtils.toString(key), StringUtils.coalesce(rowset.getName(), rowset.getAlias()) });
+    }
+}

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/RecordUpdateInvalidException.java
------------------------------------------------------------------------------
    eol-style = native

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/RecordUpdateInvalidException.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/package.html
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/package.html?rev=1150139&view=auto
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/package.html (added)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/package.html Sat Jul 23 16:09:27 2011
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- 
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ --> 
+<html>
+<head>
+</head>
+<body>
+
+This package contains classes for exception handling of database related errors.
+
+</body></html>
\ No newline at end of file

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/package.html
------------------------------------------------------------------------------
    eol-style = native

Propchange: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/exceptions/package.html
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/h2/DBDatabaseDriverH2.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/h2/DBDatabaseDriverH2.java?rev=1150139&r1=1150138&r2=1150139&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/h2/DBDatabaseDriverH2.java (original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/h2/DBDatabaseDriverH2.java Sat Jul 23 16:09:27 2011
@@ -22,8 +22,6 @@ import java.sql.Connection;
 import java.util.GregorianCalendar;
 import java.util.Iterator;
 
-import org.apache.empire.commons.EmpireException;
-import org.apache.empire.commons.Errors;
 import org.apache.empire.commons.StringUtils;
 import org.apache.empire.data.DataType;
 import org.apache.empire.db.DBCmdType;
@@ -41,6 +39,9 @@ import org.apache.empire.db.DBSQLScript;
 import org.apache.empire.db.DBTable;
 import org.apache.empire.db.DBTableColumn;
 import org.apache.empire.db.DBView;
+import org.apache.empire.exceptions.InvalidArgumentException;
+import org.apache.empire.exceptions.NotImplementedException;
+import org.apache.empire.exceptions.NotSupportedException;
 
 
 /**
@@ -293,7 +294,7 @@ public class DBDatabaseDriverH2 extends 
     {
         // The Object's database must be attached to this driver
         if (dbo==null || dbo.getDatabase().getDriver()!=this)
-            throw new EmpireException(Errors.InvalidArg, dbo, "dbo");
+            throw new InvalidArgumentException("dbo", dbo);
         // Check Type of object
         if (dbo instanceof DBDatabase)
         { // Database
@@ -306,7 +307,7 @@ public class DBDatabaseDriverH2 extends 
                     dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
                     return;
                 default:
-                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new NotImplementedException(this, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTable)
@@ -320,7 +321,7 @@ public class DBDatabaseDriverH2 extends 
                     dropObject(((DBTable) dbo).getName(), "TABLE", script);
                     return;
                 default:
-                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new NotImplementedException(this, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBView)
@@ -334,7 +335,7 @@ public class DBDatabaseDriverH2 extends 
                     dropObject(((DBView) dbo).getName(), "VIEW", script);
                     return;
                 default:
-                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new NotImplementedException(this, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBRelation)
@@ -348,7 +349,7 @@ public class DBDatabaseDriverH2 extends 
                     dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
                     return;
                 default:
-                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new NotImplementedException(this, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTableColumn)
@@ -357,8 +358,8 @@ public class DBDatabaseDriverH2 extends 
             return;
         } 
         else
-        { // an invalid argument has been supplied
-            throw new EmpireException(Errors.InvalidArg, dbo, "dbo");
+        { // dll generation not supported for this type
+            throw new NotSupportedException(this, "getDDLScript() for "+dbo.getClass().getName());
         }
     }
 
@@ -687,7 +688,7 @@ public class DBDatabaseDriverH2 extends 
         if (cmd==null)
         {   // Check whether Error information is available
             log.error("No command has been supplied for view " + v.getName());
-            throw new EmpireException(Errors.NotImplemented, v.getName() + ".createCommand");
+            throw new NotImplementedException(this, v.getName() + ".createCommand");
         }
         // Make sure there is no OrderBy
         cmd.clearOrderBy();
@@ -721,7 +722,7 @@ public class DBDatabaseDriverH2 extends 
     protected void dropObject(String name, String objType, DBSQLScript script)
     {
         if (name == null || name.length() == 0)
-            throw new EmpireException(Errors.InvalidArg, name, "name");
+            throw new InvalidArgumentException("name", name);
         // Create Drop Statement
         StringBuilder sql = new StringBuilder();
         sql.append("DROP ");

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/hsql/DBDatabaseDriverHSql.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/hsql/DBDatabaseDriverHSql.java?rev=1150139&r1=1150138&r2=1150139&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/hsql/DBDatabaseDriverHSql.java (original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/hsql/DBDatabaseDriverHSql.java Sat Jul 23 16:09:27 2011
@@ -22,8 +22,6 @@ import java.sql.Connection;
 import java.util.GregorianCalendar;
 import java.util.Iterator;
 
-import org.apache.empire.commons.EmpireException;
-import org.apache.empire.commons.Errors;
 import org.apache.empire.data.DataType;
 import org.apache.empire.db.DBCmdType;
 import org.apache.empire.db.DBColumn;
@@ -40,6 +38,9 @@ import org.apache.empire.db.DBSQLScript;
 import org.apache.empire.db.DBTable;
 import org.apache.empire.db.DBTableColumn;
 import org.apache.empire.db.DBView;
+import org.apache.empire.exceptions.InvalidArgumentException;
+import org.apache.empire.exceptions.NotImplementedException;
+import org.apache.empire.exceptions.NotSupportedException;
 
 
 /**
@@ -258,7 +259,7 @@ public class DBDatabaseDriverHSql extend
     {
         // The Object's database must be attached to this driver
         if (dbo==null || dbo.getDatabase().getDriver()!=this)
-            throw new EmpireException(Errors.InvalidArg, dbo, "dbo");
+            throw new InvalidArgumentException("dbo", dbo);
         // Check Type of object
         if (dbo instanceof DBDatabase)
         { // Database
@@ -271,7 +272,7 @@ public class DBDatabaseDriverHSql extend
                     dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
                     return;
                 default:
-                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new NotImplementedException(this, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTable)
@@ -285,7 +286,7 @@ public class DBDatabaseDriverHSql extend
                     dropObject(((DBTable) dbo).getName(), "TABLE", script);
                     return;
                 default:
-                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new NotImplementedException(this, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBView)
@@ -299,7 +300,7 @@ public class DBDatabaseDriverHSql extend
                     dropObject(((DBView) dbo).getName(), "VIEW", script);
                     return;
                 default:
-                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new NotImplementedException(this, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBRelation)
@@ -313,7 +314,7 @@ public class DBDatabaseDriverHSql extend
                     alterRelation((DBRelation) dbo, type, script);
                     return;
                 default:
-                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new NotImplementedException(this, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTableColumn)
@@ -322,8 +323,8 @@ public class DBDatabaseDriverHSql extend
             return;
         } 
         else
-        { // an invalid argument has been supplied
-            throw new EmpireException(Errors.InvalidArg, dbo, "dbo");
+        { // dll generation not supported for this type
+            throw new NotSupportedException(this, "getDDLScript() for "+dbo.getClass().getName());
         }
     }
 
@@ -633,7 +634,7 @@ public class DBDatabaseDriverHSql extend
                 break;
             }
             default:
-                throw new EmpireException(Errors.NotImplemented, "Type not supported (" + type + ")");
+                throw new NotImplementedException(this, "Type not supported (" + type + ")");
         }
 
     }
@@ -681,7 +682,7 @@ public class DBDatabaseDriverHSql extend
         if (cmd==null)
         {   // Check whether Error information is available
             log.error("No command has been supplied for view " + v.getName());
-            throw new EmpireException(Errors.NotImplemented, v.getName() + ".createCommand");
+            throw new NotImplementedException(this, v.getName() + ".createCommand");
         }
         // Make sure there is no OrderBy
         cmd.clearOrderBy();
@@ -715,7 +716,7 @@ public class DBDatabaseDriverHSql extend
     protected void dropObject(String name, String objType, DBSQLScript script)
     {
         if (name == null || name.length() == 0)
-            throw new EmpireException(Errors.InvalidArg, name, "name");
+            throw new InvalidArgumentException("name", name);
         // Create Drop Statement
         StringBuilder sql = new StringBuilder();
         sql.append("DROP ");

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/mysql/DBDatabaseDriverMySQL.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/mysql/DBDatabaseDriverMySQL.java?rev=1150139&r1=1150138&r2=1150139&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/mysql/DBDatabaseDriverMySQL.java (original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/mysql/DBDatabaseDriverMySQL.java Sat Jul 23 16:09:27 2011
@@ -23,8 +23,6 @@ import java.sql.SQLException;
 import java.util.GregorianCalendar;
 import java.util.Iterator;
 
-import org.apache.empire.commons.EmpireException;
-import org.apache.empire.commons.Errors;
 import org.apache.empire.commons.StringUtils;
 import org.apache.empire.data.DataType;
 import org.apache.empire.db.DBCmdType;
@@ -34,7 +32,6 @@ import org.apache.empire.db.DBCommandExp
 import org.apache.empire.db.DBDatabase;
 import org.apache.empire.db.DBDatabaseDriver;
 import org.apache.empire.db.DBDriverFeature;
-import org.apache.empire.db.DBErrors;
 import org.apache.empire.db.DBExpr;
 import org.apache.empire.db.DBIndex;
 import org.apache.empire.db.DBObject;
@@ -43,6 +40,11 @@ import org.apache.empire.db.DBSQLScript;
 import org.apache.empire.db.DBTable;
 import org.apache.empire.db.DBTableColumn;
 import org.apache.empire.db.DBView;
+import org.apache.empire.db.exceptions.InternalSQLException;
+import org.apache.empire.exceptions.InvalidArgumentException;
+import org.apache.empire.exceptions.NotImplementedException;
+import org.apache.empire.exceptions.NotSupportedException;
+import org.apache.empire.exceptions.InvalidPropertyException;
 
 
 /**
@@ -220,8 +222,7 @@ public class DBDatabaseDriverMySQL exten
             
         } catch (SQLException e) {
             // throw exception
-            String msg = extractErrorMessage(e);
-            throw new EmpireException(DBErrors.SQLException, new Object[] { msg }, e);
+            throw new InternalSQLException(this, e);
         }
     }
 
@@ -380,7 +381,7 @@ public class DBDatabaseDriverMySQL exten
     {
         // The Object's database must be attached to this driver
         if (dbo==null || dbo.getDatabase().getDriver()!=this)
-            throw new EmpireException(Errors.InvalidArg, dbo, "dbo");
+            throw new InvalidArgumentException("dbo", dbo);
         // Check Type of object
         if (dbo instanceof DBDatabase)
         { // Database
@@ -393,7 +394,7 @@ public class DBDatabaseDriverMySQL exten
                     dropObject(((DBDatabase) dbo).getSchema(), "DATABASE", script);
                     return;
                 default:
-                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new NotImplementedException(this, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTable)
@@ -407,7 +408,7 @@ public class DBDatabaseDriverMySQL exten
                     dropObject(((DBTable) dbo).getName(), "TABLE", script);
                     return;
                 default:
-                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new NotImplementedException(this, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBView)
@@ -421,7 +422,7 @@ public class DBDatabaseDriverMySQL exten
                     dropObject(((DBView) dbo).getName(), "VIEW", script);
                     return;
                 default:
-                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new NotImplementedException(this, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBRelation)
@@ -435,7 +436,7 @@ public class DBDatabaseDriverMySQL exten
                     dropObject(((DBRelation) dbo).getName(), "CONSTRAINT", script);
                     return;
                 default:
-                    throw new EmpireException(Errors.NotImplemented, "getDDLScript." + dbo.getClass().getName() + "." + type);
+                    throw new NotImplementedException(this, "getDDLScript." + dbo.getClass().getName() + "." + type);
             }
         } 
         else if (dbo instanceof DBTableColumn)
@@ -444,8 +445,8 @@ public class DBDatabaseDriverMySQL exten
             return;
         } 
         else
-        { // an invalid argument has been supplied
-            throw new EmpireException(Errors.InvalidArg, dbo, "dbo");
+        { // dll generation not supported for this type
+            throw new NotSupportedException(this, "getDDLScript() for "+dbo.getClass().getName());
         }
     }
 
@@ -471,7 +472,7 @@ public class DBDatabaseDriverMySQL exten
         if (createSchema)
         {   // check database Name
             if (StringUtils.isEmpty(databaseName))
-                throw new EmpireException(Errors.InvalidProperty, "databaseName");
+                throw new InvalidPropertyException("databaseName", databaseName);
             // Create Database
             script.addStmt("CREATE DATABASE IF NOT EXISTS " + databaseName + " CHARACTER SET " + characterSet);
             script.addStmt("USE " + databaseName);
@@ -786,7 +787,7 @@ public class DBDatabaseDriverMySQL exten
         if (cmd==null)
         {   // Check whether Error information is available
             log.error("No command has been supplied for view " + v.getName());
-            throw new EmpireException(Errors.NotImplemented, v.getName() + ".createCommand");
+            throw new NotImplementedException(this, v.getName() + ".createCommand");
         }
         // Make sure there is no OrderBy
         cmd.clearOrderBy();
@@ -820,7 +821,7 @@ public class DBDatabaseDriverMySQL exten
     protected void dropObject(String name, String objType, DBSQLScript script)
     {
         if (name == null || name.length() == 0)
-            throw new EmpireException(Errors.InvalidArg, name, "name");
+            throw new InvalidArgumentException("name", name);
         // Create Drop Statement
         StringBuilder sql = new StringBuilder();
         sql.append("DROP ");

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/oracle/DBCommandOracle.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/oracle/DBCommandOracle.java?rev=1150139&r1=1150138&r2=1150139&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/oracle/DBCommandOracle.java (original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db/src/main/java/org/apache/empire/db/oracle/DBCommandOracle.java Sat Jul 23 16:09:27 2011
@@ -19,12 +19,11 @@
 package org.apache.empire.db.oracle;
 
 // Imports
-import org.apache.empire.commons.EmpireException;
-import org.apache.empire.commons.Errors;
 import org.apache.empire.db.DBCommand;
 import org.apache.empire.db.DBDatabase;
 import org.apache.empire.db.DBTable;
 import org.apache.empire.db.expr.compare.DBCompareExpr;
+import org.apache.empire.exceptions.ObjectNotValidException;
 
 /**
  * This class handles the special features of an oracle database.
@@ -124,7 +123,7 @@ public class DBCommandOracle extends DBC
     {
         resetParamUsage();
         if (select == null)
-            throw new EmpireException(Errors.ObjectNotValid, getClass().getName()); // invalid!
+            throw new ObjectNotValidException(this);
         // Prepares statement
         buf.append("SELECT ");
         if (optimizerHint != null)