db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r416908 - in /db/ojb/branches/OJB_1_0_RELEASE: build.xml lib/DdlUtils-1.0-dev.jar profile/hsqldb.profile src/java/org/apache/ojb/broker/ant/RepositoryDataTask.java src/java/org/apache/ojb/broker/ant/WriteDataToDatabaseCommand.java
Date Sat, 24 Jun 2006 12:35:56 GMT
Author: tomdz
Date: Sat Jun 24 05:35:55 2006
New Revision: 416908

URL: http://svn.apache.org/viewvc?rev=416908&view=rev
Log:
Added support for the shutdown of (embedded) databases like Hsqldb when preparing the test
database via DdlUtils

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/build.xml
    db/ojb/branches/OJB_1_0_RELEASE/lib/DdlUtils-1.0-dev.jar
    db/ojb/branches/OJB_1_0_RELEASE/profile/hsqldb.profile
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/ant/RepositoryDataTask.java
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/ant/WriteDataToDatabaseCommand.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/build.xml
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/build.xml?rev=416908&r1=416907&r2=416908&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/build.xml (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/build.xml Sat Jun 24 05:35:55 2006
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <!--
-/* Copyright 2002-2005 Apache Software Foundation
+/* Copyright 2002-2006 Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -411,7 +411,10 @@
                 <filter token="DATABASE_DEFAULT" value="${project}" />
             </filterset>
         </copy>
-        <ddl2Database usedelimitedsqlidentifiers="false">
+        <!-- If the database profile didn't specify that the database needs a shutdown,
we won't do so --> 
+        <property name="ddlutils.shutdownDatabase" value="false"/>
+        <ddl2Database usedelimitedsqlidentifiers="false"
+                      shutdowndatabase="${ddlutils.shutdownDatabase}">
             <database driverclassname="${torque.database.driver}"
                       url="${torque.database.createUrl}"
                       username="${torque.database.user}"
@@ -424,6 +427,7 @@
             <writeschematodatabase alterdatabase="false"/>
         </ddl2Database>
         <ojbData usedelimitedsqlidentifiers="false"
+                 shutdowndatabase="${ddlutils.shutdownDatabase}"
                  ojbpropertiesfile="${build.test}/ojb/OJB.properties" >
             <database driverclassname="${torque.database.driver}"
                       url="${torque.database.createUrl}"

Modified: db/ojb/branches/OJB_1_0_RELEASE/lib/DdlUtils-1.0-dev.jar
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/lib/DdlUtils-1.0-dev.jar?rev=416908&r1=416907&r2=416908&view=diff
==============================================================================
Binary files - no diff available.

Modified: db/ojb/branches/OJB_1_0_RELEASE/profile/hsqldb.profile
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/profile/hsqldb.profile?rev=416908&r1=416907&r2=416908&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/profile/hsqldb.profile (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/profile/hsqldb.profile Sat Jun 24 05:35:55 2006
@@ -90,7 +90,7 @@
 torque.database.user = sa
 torque.database.password =
 torque.database.host = 127.0.0.1
-
+ddlutils.shutdownDatabase = true
 
 # Tells JDBC task that javaName attribute for the tables and columns
 # should be made same as SQL name.

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/ant/RepositoryDataTask.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/ant/RepositoryDataTask.java?rev=416908&r1=416907&r2=416908&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/ant/RepositoryDataTask.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/ant/RepositoryDataTask.java
Sat Jun 24 05:35:55 2006
@@ -392,6 +392,10 @@
         }
         finally
         {
+            if (isShutdownDatabase())
+            {
+                getPlatform().shutdownDatabase();
+            }
             // rollback of our classloader change
             Thread.currentThread().setContextClassLoader(sysClassLoader);
         }

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/ant/WriteDataToDatabaseCommand.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/ant/WriteDataToDatabaseCommand.java?rev=416908&r1=416907&r2=416908&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/ant/WriteDataToDatabaseCommand.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/ant/WriteDataToDatabaseCommand.java
Sat Jun 24 05:35:55 2006
@@ -1,6 +1,6 @@
 package org.apache.ojb.broker.ant;
 
-/* Copyright 2005 The Apache Software Foundation.
+/* Copyright 2005-2006 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 
+import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.ddlutils.model.Database;
 import org.apache.ojb.broker.metadata.DescriptorRepository;
 import org.apache.tools.ant.BuildException;
@@ -165,17 +166,18 @@
             try
             {
                 handling.insertData(new FileReader(dataFile), batchSize);
-                task.log("Read data file "+dataFile.getAbsolutePath(), Project.MSG_INFO);
+                task.log("Written data file "+dataFile.getAbsolutePath() + " to database",
Project.MSG_INFO);
             }
             catch (Exception ex)
             {
                 if (isFailOnError())
                 {
-                    throw new BuildException("Could not read data file "+dataFile.getAbsolutePath(),
ex);
+                    throw new BuildException("Could not parse or write data file "+dataFile.getAbsolutePath(),
ex);
                 }
                 else
                 {
-                    task.log("Could not read data file "+dataFile.getAbsolutePath(), Project.MSG_ERR);
+                    task.log("Could not parse or write data file "+dataFile.getAbsolutePath()
+ ":", Project.MSG_ERR);
+                    task.log(ExceptionUtils.getFullStackTrace(ex));
                 }
             }
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message