empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject svn commit: r1148684 - 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-example-spring/src/main/java/org/apache/empire/samples/spring/ empire-db-e...
Date Wed, 20 Jul 2011 10:23:08 GMT
Author: doebele
Date: Wed Jul 20 10:23:07 2011
New Revision: 1148684

URL: http://svn.apache.org/viewvc?rev=1148684&view=rev
Log:
EMPIREDB-99 basic transition of core finished

Modified:
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-advanced/src/main/java/org/apache/empire/samples/db/advanced/SampleAdvApp.java
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-advanced/src/main/java/org/apache/empire/samples/db/advanced/SampleAdvConfig.java
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/SampleSpringApp.java
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/support/EmpireDBException.java
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/support/EmpireDaoSupport.java

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-advanced/src/main/java/org/apache/empire/samples/db/advanced/SampleAdvApp.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-advanced/src/main/java/org/apache/empire/samples/db/advanced/SampleAdvApp.java?rev=1148684&r1=1148683&r2=1148684&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-advanced/src/main/java/org/apache/empire/samples/db/advanced/SampleAdvApp.java
(original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-advanced/src/main/java/org/apache/empire/samples/db/advanced/SampleAdvApp.java
Wed Jul 20 10:23:07 2011
@@ -24,7 +24,6 @@ import java.util.Date;
 import java.util.HashMap;
 
 import org.apache.empire.commons.DateUtils;
-import org.apache.empire.commons.ErrorObject;
 import org.apache.empire.commons.Options;
 import org.apache.empire.commons.StringUtils;
 import org.apache.empire.data.DataMode;
@@ -74,9 +73,6 @@ public class SampleAdvApp 
             // Init Configuration
             config.init((args.length > 0 ? args[0] : "config.xml" ));
 
-            // Enable Exceptions
-            ErrorObject.setExceptionsEnabled(true);
-
             System.out.println("Running DB Sample Advanced...");
 
             // STEP 1: Get a JDBC Connection
@@ -334,11 +330,7 @@ public class SampleAdvApp 
         rec.create(T_DEP);
         rec.setValue(T_DEP.C_NAME, departmentName);
         rec.setValue(T_DEP.C_BUSINESS_UNIT, businessUnit);
-        if (!rec.update(conn))
-        {
-            log.error(rec.getErrorMessage());
-            return 0;
-        }
+        rec.update(conn);
         // Return Department ID
         return rec.getInt(T_DEP.C_DEPARTMENT_ID);
     }
@@ -356,11 +348,7 @@ public class SampleAdvApp 
         rec.setValue(T_EMP.C_FIRSTNAME, firstName);
         rec.setValue(T_EMP.C_LASTNAME, lastName);
         rec.setValue(T_EMP.C_GENDER, gender);
-        if (!rec.update(conn))
-        {
-            log.error(rec.getErrorMessage());
-            return 0;
-        }
+        rec.update(conn);
         // Return Employee ID
         return rec.getInt(T_EMP.C_EMPLOYEE_ID);
     }
@@ -378,10 +366,7 @@ public class SampleAdvApp 
         rec.setValue(T_EDH.C_EMPLOYEE_ID, employeeId);
         rec.setValue(T_EDH.C_DEPARTMENT_ID, departmentId);
         rec.setValue(T_EDH.C_DATE_FROM, dateFrom);
-        if (!rec.update(conn))
-        {
-            log.error(rec.getErrorMessage());
-        }
+        rec.update(conn);
     }
 
     /* This procedure demonstrates the use of command parameter for prepared statements */
@@ -459,8 +444,7 @@ public class SampleAdvApp 
             // Open Reader
             System.out.println("Running Query:");
             System.out.println(cmd.getSelect());
-            if (reader.open(cmd, conn) == false)
-                throw new RuntimeException(reader.getErrorMessage());
+            reader.open(cmd, conn);
             // Print output
             DBRecord record = new DBRecord();
             while (reader.moveNext())
