db-ddlutils-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r356798 - in /db/ddlutils/trunk/src/java/org/apache/ddlutils: ./ io/ platform/ task/
Date Wed, 14 Dec 2005 16:31:25 GMT
Author: tomdz
Date: Wed Dec 14 08:31:21 2005
New Revision: 356798

URL: http://svn.apache.org/viewcvs?rev=356798&view=rev
Log:
Some javadoc fixes
Added ability to turn off XML validation for the DatabaseIO class
Some exception handling fixes in the Ant tasks

Modified:
    db/ddlutils/trunk/src/java/org/apache/ddlutils/Platform.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/io/DatabaseIO.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/AxionBuilder.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/AxionPlatform.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/task/CreateDatabaseCommand.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseTaskBase.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DdlToDatabaseTask.java
    db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteDataToDatabaseCommand.java

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/Platform.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/Platform.java?rev=356798&r1=356797&r2=356798&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/Platform.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/Platform.java Wed Dec 14 08:31:21 2005
@@ -622,7 +622,7 @@
      * 
      * @param connection The database connection
      * @param model      The database model to use
-     * @param dynaBean   The bean
+     * @param dynaBeans  The beans
      */
     public void insert(Connection connection, Database model, Collection dynaBeans) throws
DynaSqlException;
 

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/io/DatabaseIO.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/io/DatabaseIO.java?rev=356798&r1=356797&r2=356798&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/io/DatabaseIO.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/io/DatabaseIO.java Wed Dec 14 08:31:21
2005
@@ -44,10 +44,32 @@
  */
 public class DatabaseIO
 {
+    /** Whether to validate the XML. */
+    private boolean _validateXml = true;
     /** Whether to use the internal dtd that comes with DdlUtils. */
     private boolean _useInternalDtd = true;
 
     /**
+     * Returns whether XML is validated upon reading it.
+     * 
+     * @return <code>true</code> if read XML is validated
+     */
+    public boolean isValidateXml()
+    {
+        return _validateXml;
+    }
+
+    /**
+     * Specifies whether XML shall be validated upon reading it.
+     * 
+     * @param validateXml <code>true</code> if read XML shall be validated
+     */
+    public void setValidateXml(boolean validateXml)
+    {
+        _validateXml = validateXml;
+    }
+
+    /**
      * Returns whether the internal dtd that comes with DdlUtils is used.
      * 
      * @return <code>true</code> if parsing uses the internal dtd
@@ -79,6 +101,7 @@
         reader.getXMLIntrospector().getConfiguration().setAttributesForPrimitives(true);
         reader.getXMLIntrospector().getConfiguration().setWrapCollectionsInElement(false);
         reader.getXMLIntrospector().getConfiguration().setElementNameMapper(new HyphenatedNameMapper());
+        reader.setValidating(isValidateXml());
         if (isUseInternalDtd())
         {
             reader.setEntityResolver(new LocalEntityResolver());

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/AxionBuilder.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/AxionBuilder.java?rev=356798&r1=356797&r2=356798&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/AxionBuilder.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/AxionBuilder.java Wed Dec 14 08:31:21
2005
@@ -38,8 +38,6 @@
     public AxionBuilder(PlatformInfo info)
     {
         super(info);
-        info.setUseDelimitedIdentifiers(false);
-        info.setCommentsSupported(false);
     }
 
     /**

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/AxionPlatform.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/AxionPlatform.java?rev=356798&r1=356797&r2=356798&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/AxionPlatform.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/platform/AxionPlatform.java Wed Dec 14
08:31:21 2005
@@ -42,12 +42,15 @@
     {
         PlatformInfo info = new PlatformInfo();
 
+        info.setUseDelimitedIdentifiers(false);
+        info.setCommentsSupported(false);
         info.setRequiringNullAsDefaultValue(false);
         info.setPrimaryKeyEmbedded(true);
         info.setForeignKeysEmbedded(false);
         info.setIndicesEmbedded(false);
         info.addNativeTypeMapping(Types.ARRAY,         "BLOB");
         info.addNativeTypeMapping(Types.BINARY,        "VARBINARY");
+        info.addNativeTypeMapping(Types.BIGINT,        "LONG");
         info.addNativeTypeMapping(Types.BIT,           "BOOLEAN");
         info.addNativeTypeMapping(Types.DECIMAL,       "NUMBER");
         info.addNativeTypeMapping(Types.DISTINCT,      "VARBINARY");
@@ -62,7 +65,6 @@
         info.addNativeTypeMapping(Types.SMALLINT,      "SHORT");
         info.addNativeTypeMapping(Types.STRUCT,        "VARBINARY");
         info.addNativeTypeMapping(Types.TINYINT,       "SHORT");
-        info.addNativeTypeMapping(Types.BIGINT,        "LONG");
         info.addNativeTypeMapping("DATALINK", "VARBINARY");
 
         setSqlBuilder(new AxionBuilder(info));

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/task/CreateDatabaseCommand.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/CreateDatabaseCommand.java?rev=356798&r1=356797&r2=356798&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/task/CreateDatabaseCommand.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/task/CreateDatabaseCommand.java Wed Dec
14 08:31:21 2005
@@ -82,7 +82,7 @@
         }
         catch (UnsupportedOperationException ex)
         {
-            task.log("Database platform "+getPlatform().getName()+" does not support database
creation via JDBC", Project.MSG_ERR);
+            task.log("Database platform "+getPlatform().getName()+" does not support database
creation via JDBC or there was an error while creating it: "+ex.getMessage(), Project.MSG_ERR);
         }
         catch (Exception ex)
         {

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseTaskBase.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseTaskBase.java?rev=356798&r1=356797&r2=356798&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseTaskBase.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DatabaseTaskBase.java Wed Dec 14 08:31:21
2005
@@ -121,6 +121,16 @@
     }
 
     /**
+     * Returns the commands.
+     * 
+     * @return The commands
+     */
+    protected Iterator getCommands()
+    {
+        return _commands.iterator();
+    }
+    
+    /**
      * Creates the platform for the configured database.
      * 
      * @return The platform
@@ -144,7 +154,7 @@
      */
     protected void executeCommands(Database model) throws BuildException
     {
-        for (Iterator it = _commands.iterator(); it.hasNext();)
+        for (Iterator it = getCommands(); it.hasNext();)
         {
             Command cmd = (Command)it.next();
 

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DdlToDatabaseTask.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DdlToDatabaseTask.java?rev=356798&r1=356797&r2=356798&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DdlToDatabaseTask.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/task/DdlToDatabaseTask.java Wed Dec 14
08:31:21 2005
@@ -45,7 +45,7 @@
     /**
      * Specifies whether XML input files are validated against the internal or an external
DTD.
      *
-     * @param isValidating <code>true</code> if input files are to be validated
against the internal DTD
+     * @param useInternalDtd <code>true</code> if input files are to be validated
against the internal DTD
      */
     public void setUseInternalDtd(boolean useInternalDtd)
     {

Modified: db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteDataToDatabaseCommand.java
URL: http://svn.apache.org/viewcvs/db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteDataToDatabaseCommand.java?rev=356798&r1=356797&r2=356798&view=diff
==============================================================================
--- db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteDataToDatabaseCommand.java (original)
+++ db/ddlutils/trunk/src/java/org/apache/ddlutils/task/WriteDataToDatabaseCommand.java Wed
Dec 14 08:31:21 2005
@@ -136,41 +136,55 @@
         }
         catch (Exception ex)
         {
-            throw new BuildException(ex);
+            if (ex instanceof BuildException)
+            {
+                throw (BuildException)ex;
+            }
+            else
+            {
+                throw new BuildException(ex);
+            }
         }
     }
 
     /**
      * Reads a single data file.
      * 
-     * @param task       The parent task
-     * @param reader     The data reader
-     * @param schemaFile The schema file
+     * @param task     The parent task
+     * @param reader   The data reader
+     * @param dataFile The schema file
      */
-    private void readSingleDataFile(Task task, DataReader reader, File schemaFile)
+    private void readSingleDataFile(Task task, DataReader reader, File dataFile)
     {
-        if (!schemaFile.exists())
+        if (!dataFile.exists())
         {
-            task.log("Could not find data file "+schemaFile.getAbsolutePath(), Project.MSG_ERR);
+            task.log("Could not find data file "+dataFile.getAbsolutePath(), Project.MSG_ERR);
         }
-        else if (!schemaFile.isFile())
+        else if (!dataFile.isFile())
         {
-            task.log("Path "+schemaFile.getAbsolutePath()+" does not denote a data file",
Project.MSG_ERR);
+            task.log("Path "+dataFile.getAbsolutePath()+" does not denote a data file", Project.MSG_ERR);
         }
-        else if (!schemaFile.canRead())
+        else if (!dataFile.canRead())
         {
-            task.log("Could not read data file "+schemaFile.getAbsolutePath(), Project.MSG_ERR);
+            task.log("Could not read data file "+dataFile.getAbsolutePath(), Project.MSG_ERR);
         }
         else
         {
             try
             {
-                reader.parse(schemaFile);
-                task.log("Read data file "+schemaFile.getAbsolutePath(), Project.MSG_INFO);
+                reader.parse(dataFile);
+                task.log("Read data file "+dataFile.getAbsolutePath(), Project.MSG_INFO);
             }
             catch (Exception ex)
             {
-                throw new BuildException("Could not read data file "+schemaFile.getAbsolutePath(),
ex);
+                if (isFailOnError())
+                {
+                    throw new BuildException("Could not read data file "+dataFile.getAbsolutePath(),
ex);
+                }
+                else
+                {
+                    task.log("Could not read data file "+dataFile.getAbsolutePath(), Project.MSG_ERR);
+                }
             }
         }
     }



Mime
View raw message