mpoeschl    02/04/11 15:02:07

  Modified:    src/java/org/apache/torque/engine/database/model
                        AppData.java Column.java Database.java Table.java
                        TypeMap.java
               src/java/org/apache/torque/engine/database/transform
                        XmlToAppData.java
               src/java/org/apache/torque/task TorqueCreateDatabase.java
                        TorqueDataDumpTask.java TorqueDataModelTask.java
                        TorqueDataSQLTask.java TorqueDocumentationTask.java
                        TorqueJDBCTransformTask.java TorqueSQLExec.java
  Log:
  some coding style and javadoc cleanup (no functional changes)
  
  Revision  Changes    Path
  1.8       +6 -3      
jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/AppData.java
  
  Index: AppData.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/AppData.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- AppData.java      6 Mar 2002 02:59:07 -0000       1.7
  +++ AppData.java      11 Apr 2002 22:02:06 -0000      1.8
  @@ -74,7 +74,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]>Leon Messerschmidt</a>
    * @author <a href="mailto:[EMAIL PROTECTED]>John McNally</a>
    * @author <a href="mailto:[EMAIL PROTECTED]>Daniel Rall</a>
  - * @version $Id: AppData.java,v 1.7 2002/03/06 02:59:07 jmcnally Exp $
  + * @version $Id: AppData.java,v 1.8 2002/04/11 22:02:06 mpoeschl Exp $
    */
   public class AppData
   {
  @@ -180,7 +180,7 @@
       /**
        * Set the name of the database.
        *
  -     * @param String name
  +     * @param name of the database.
        */
       public void setName(String name)
       {
  @@ -209,6 +209,8 @@
   
       /**
        * Return an array of all databases
  +     * 
  +     * @return Array of Database objects
        */
       public Database[] getDatabases()
       {
  @@ -216,7 +218,7 @@
           Database[] dbs = new Database[size];
           for (int i = 0; i < size; i++)
           {
  -            dbs[i] = (Database)dbList.get(i);
  +            dbs[i] = (Database) dbList.get(i);
           }
           return dbs;
       }
  @@ -231,6 +233,7 @@
   
       /**
        * Return the database with the specified name.
  +     * 
        * @return A Database object.  If it does not exist it returns null
        */
       public Database getDatabase (String name)
  
  
  
  1.18      +6 -5      
jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/Column.java
  
  Index: Column.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/Column.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- Column.java       27 Dec 2001 18:28:59 -0000      1.17
  +++ Column.java       11 Apr 2002 22:02:06 -0000      1.18
  @@ -71,7 +71,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jon S. Stevens</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Daniel Rall</a>
    * @author <a href="mailto:byron_foster@[EMAIL PROTECTED]>Byron Foster</a>
  - * @version $Id: Column.java,v 1.17 2001/12/27 18:28:59 jmcnally Exp $
  + * @version $Id: Column.java,v 1.18 2002/04/11 22:02:06 mpoeschl Exp $
    */
   public class Column
   {
  @@ -81,6 +81,7 @@
       private String javaNamingMethod;
       private boolean isNotNull = false;
       private String size;
  +    /** type as defined in schema.xml */
       private String torqueType;
       private String javaType;
       private Object columnType;
  @@ -150,7 +151,7 @@
       /**
        * Imports a column from an XML specification
        */
  -    public void loadFromXML (Attributes attrib)
  +    public void loadFromXML(Attributes attrib)
       {
           //Name
           name = attrib.getValue("name");
  @@ -743,17 +744,17 @@
           else if (tn.indexOf ("DATE") != -1 )
           {
               torqueType = "DATE";
  -            columnType = new java.util.Date();
  +            columnType = new Date();
           }
           else if (tn.indexOf ("TIME") != -1)
           {
               torqueType = "TIMESTAMP";
  -            columnType = new java.util.Date();
  +            columnType = new Date();
           }
           else if (tn.indexOf ("BINARY") != -1)
           {
               torqueType = "LONGVARBINARY";
  -            columnType = new java.util.Hashtable();
  +            columnType = new Hashtable();
           }
           else
           {
  
  
  
  1.12      +12 -16    
jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/Database.java
  
  Index: Database.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/Database.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Database.java     27 Dec 2001 20:49:33 -0000      1.11
  +++ Database.java     11 Apr 2002 22:02:06 -0000      1.12
  @@ -64,9 +64,6 @@
   
   import org.apache.torque.Torque;
   import org.apache.torque.TorqueException;
  -
  -import org.apache.torque.engine.database.model.NameGenerator;
  -
   import org.apache.torque.adapter.IDMethod;
   
   
  @@ -78,7 +75,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]>Martin Poeschl</a>
    * @author <a href="mailto:[EMAIL PROTECTED]>Daniel Rall</a>
    * @author <a href="mailto:byron_foster@[EMAIL PROTECTED]>Byron Foster</a>
  - * @version $Id: Database.java,v 1.11 2001/12/27 20:49:33 jmcnally Exp $
  + * @version $Id: Database.java,v 1.12 2002/04/11 22:02:06 mpoeschl Exp $
    */
   public class Database
   {
  @@ -120,8 +117,7 @@
           {
               defaultJavaNamingMethod = NameGenerator.CONV_METHOD_UNDERSCORE;
           }
  -        heavyIndexing = "true"
  -            .equals(attrib.getValue("heavyIndexing"));
  +        heavyIndexing = "true".equals(attrib.getValue("heavyIndexing"));
       }
   
       /**
  @@ -274,7 +270,7 @@
           Table[] tbls = new Table[size];
           for (int i = 0; i < size; i++)
           {
  -            tbls[i] = (Table)tableList.get(i);
  +            tbls[i] = (Table) tableList.get(i);
           }
           return tbls;
       }
  @@ -283,18 +279,18 @@
        * Return the table with the specified name.
        * @return A Table object.  If it does not exist it returns null
        */
  -    public Table getTable (String name)
  +    public Table getTable(String name)
       {
  -        return (Table)tablesByName.get(name);
  +        return (Table) tablesByName.get(name);
       }
   
       /**
        * Return the table with the specified javaName.
        * @return A Table object.  If it does not exist it returns null
        */
  -    public Table getTableByJavaName (String javaName)
  +    public Table getTableByJavaName(String javaName)
       {
  -        return (Table)tablesByJavaName.get(javaName);
  +        return (Table) tablesByJavaName.get(javaName);
       }
   
       /**
  @@ -303,9 +299,9 @@
       public Table addTable(Attributes attrib)
       {
           Table tbl = new Table();
  -        tbl.setDatabase (this);
  -        tbl.loadFromXML (attrib, this.getDefaultIdMethod());
  -        addTable (tbl);
  +        tbl.setDatabase(this);
  +        tbl.loadFromXML(attrib, this.getDefaultIdMethod());
  +        addTable(tbl);
           return tbl;
       }
   
  @@ -314,7 +310,7 @@
        */
       public void addTable(Table tbl)
       {
  -        tbl.setDatabase (this);
  +        tbl.setDatabase(this);
           tableList.add(tbl);
           tablesByName.put(tbl.getName(), tbl);
           tablesByJavaName.put(tbl.getJavaName(), tbl);
  @@ -372,7 +368,7 @@
       public boolean requiresIdTable()
       {
           Table table[] = getTables();
  -        for (int i=0; i<table.length; i++)
  +        for (int i = 0; i < table.length; i++)
           {
               if (table[i].getIdMethod().equals(IDMethod.ID_BROKER))
               {
  
  
  
  1.27      +6 -6      
jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/Table.java
  
  Index: Table.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/Table.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- Table.java        14 Mar 2002 00:59:29 -0000      1.26
  +++ Table.java        11 Apr 2002 22:02:06 -0000      1.27
  @@ -75,7 +75,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]>John McNally</a>
    * @author <a href="mailto:[EMAIL PROTECTED]>Daniel Rall</a>
    * @author <a href="mailto:byron_foster@[EMAIL PROTECTED]>Byron Foster</a>
  - * @version $Id: Table.java,v 1.26 2002/03/14 00:59:29 mpoeschl Exp $
  + * @version $Id: Table.java,v 1.27 2002/04/11 22:02:06 mpoeschl Exp $
    */
   public class Table implements IDMethod
   {
  @@ -135,7 +135,7 @@
       /**
        * Load the table object from an xml tag.
        */
  -    public void loadFromXML (Attributes attrib, String defaultIdMethod)
  +    public void loadFromXML(Attributes attrib, String defaultIdMethod)
       {
           name = attrib.getValue("name");
           javaName = attrib.getValue("javaName");
  @@ -366,8 +366,8 @@
       public Column addColumn(Attributes attrib)
       {
           Column col = new Column();
  -        col.setTable (this);
  -        col.loadFromXML (attrib);
  +        col.setTable(this);
  +        col.loadFromXML(attrib);
           addColumn(col);
           return col;
       }
  @@ -417,13 +417,13 @@
       public List getChildrenNames()
       {
           if ( inheritanceColumn == null
  -             || !inheritanceColumn.isEnumeratedClasses() )
  +                || !inheritanceColumn.isEnumeratedClasses() )
           {
               return null;
           }
           List children = inheritanceColumn.getChildren();
           List names = new ArrayList(children.size());
  -        for ( int i=0; i<children.size(); i++ )
  +        for ( int i = 0; i < children.size(); i++ )
           {
               names.add( ((Inheritance)children.get(i)).getClassName() );
           }
  
  
  
  1.5       +18 -13    
jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/TypeMap.java
  
  Index: TypeMap.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/TypeMap.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- TypeMap.java      27 Dec 2001 18:28:59 -0000      1.4
  +++ TypeMap.java      11 Apr 2002 22:02:06 -0000      1.5
  @@ -55,11 +55,8 @@
    */
   
   import java.util.Hashtable;
  -import java.util.Date;
   import java.sql.Types;
   
  -import java.math.BigDecimal;
  -
   // I don't know if the peer system deals
   // with the recommended mappings.
   //
  @@ -107,7 +104,7 @@
    * </pre>
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
  - * @version $Id: TypeMap.java,v 1.4 2001/12/27 18:28:59 jmcnally Exp $
  + * @version $Id: TypeMap.java,v 1.5 2002/04/11 22:02:06 mpoeschl Exp $
    */
   public class TypeMap
   {
  @@ -501,8 +498,9 @@
       {
           // Make sure the we are initialized.
           if (isInitialized == false)
  +        {
               initialize();
  -
  +        }
           return (String)jdbcToJavaObjectMap.get(jdbcType);
       }
   
  @@ -514,8 +512,9 @@
       {
           // Make sure the we are initialized.
           if (isInitialized == false)
  +        {
               initialize();
  -
  +        }
           return (String) jdbcToJavaNativeMap.get(jdbcType);
       }
   
  @@ -527,8 +526,9 @@
       {
           // Make sure the we are initialized.
           if (isInitialized == false)
  +        {
               initialize();
  -        
  +        }
           String s = (String)jdbcToJavaNativeObjectMap.get(jdbcType);
           if ( s == null ) 
           {
  @@ -545,8 +545,9 @@
       {
           // Make sure the we are initialized.
           if (isInitialized == false)
  +        {
               initialize();
  -
  +        }
           return (String) jdbcToVillageMethodMap.get(jdbcType);
       }
   
  @@ -558,8 +559,9 @@
       {
           // Make sure the we are initialized.
           if (isInitialized == false)
  +        {
               initialize();
  -
  +        }
           String s = (String)jdbcToVillageObjectMethodMap.get(jdbcType);
           if ( s == null ) 
           {
  @@ -576,8 +578,9 @@
       {
           // Make sure the we are initialized.
           if (isInitialized == false)
  +        {
               initialize();
  -
  +        }
           return (String) jdbcToPPMethodMap.get(jdbcType);
       }
   
  @@ -588,8 +591,9 @@
       {
           // Make sure the we are initialized.
           if (isInitialized == false)
  +        {
               initialize();
  -
  +        }
           return (String) torqueTypeToJdbcTypeMap.get(type);
       }
   
  @@ -601,9 +605,10 @@
       {
           // Make sure the we are initialized.
           if (isInitialized == false)
  +        {
               initialize();
  -
  -        return (String)jdbcToTorqueTypeMap.get(sqlType);
  +        }
  +        return (String) jdbcToTorqueTypeMap.get(sqlType);
       }
   
       /**
  
  
  
  1.13      +13 -28    
jakarta-turbine-torque/src/java/org/apache/torque/engine/database/transform/XmlToAppData.java
  
  Index: XmlToAppData.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/engine/database/transform/XmlToAppData.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- XmlToAppData.java 6 Mar 2002 02:59:07 -0000       1.12
  +++ XmlToAppData.java 11 Apr 2002 22:02:06 -0000      1.13
  @@ -56,8 +56,6 @@
   
   import java.io.BufferedReader;
   import java.io.FileReader;
  -import java.io.PrintStream;
  -import java.io.Reader;
   import java.io.FileNotFoundException;
   import java.io.File;
   import java.util.List;
  @@ -67,40 +65,31 @@
   import org.apache.torque.engine.database.model.Column;
   import org.apache.torque.engine.database.model.Database;
   import org.apache.torque.engine.database.model.ForeignKey;
  -import org.apache.torque.engine.database.model.IdMethodParameter;
   import org.apache.torque.engine.database.model.Index;
  -import org.apache.torque.engine.database.model.Inheritance;
   import org.apache.torque.engine.database.model.Table;
   import org.apache.torque.engine.database.model.Unique;
   
  -import javax.xml.parsers.ParserConfigurationException;
   import javax.xml.parsers.SAXParser;
   import javax.xml.parsers.SAXParserFactory;
   
   import org.xml.sax.Attributes;
  -import org.xml.sax.ContentHandler;
  -import org.xml.sax.EntityResolver;
  -import org.xml.sax.ErrorHandler;
   import org.xml.sax.InputSource;
  -import org.xml.sax.SAXException;
  -import org.xml.sax.SAXNotRecognizedException;
  -import org.xml.sax.SAXNotSupportedException;
   import org.xml.sax.SAXParseException;
   import org.xml.sax.helpers.DefaultHandler;
   
   /**
  - * A Class that is used to parse an input
  - * xml schema file and creates and AppData java structure.
  - * It uses apache Xerces to do the xml parsing.
  + * A Class that is used to parse an input xml schema file and creates an AppData
  + * java structure.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Leon Messerschmidt</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Martin Poeschl</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Daniel Rall</a>
  - * @version $Id: XmlToAppData.java,v 1.12 2002/03/06 02:59:07 jmcnally Exp $
  + * @version $Id: XmlToAppData.java,v 1.13 2002/04/11 22:02:06 mpoeschl Exp $
    */
   public class XmlToAppData extends DefaultHandler
   {
  +    /** enables debug output */
       private static final boolean DEBUG = false;
   
       private AppData app;
  @@ -153,17 +142,17 @@
               FileReader fr = null;
               try
               {
  -                fr = new FileReader (xmlFile);
  +                fr = new FileReader(xmlFile);
               }
               catch (FileNotFoundException fnfe)
               {
                   throw new FileNotFoundException
                       (new File(xmlFile).getAbsolutePath());
               }
  -            BufferedReader br = new BufferedReader (fr);
  +            BufferedReader br = new BufferedReader(fr);
               try
               {
  -                InputSource is = new InputSource (br);
  +                InputSource is = new InputSource(br);
                   parser.parse(is, this);
               }
               finally
  @@ -241,10 +230,9 @@
                   }
                   else if (rawName.equals("foreign-key"))
                   {
  -                    String foreignTableName =
  -                        attributes.getValue("foreignTable");
  -                    foreignTable = currDB
  -                        .getTable(foreignTableName);
  +                    String foreignTableName = 
  +                            attributes.getValue("foreignTable");
  +                    foreignTable = currDB.getTable(foreignTableName);
                       if ( foreignTable == null )
                       {
                           System.out.println("ERROR!! Attempt to set foreign"
  @@ -378,8 +366,7 @@
       /**
        * Warning callback.
        *
  -     * @exception spe The parse exception that caused the callback to be
  -     *                invoked.
  +     * @param spe The parse exception that caused the callback to be invoked.
        */
       public void warning(SAXParseException spe)
       {
  @@ -389,8 +376,7 @@
       /**
        * Error callback.
        *
  -     * @exception spe The parse exception that caused the callback to be
  -     *                invoked.
  +     * @param spe The parse exception that caused the callback to be invoked.
        */
       public void error(SAXParseException spe)
       {
  @@ -400,8 +386,7 @@
       /**
        * Fatal error callback.
        *
  -     * @exception spe The parse exception that caused the callback to be
  -     *                invoked.
  +     * @param spe The parse exception that caused the callback to be invoked.
        */
       public void fatalError(SAXParseException spe)
       {
  
  
  
  1.6       +5 -8      
jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueCreateDatabase.java
  
  Index: TorqueCreateDatabase.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueCreateDatabase.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TorqueCreateDatabase.java 14 Mar 2002 20:06:44 -0000      1.5
  +++ TorqueCreateDatabase.java 11 Apr 2002 22:02:06 -0000      1.6
  @@ -55,17 +55,15 @@
    */
   
   import org.apache.velocity.context.Context;
  -import org.apache.velocity.VelocityContext;
   
   /**
    * An extended Texen task used for generating simple scripts
    * for creating databases on various platforms.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
  - * @version $Id: TorqueCreateDatabase.java,v 1.5 2002/03/14 20:06:44 jvanzyl Exp $
  + * @version $Id: TorqueCreateDatabase.java,v 1.6 2002/04/11 22:02:06 mpoeschl Exp $
    */
  -public class TorqueCreateDatabase 
  -    extends TorqueDataModelTask
  +public class TorqueCreateDatabase extends TorqueDataModelTask
   {
       /**
        * The target database vendor: MySQL, Oracle.
  @@ -77,7 +75,7 @@
        *
        * @return String target database.
        */
  -    public String getTargetDatabase ()
  +    public String getTargetDatabase()
       {
           return targetDatabase;
       }
  @@ -87,7 +85,7 @@
        *
        * @param String target database(s)
        */
  -    public void setTargetDatabase (String v)
  +    public void setTargetDatabase(String v)
       {
           targetDatabase = v;
       }
  @@ -97,8 +95,7 @@
        * values into the context for use in the
        * templates.
        */
  -    public Context initControlContext()
  -        throws Exception
  +    public Context initControlContext() throws Exception
       {   
           super.initControlContext();
           context.put("targetDatabase", targetDatabase);
  
  
  
  1.7       +14 -30    
jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueDataDumpTask.java
  
  Index: TorqueDataDumpTask.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueDataDumpTask.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TorqueDataDumpTask.java   14 Dec 2001 22:14:06 -0000      1.6
  +++ TorqueDataDumpTask.java   11 Apr 2002 22:02:06 -0000      1.7
  @@ -54,36 +54,27 @@
    * <http://www.apache.org/>.
    */
   
  -import java.util.Date;
   import java.util.Iterator;
  -import java.util.Properties;
   import java.util.NoSuchElementException;
   import java.sql.Connection;
  -import java.sql.ResultSet;
   import java.sql.DriverManager;
   import java.sql.SQLException;
   import java.sql.Statement;
   import org.apache.tools.ant.Project;
   import org.apache.velocity.context.Context;
  -import org.apache.velocity.VelocityContext;
  -import org.apache.velocity.texen.ant.TexenTask;
  -import org.apache.torque.engine.database.model.AppData;
  -import org.apache.torque.engine.database.model.Database;
  -import org.apache.torque.engine.database.transform.XmlToAppData;
   
   import com.workingdogs.village.QueryDataSet;
   import com.workingdogs.village.Record;
   
   /**
  - *  An extended Texen task used for dumping data from db into XML
  + * An extended Texen task used for dumping data from db into XML
    *
  - * @author <a href="mailto:[EMAIL PROTECTED]";>  Fedor Karpelevitch  </a>
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Fedor Karpelevitch</a>
    * @author <a href="[EMAIL PROTECTED]">Jason van Zyl</a>
    * @author <a href="[EMAIL PROTECTED]">Daniel Rall</a>
  - * @version $Id: TorqueDataDumpTask.java,v 1.6 2001/12/14 22:14:06 brekke Exp $
  + * @version $Id: TorqueDataDumpTask.java,v 1.7 2002/04/11 22:02:06 mpoeschl Exp $
    */
  -public class TorqueDataDumpTask
  -    extends TorqueDataModelTask
  +public class TorqueDataDumpTask extends TorqueDataModelTask
   {
       /**
        * Database name.
  @@ -270,8 +261,7 @@
        *
        * @exception Exception Database problem while closing resource.
        */
  -    protected void cleanup()
  -        throws Exception
  +    protected void cleanup() throws Exception
       {
           if (stmt != null)
           {
  @@ -308,7 +298,6 @@
           {
           }
   
  -
           /**
            *  Constructor for the TableTool object
            *
  @@ -323,7 +312,6 @@
               this.isEmpty = !(qds.size() > 0);
           }
   
  -
           /**
            *  Fetches an <code>Iterator</code> for the data in the named
            *  table.
  @@ -342,7 +330,6 @@
                   (new QueryDataSet(conn, "SELECT * FROM " + tableName));
           }
   
  -
           /**
            *  Description of the Method
            *
  @@ -352,7 +339,7 @@
           {
               try
               {
  -                return ((this.curIndex < this.qds.size()-1) && (!isEmpty));
  +                return ((this.curIndex < this.qds.size() - 1) && (!isEmpty));
               }
               catch (Exception se)
               {
  @@ -362,12 +349,11 @@
               return false;
           }
   
  -
           /**
  -         *  Description of the Method
  +         * load the next record from the QueryDataSet
            *
  -         * @return  Description of the Returned Value
  -         * @exception  NoSuchElementException Description of Exception
  +         * @return Description of the Returned Value
  +         * @exception NoSuchElementException Description of Exception
            */
           public Object next() throws NoSuchElementException
           {
  @@ -385,12 +371,11 @@
               return this;
           }
   
  -
           /**
  -         *  Description of the Method
  +         * Retruns the value for the column
            *
  -         * @param  columnName Description of Parameter
  -         * @return  Description of the Returned Value
  +         * @param  columnName name of the column
  +         * @return  value of the column or null if it doesn't exist
            */
           public String get(String columnName)
           {
  @@ -406,11 +391,10 @@
               return null;
           }
   
  -
           /**
  -         *  Description of the Method
  +         * unsupported! always throws Exception
            *
  -         * @exception  UnsupportedOperationException Description of Exception
  +         * @exception UnsupportedOperationException
            */
           public void remove() throws UnsupportedOperationException
           {
  
  
  
  1.11      +8 -12     
jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueDataModelTask.java
  
  Index: TorqueDataModelTask.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueDataModelTask.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- TorqueDataModelTask.java  6 Mar 2002 02:59:08 -0000       1.10
  +++ TorqueDataModelTask.java  11 Apr 2002 22:02:06 -0000      1.11
  @@ -146,7 +146,7 @@
       /**
        * Set the sqldbmap.
        *
  -     * @param String sqldbmap
  +     * @param sqldbmap th db map 
        */
       public void setSqlDbMap(String sqldbmap)
       {
  @@ -186,8 +186,7 @@
       }        
   
       /**
  -     *  Get the xml schema describing the application
  -     *  model.
  +     * Get the xml schema describing the application model.
        *
        * @return  String xml schema file.
        */
  @@ -197,8 +196,7 @@
       }
   
       /**
  -     *  Set the xml schema describing the application
  -     *  model.
  +     * Set the xml schema describing the application model.
        *
        * @param xmlFile The new XmlFile value
        */
  @@ -220,7 +218,7 @@
        *
        * @return String target database(s)
        */
  -    public String getTargetDatabase ()
  +    public String getTargetDatabase()
       {
           return targetDatabase;
       }
  @@ -229,9 +227,9 @@
        * Set the current target package.  This is where
        * generated java classes will live.
        *
  -     * @param String target database(s)
  +     * @param v target database(s)
        */
  -    public void setTargetDatabase (String v)
  +    public void setTargetDatabase(String v)
       {
           targetDatabase = v;
       }
  @@ -257,13 +255,11 @@
       }
       
       /**
  -     *  Set up the initialial context for generating the
  -     *  SQL from the XML schema.
  +     * Set up the initialial context for generating the SQL from the XML schema.
        *
        * @return  Description of the Returned Value
        */
  -    public Context initControlContext()
  -        throws Exception
  +    public Context initControlContext() throws Exception
       {
           XmlToAppData xmlParser;
       
  
  
  
  1.8       +2 -4      
jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueDataSQLTask.java
  
  Index: TorqueDataSQLTask.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueDataSQLTask.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TorqueDataSQLTask.java    16 Feb 2002 17:06:53 -0000      1.7
  +++ TorqueDataSQLTask.java    11 Apr 2002 22:02:06 -0000      1.8
  @@ -59,7 +59,6 @@
   import java.util.List;
   import java.util.Properties;
   import org.apache.velocity.context.Context;
  -import org.apache.velocity.VelocityContext;
   import org.apache.torque.engine.database.model.AppData;
   import org.apache.torque.engine.database.model.Database;
   import org.apache.torque.engine.database.transform.XmlToData;
  @@ -70,10 +69,9 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";> Jason van Zyl </a>
    * @author <a href="mailto:[EMAIL PROTECTED]";> John McNally </a>
    * @author <a href="mailto:[EMAIL PROTECTED]";> Fedor Karpelevitch </a>
  - * @version $Id: TorqueDataSQLTask.java,v 1.7 2002/02/16 17:06:53 mpoeschl Exp $
  + * @version $Id: TorqueDataSQLTask.java,v 1.8 2002/04/11 22:02:06 mpoeschl Exp $
    */
  -public class TorqueDataSQLTask
  -    extends TorqueDataModelTask
  +public class TorqueDataSQLTask extends TorqueDataModelTask
   {
       private String dataXmlFile;
       private String dataDTD;
  
  
  
  1.2       +3 -6      
jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueDocumentationTask.java
  
  Index: TorqueDocumentationTask.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueDocumentationTask.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TorqueDocumentationTask.java      18 Dec 2001 21:47:53 -0000      1.1
  +++ TorqueDocumentationTask.java      11 Apr 2002 22:02:06 -0000      1.2
  @@ -55,13 +55,12 @@
    */
   
   import org.apache.velocity.context.Context;
  -import org.apache.velocity.VelocityContext;
   
   /**
    * An ant task for generating output by using Velocity
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Martin Poeschl</a>
  - * @version $Id: TorqueDocumentationTask.java,v 1.1 2001/12/18 21:47:53 mpoeschl 
Exp $
  + * @version $Id: TorqueDocumentationTask.java,v 1.2 2002/04/11 22:02:06 mpoeschl 
Exp $
    */
   public class TorqueDocumentationTask extends TorqueDataModelTask
   {
  @@ -119,11 +118,9 @@
       }
   
       /**
  -     * Place our target package value
  -     * into the context for use in the templates.
  +     * Place our target package value into the context for use in the templates.
        */
  -    public Context initControlContext()
  -        throws Exception
  +    public Context initControlContext() throws Exception
       {
           super.initControlContext();
           context.put("targetDatabase", targetDatabase);
  
  
  
  1.7       +3 -11     
jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueJDBCTransformTask.java
  
  Index: TorqueJDBCTransformTask.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueJDBCTransformTask.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TorqueJDBCTransformTask.java      8 Nov 2001 11:38:47 -0000       1.6
  +++ TorqueJDBCTransformTask.java      11 Apr 2002 22:02:06 -0000      1.7
  @@ -55,10 +55,7 @@
    */
   
   import java.io.FileOutputStream;
  -import java.io.OutputStream;
  -import java.io.PrintStream;
   import java.io.PrintWriter;
  -import java.io.Writer;
   import java.sql.Connection;
   import java.sql.DatabaseMetaData;
   import java.sql.DriverManager;
  @@ -67,7 +64,6 @@
   import java.sql.SQLException;
   import java.util.Hashtable;
   import java.util.List;
  -import java.util.Properties;
   import java.util.Vector;
   import java.util.Collection;
   import java.util.Iterator;
  @@ -76,13 +72,9 @@
   import org.apache.tools.ant.Task;
   import org.apache.xerces.dom.DocumentImpl;
   import org.apache.xerces.dom.DocumentTypeImpl;
  -import org.apache.xerces.dom.NodeImpl;
  -import org.apache.xml.serialize.BaseMarkupSerializer;
   import org.apache.xml.serialize.OutputFormat;
   import org.apache.xml.serialize.Method;
   import org.apache.xml.serialize.XMLSerializer;
  -import org.w3c.dom.Comment;
  -import org.w3c.dom.Document;
   import org.w3c.dom.Element;
   import org.w3c.dom.Node;
   
  @@ -92,7 +84,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Fedor Karpelevitch</a>
  - * @version $Id: TorqueJDBCTransformTask.java,v 1.6 2001/11/08 11:38:47 mpoeschl 
Exp $
  + * @version $Id: TorqueJDBCTransformTask.java,v 1.7 2002/04/11 22:02:06 mpoeschl 
Exp $
    */
   public class TorqueJDBCTransformTask extends Task
   {
  @@ -187,7 +179,7 @@
           System.err.println("password : " + dbPassword);
           System.err.println("schema : " + dbSchema);
   
  -        DocumentTypeImpl docType= new DocumentTypeImpl(null,"app-data", null,
  +        DocumentTypeImpl docType= new DocumentTypeImpl(null, "app-data", null,
               "http://jakarta.apache.org/turbine/dtd/database.dtd";);
           doc = new DocumentImpl(docType);
           doc.appendChild(doc.createComment(" Autogenerated by JDBCToXMLSchema! "));
  @@ -198,7 +190,7 @@
               xmlSerializer = new XMLSerializer(
                   new PrintWriter(
                   new FileOutputStream(xmlSchema)),
  -                new OutputFormat(Method.XML,null,true));
  +                new OutputFormat(Method.XML, null, true));
               xmlSerializer.serialize(doc);
           }
           catch (Exception e)
  
  
  
  1.6       +56 -36    
jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueSQLExec.java
  
  Index: TorqueSQLExec.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/task/TorqueSQLExec.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TorqueSQLExec.java        1 Mar 2002 22:37:07 -0000       1.5
  +++ TorqueSQLExec.java        11 Apr 2002 22:02:07 -0000      1.6
  @@ -69,11 +69,9 @@
   import java.util.Iterator;
   import java.util.Enumeration;
   import java.util.Hashtable;
  -import java.util.StringTokenizer;
   import java.util.Vector;
   import java.util.Properties;
   import java.util.TreeSet;
  -import java.util.Iterator;
   import java.sql.Connection;
   import java.sql.DatabaseMetaData;
   import java.sql.Driver;
  @@ -101,11 +99,18 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Tim Stephenson</A>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</A>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Martin Poeschl</a>
  - * @version $Id: TorqueSQLExec.java,v 1.5 2002/03/01 22:37:07 dlr Exp $
  + * @version $Id: TorqueSQLExec.java,v 1.6 2002/04/11 22:02:07 mpoeschl Exp $
    */
   public class TorqueSQLExec extends Task
   {
  +    private int goodSql = 0;
  +    private int totalSql = 0;
  +    private Path classpath;
  +    private AntClassLoader loader;
   
  +    /**
  +     * 
  +     */
       static public class DelimiterType extends EnumeratedAttribute
       {
           static public final String NORMAL = "normal";
  @@ -117,10 +122,6 @@
           }
       }
   
  -    private int goodSql = 0, totalSql = 0;
  -    private Path classpath;
  -    private AntClassLoader loader;
  -
       /**
        * Database connection
        */
  @@ -423,8 +424,7 @@
       /**
        * Load the sql file and then execute it
        */
  -    public void execute()
  -        throws BuildException
  +    public void execute() throws BuildException
       {
           sqlCommand = sqlCommand.trim();
   
  @@ -540,17 +540,17 @@
               }
               driverInstance = (Driver) dc.newInstance();
           }
  -        catch(ClassNotFoundException e)
  +        catch (ClassNotFoundException e)
           {
               throw new BuildException("Class Not Found: JDBC driver " + driver +
                   " could not be loaded", location);
           }
  -        catch(IllegalAccessException e)
  +        catch (IllegalAccessException e)
           {
               throw new BuildException("Illegal Access: JDBC driver " + driver +
                   " could not be loaded", location);
           }
  -        catch(InstantiationException e)
  +        catch (InstantiationException e)
           {
               throw new BuildException("Instantiation Exception: JDBC driver " +
                   driver + " could not be loaded", location);
  @@ -567,10 +567,13 @@
               if (conn == null)
               {
                   // Driver doesn't understand the URL
  -                throw new SQLException("No suitable Driver for "+url);
  +                throw new SQLException("No suitable Driver for " + url);
               }
   
  -            if (!isValidRdbms(conn)) return;
  +            if (!isValidRdbms(conn)) 
  +            {
  +                return;
  +            }
   
               conn.setAutoCommit(autocommit);
               statement = conn.createStatement();
  @@ -579,12 +582,15 @@
               {
                   if (output != null)
                   {
  -                    log("Opening PrintStream to output file " + output, 
Project.MSG_VERBOSE);
  -                    out = new PrintStream(new BufferedOutputStream(new 
FileOutputStream(output)));
  +                    log("Opening PrintStream to output file " + output, 
  +                            Project.MSG_VERBOSE);
  +                    out = new PrintStream(new BufferedOutputStream(
  +                            new FileOutputStream(output)));
                   }
   
                   // Process all transactions
  -                for (Enumeration e = transactions.elements(); e.hasMoreElements();)
  +                for (Enumeration e = transactions.elements(); 
  +                        e.hasMoreElements();)
                   {
                       ((Transaction) e.nextElement()).runTransaction(out);
                       if (!autocommit)
  @@ -602,7 +608,7 @@
                   }
               }
           }
  -        catch(IOException e)
  +        catch (IOException e)
           {
               if (!autocommit && conn != null && onError.equals("abort"))
               {
  @@ -617,7 +623,7 @@
               }
               throw new BuildException(e, location);
           }
  -        catch(SQLException e)
  +        catch (SQLException e)
           {
               if (!autocommit && conn != null && onError.equals("abort"))
               {
  @@ -652,8 +658,15 @@
               " SQL statements executed successfully");
       }
   
  +    /**
  +     * 
  +     * @param reader
  +     * @param out
  +     * @throws SQLException
  +     * @throws IOException
  +     */
       protected void runStatements(Reader reader, PrintStream out)
  -        throws SQLException, IOException
  +            throws SQLException, IOException
       {
           String sql = "";
           String line = "";
  @@ -662,7 +675,7 @@
   
           try
           {
  -            while ((line=in.readLine()) != null)
  +            while ((line = in.readLine()) != null)
               {
                   line = line.trim();
                   line = ProjectHelper.replaceProperties(project, line,
  @@ -680,21 +693,25 @@
                   // so we cannot just remove it, instead we must end it
                   if (line.indexOf("--") >= 0) sql += "\n";
   
  -                if (delimiterType.equals(DelimiterType.NORMAL) && 
sql.endsWith(delimiter) ||
  -                    delimiterType.equals(DelimiterType.ROW) && 
line.equals(delimiter)) {
  +                if (delimiterType.equals(DelimiterType.NORMAL) 
  +                        && sql.endsWith(delimiter) 
  +                        || delimiterType.equals(DelimiterType.ROW) 
  +                        && line.equals(delimiter)) 
  +                {
                       log("SQL: " + sql, Project.MSG_VERBOSE);
  -                    execSQL(sql.substring(0, sql.length() - delimiter.length()), 
out);
  +                    execSQL(sql.substring(0, sql.length() - delimiter.length()),
  +                            out);
                       sql = "";
                   }
               }
   
               // Catch any statements not followed by ;
  -            if(!sql.equals(""))
  +            if (!sql.equals(""))
               {
                   execSQL(sql, out);
               }
           }
  -        catch(SQLException e)
  +        catch (SQLException e)
           {
               throw e;
           }
  @@ -702,7 +719,7 @@
   
       /**
        * Verify if connected to the correct RDBMS
  -     **/
  +     */
       protected boolean isValidRdbms(Connection conn)
       {
           if (rdbms == null && version == null)
  @@ -721,21 +738,23 @@
                   log("RDBMS = " + theVendor, Project.MSG_VERBOSE);
                   if (theVendor == null || theVendor.indexOf(rdbms) < 0)
                   {
  -                    log("Not the required RDBMS: "+rdbms, Project.MSG_VERBOSE);
  +                    log("Not the required RDBMS: " 
  +                            + rdbms, Project.MSG_VERBOSE);
                       return false;
                   }
               }
   
               if (version != null)
               {
  -                String theVersion = dmd.getDatabaseProductVersion().toLowerCase();
  +                String theVersion = dmd.getDatabaseProductVersion()
  +                        .toLowerCase();
   
                   log("Version = " + theVersion, Project.MSG_VERBOSE);
  -                if (theVersion == null ||
  -                    !(theVersion.startsWith(version) ||
  -                      theVersion.indexOf(" " + version) >= 0))
  +                if (theVersion == null || !(theVersion.startsWith(version) 
  +                        || theVersion.indexOf(" " + version) >= 0))
                   {
  -                    log("Not the required version: \""+ version +"\"", 
Project.MSG_VERBOSE);
  +                    log("Not the required version: \"" + version + "\"", 
  +                            Project.MSG_VERBOSE);
                       return false;
                   }
               }
  @@ -764,7 +783,7 @@
               if (!statement.execute(sql))
               {
                   log(statement.getUpdateCount() + " rows affected",
  -                    Project.MSG_VERBOSE);
  +                        Project.MSG_VERBOSE);
               }
               else
               {
  @@ -778,7 +797,7 @@
               while (warning != null)
               {
                   log(warning + " sql warning", Project.MSG_VERBOSE);
  -                warning=warning.getNextWarning();
  +                warning = warning.getNextWarning();
               }
               conn.clearWarnings();
               goodSql++;
  @@ -897,7 +916,8 @@
                   log("Executing file: " + tSrcFile.getAbsolutePath(),
                       Project.MSG_INFO);
                   Reader reader = (encoding == null) ? new FileReader(tSrcFile)
  -                                                   : new InputStreamReader(new 
FileInputStream(tSrcFile), encoding);
  +                        : new InputStreamReader(new FileInputStream(tSrcFile), 
  +                        encoding);
                   runStatements(reader, out);
                   reader.close();
               }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to