empire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From doeb...@apache.org
Subject svn commit: r1148445 - in /incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-basic/src/main/java/org/apache/empire/samples/db: SampleApp.java SampleConfig.java
Date Tue, 19 Jul 2011 16:54:57 GMT
Author: doebele
Date: Tue Jul 19 16:54:56 2011
New Revision: 1148445

URL: http://svn.apache.org/viewvc?rev=1148445&view=rev
Log:
basic changes (not yet complete!)

Modified:
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-basic/src/main/java/org/apache/empire/samples/db/SampleApp.java
    incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-basic/src/main/java/org/apache/empire/samples/db/SampleConfig.java

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-basic/src/main/java/org/apache/empire/samples/db/SampleApp.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-basic/src/main/java/org/apache/empire/samples/db/SampleApp.java?rev=1148445&r1=1148444&r2=1148445&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-basic/src/main/java/org/apache/empire/samples/db/SampleApp.java
(original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-basic/src/main/java/org/apache/empire/samples/db/SampleApp.java
Tue Jul 19 16:54:56 2011
@@ -22,7 +22,6 @@ import java.sql.Connection;
 import java.sql.DriverManager;
 import java.util.List;
 
-import org.apache.empire.commons.ErrorObject;
 import org.apache.empire.commons.StringUtils;
 import org.apache.empire.db.DBColumnExpr;
 import org.apache.empire.db.DBCommand;
@@ -70,9 +69,6 @@ public class SampleApp 
 			// Init Configuration
 			config.init((args.length > 0 ? args[0] : "config.xml" ));
 
-			// Enable Exceptions
-            ErrorObject.setExceptionsEnabled(true);
-
 			System.out.println("Running DB Sample...");
 
 			// STEP 1: Get a JDBC Connection
@@ -160,7 +156,7 @@ public class SampleApp 
 	/**
      * <PRE>
 	 * Opens and returns a JDBC-Connection.
-	 * JDBC url, user and password for the connection are obained from the SampleConfig bean
+	 * JDBC url, user and password for the connection are obtained from the SampleConfig bean
 	 * Please use the config.xml file to change connection params.
      * </PRE>
 	 */
@@ -227,7 +223,7 @@ public class SampleApp 
 	 * Checks whether the database exists or not by executing
 	 *     select count(*) from DEPARTMENTS
 	 * If the Departments table does not exist the querySingleInt() function return -1 for failure.
-	 * Please note that in this case an error will appear in the log wich can be ingored.
+	 * Please note that in this case an error will appear in the log which can be ignored.
      * </PRE>
 	 */
 	private static boolean databaseExists(Connection conn)
@@ -243,7 +239,7 @@ public class SampleApp 
 	/**
      * <PRE>
 	 * Creates a DDL Script for entire SampleDB Database and executes it line by line.
-	 * Please make sure you uses the correct DatabaseDriver for your target dbms.
+	 * Please make sure you uses the correct DatabaseDriver for your target DBMS.
      * </PRE>
 	 */
 	private static void createDatabase(DBDatabaseDriver driver, Connection conn)

Modified: incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-basic/src/main/java/org/apache/empire/samples/db/SampleConfig.java
URL: http://svn.apache.org/viewvc/incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-basic/src/main/java/org/apache/empire/samples/db/SampleConfig.java?rev=1148445&r1=1148444&r2=1148445&view=diff
==============================================================================
--- incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-basic/src/main/java/org/apache/empire/samples/db/SampleConfig.java
(original)
+++ incubator/empire-db/branches/EMPIREDB-99/empire-db-examples/empire-db-example-basic/src/main/java/org/apache/empire/samples/db/SampleConfig.java
Tue Jul 19 16:54:56 2011
@@ -18,6 +18,7 @@
  */
 package org.apache.empire.samples.db;
 
+import org.apache.empire.EmpireException;
 import org.apache.empire.commons.Errors;
 import org.apache.empire.xml.XMLConfiguration;
 import org.apache.empire.xml.XMLUtil;
@@ -57,42 +58,39 @@ public class SampleConfig extends XMLCon
      * 
      * @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()



Mime
View raw message