@@ -512,8 +496,7 @@ public class SampleAdvApp 
         {   // Open Reader
             System.out.println("Running Query:");
             System.out.println(cmd.getSelect());
-            if (reader.open(cmd, conn) == false)
-                throw new RuntimeException(reader.getErrorMessage());
+            reader.open(cmd, conn);
             // Print output
             HashMap<Integer, DBRecord> employeeMap = new HashMap<Integer, DBRecord>();
             while (reader.moveNext())
@@ -643,8 +626,7 @@ public class SampleAdvApp 
         {   // Open Reader
             System.out.println("Running Query:");
             System.out.println(cmd.getSelect());
-            if (reader.open(cmd, conn) == false)
-                throw new RuntimeException(reader.getErrorMessage());
+            reader.open(cmd, conn);
             // Print column titles 
             System.out.println("---------------------------------");
             int count = reader.getFieldCount();

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-advanced/src/main/java/org/apache/empire/samples/db/advanced/SampleAdvConfig.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-advanced/src/main/java/org/apache/empire/samples/db/advanced/SampleAdvConfig.java?rev=1148684&r1=1148683&r2=1148684&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-advanced/src/main/java/org/apache/empire/samples/db/advanced/SampleAdvConfig.java
(original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-advanced/src/main/java/org/apache/empire/samples/db/advanced/SampleAdvConfig.java
Wed Jul 20 10:23:07 2011
@@ -18,6 +18,7 @@
  */
 package org.apache.empire.samples.db.advanced;
 
+import org.apache.empire.commons.EmpireException;
 import org.apache.empire.commons.Errors;
 import org.apache.empire.xml.XMLConfiguration;
 import org.apache.empire.xml.XMLUtil;
@@ -58,42 +59,39 @@ public class SampleAdvConfig extends XML
      * 
      * @return true on success 
      */
-    public boolean init(String filename)
+    public void init(String filename)
     {
         // Read the properties file
-        if (super.init(filename, false) == false)
-            return false;
+        super.init(filename, false);
         // Init Logging
         initLogging();
         // Done
-        if (readProperties(this, "properties")==false)
-            return false;
+        readProperties(this, "properties");
         // Reader Provider Properties
-        return readProperties(this, "properties-" + databaseProvider);
+        readProperties(this, "properties-" + databaseProvider);
     }
 
     /**
      * Init logging using Log4J's DOMConfigurator 
      * @return
      */
-    private boolean initLogging()
+    private void initLogging()
     {
         // Get configuration root node
         Element rootNode = getRootNode();
         if (rootNode == null)
-            return error(Errors.ObjectNotValid, getClass().getName());
+            throw new EmpireException(Errors.ObjectNotValid, getClass().getName());
         // Find log configuration node
         Element loggingNode = XMLUtil.findFirstChild(rootNode, loggingNodeName);
         if (loggingNode == null)
         {   // log configuration node not found
             log.error("Log configuration node {} has not been found. Logging has not been
configured.", loggingNodeName);
-            return error(Errors.ItemNotFound, loggingNodeName);
+            throw new EmpireException(Errors.ItemNotFound, loggingNodeName);
         }
         // Init Log4J
         DOMConfigurator.configure(loggingNode);
         // done
         log.info("Logging sucessfully configured from node {}.", loggingNodeName);
-        return success();
     }
 
     public String getDatabaseProvider()

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/SampleSpringApp.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/SampleSpringApp.java?rev=1148684&r1=1148683&r2=1148684&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/SampleSpringApp.java
(original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/SampleSpringApp.java
Wed Jul 20 10:23:07 2011
@@ -20,7 +20,6 @@ package org.apache.empire.samples.spring
 
 import java.util.logging.Logger;
 
-import org.apache.empire.commons.ErrorObject;
 import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.support.GenericApplicationContext;
@@ -31,9 +30,7 @@ import org.springframework.core.io.Class
  */
 public class SampleSpringApp {
     private static final Logger log = Logger.getLogger(SampleSpringApp.class.getName());
-    static {
-        ErrorObject.setExceptionsEnabled(true);
-    }
+
     //creates the application context
     //this is usually in some bootstrapping code; so your application will
     //just have one at runtime.

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/support/EmpireDBException.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/support/EmpireDBException.java?rev=1148684&r1=1148683&r2=1148684&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/support/EmpireDBException.java
(original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/support/EmpireDBException.java
Wed Jul 20 10:23:07 2011
@@ -18,13 +18,13 @@
  */
 package org.apache.empire.samples.spring.support;
 
-import org.apache.empire.EmpireException;
+import org.apache.empire.commons.EmpireException;
 import org.springframework.dao.UncategorizedDataAccessException;
 
 /**
  * Exception inside springs exception hierarchy. This may be good for client
  * code that catches any {@link org.springframework.dao.DataAccessException}
- * and doesn't want to look for implementation specific {@link org.apache.empire.EmpireException}.
+ * and doesn't want to look for implementation specific {@link org.apache.empire.commons.EmpireException}.
  */
 public class EmpireDBException extends UncategorizedDataAccessException {
 

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/support/EmpireDaoSupport.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/support/EmpireDaoSupport.java?rev=1148684&r1=1148683&r2=1148684&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/support/EmpireDaoSupport.java
(original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-spring/src/main/java/org/apache/empire/samples/spring/support/EmpireDaoSupport.java
Wed Jul 20 10:23:07 2011
@@ -20,7 +20,7 @@ package org.apache.empire.samples.spring
 
 import java.sql.Connection;
 
-import org.apache.empire.EmpireException;
+import org.apache.empire.commons.EmpireException;
 import org.apache.empire.db.DBCommand;
 import org.apache.empire.db.DBDatabase;
 import org.apache.empire.db.DBDatabaseDriver;



Mime
View raw message