db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpoes...@apache.org
Subject cvs commit: db-torque/src/generator/src/java/org/apache/torque/task TorqueDataDumpTask.java
Date Tue, 18 Feb 2003 08:05:51 GMT
mpoeschl    2003/02/18 00:05:51

  Modified:    src/generator/src/java/org/apache/torque/engine/database/model
                        ForeignKey.java IdMethodParameter.java
                        NameFactory.java
               src/generator/src/java/org/apache/torque/engine/database/transform
                        DTDResolver.java SQLToAppData.java
               src/generator/src/java/org/apache/torque/engine/sql
                        ParseException.java SQLScanner.java Token.java
               src/generator/src/java/org/apache/torque/task
                        TorqueDataDumpTask.java
  Log:
  cleanup (no functional changes)
  
  Revision  Changes    Path
  1.2       +3 -3      db-torque/src/generator/src/java/org/apache/torque/engine/database/model/ForeignKey.java
  
  Index: ForeignKey.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/java/org/apache/torque/engine/database/model/ForeignKey.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ForeignKey.java	10 Feb 2003 13:20:58 -0000	1.1
  +++ ForeignKey.java	18 Feb 2003 08:05:49 -0000	1.2
  @@ -77,8 +77,8 @@
       private List foreignColumns = new ArrayList(3);
   
       // the uppercase equivalent of the onDelete/onUpdate values in the dtd
  -    private final String NONE    = "NONE";
  -    private final String SETNULL = "SETNULL";
  +    private static final String NONE    = "NONE";
  +    private static final String SETNULL = "SETNULL";
   
       /**
        * Imports foreign key from an XML specification
  
  
  
  1.2       +6 -6      db-torque/src/generator/src/java/org/apache/torque/engine/database/model/IdMethodParameter.java
  
  Index: IdMethodParameter.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/java/org/apache/torque/engine/database/model/IdMethodParameter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- IdMethodParameter.java	10 Feb 2003 13:20:58 -0000	1.1
  +++ IdMethodParameter.java	18 Feb 2003 08:05:50 -0000	1.2
  @@ -25,13 +25,13 @@
    *    Alternately, this acknowledgment may appear in the software itself,
    *    if and wherever such third-party acknowledgments normally appear.
    *
  - * 4. The names "Apache" and "Apache Software Foundation" and 
  - *    "Apache Turbine" must not be used to endorse or promote products 
  - *    derived from this software without prior written permission. For 
  + * 4. The names "Apache" and "Apache Software Foundation" and
  + *    "Apache Turbine" must not be used to endorse or promote products
  + *    derived from this software without prior written permission. For
    *    written permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  - *    "Apache Turbine", nor may "Apache" appear in their name, without 
  + *    "Apache Turbine", nor may "Apache" appear in their name, without
    *    prior written permission of the Apache Software Foundation.
    *
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  @@ -146,7 +146,7 @@
               result.append(" name=\"")
                     .append(getName())
                     .append("\"");
  -        } 
  +        }
           result.append(" value=\"")
                 .append(getValue())
                 .append("\">\n");
  
  
  
  1.2       +2 -2      db-torque/src/generator/src/java/org/apache/torque/engine/database/model/NameFactory.java
  
  Index: NameFactory.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/java/org/apache/torque/engine/database/model/NameFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NameFactory.java	10 Feb 2003 13:20:58 -0000	1.1
  +++ NameFactory.java	18 Feb 2003 08:05:50 -0000	1.2
  @@ -141,7 +141,7 @@
        * implementation to use to generate names.
        * @param inputs Inputs used to generate a name.
        * @return The generated name.
  -     * @throws EngineException
  +     * @throws EngineException an exception
        */
       public static String generateName(String algorithmName, List inputs)
           throws EngineException
  
  
  
  1.2       +2 -2      db-torque/src/generator/src/java/org/apache/torque/engine/database/transform/DTDResolver.java
  
  Index: DTDResolver.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/java/org/apache/torque/engine/database/transform/DTDResolver.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DTDResolver.java	10 Feb 2003 13:20:59 -0000	1.1
  +++ DTDResolver.java	18 Feb 2003 08:05:50 -0000	1.2
  @@ -107,7 +107,7 @@
           }
           catch (Exception ex)
           {
  -            log.error("Could not get stream for database.dtd", ex );
  +            log.error("Could not get stream for database.dtd", ex);
           }
       }
   
  
  
  
  1.2       +37 -15    db-torque/src/generator/src/java/org/apache/torque/engine/database/transform/SQLToAppData.java
  
  Index: SQLToAppData.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/java/org/apache/torque/engine/database/transform/SQLToAppData.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SQLToAppData.java	10 Feb 2003 13:20:59 -0000	1.1
  +++ SQLToAppData.java	18 Feb 2003 08:05:50 -0000	1.2
  @@ -119,6 +119,8 @@
   
       /**
        * Get the current input sql file
  +     *
  +     * @return the sql file
        */
       public String getSqlFile()
       {
  @@ -169,6 +171,8 @@
   
       /**
        * Check if there is more tokens available for parsing.
  +     *
  +     * @return true if there are more tokens available
        */
       private boolean hasTokens()
       {
  @@ -180,19 +184,21 @@
        *
        * @throws ParseException
        */
  -    private void Create() throws ParseException
  +    private void create() throws ParseException
       {
           next();
           if (token.getStr().toUpperCase().equals("TABLE"))
           {
  -            Create_Table();
  +            create_Table();
           }
       }
   
       /**
        * Parses a CREATE TABLE sql command
  +     *
  +     * @throws ParseException error parsing the input file
        */
  -    private void Create_Table() throws ParseException
  +    private void create_Table() throws ParseException
       {
           next();
           String tableName = token.getStr(); // name of the table
  @@ -207,7 +213,7 @@
           //tbl.setIdMethod("none");
           while (!token.getStr().equals(";"))
           {
  -            Create_Table_Column(tbl);
  +            create_Table_Column(tbl);
           }
   
           if (tbl.getPrimaryKey().size() == 1)
  @@ -224,8 +230,10 @@
       /**
        * Parses column information between the braces of a CREATE
        * TABLE () sql statement.
  +     *
  +     * @throws ParseException error parsing the input file
        */
  -    private void Create_Table_Column(Table tbl) throws ParseException
  +    private void create_Table_Column(Table tbl) throws ParseException
       {
           // The token should be the first item
           // which is the name of the column or
  @@ -237,26 +245,28 @@
   
           if (token.getStr().toUpperCase().equals("PRIMARY"))
           {
  -            Create_Table_Column_Primary(tbl);
  +            create_Table_Column_Primary(tbl);
           }
           else if (token.getStr().toUpperCase().equals("FOREIGN"))
           {
  -            Create_Table_Column_Foreign(tbl);
  +            create_Table_Column_Foreign(tbl);
           }
           else if (token.getStr().toUpperCase().equals("UNIQUE"))
           {
  -            Create_Table_Column_Unique(tbl);
  +            create_Table_Column_Unique(tbl);
           }
           else
           {
  -            Create_Table_Column_Data(tbl);
  +            create_Table_Column_Data(tbl);
           }
       }
   
       /**
        * Parses PRIMARY KEY (FOO,BAR) statement
  +     *
  +     * @throws ParseException error parsing the input file
        */
  -    private void Create_Table_Column_Primary (Table tbl) throws ParseException
  +    private void create_Table_Column_Primary (Table tbl) throws ParseException
       {
           next();
           if (!token.getStr().toUpperCase().equals("KEY"))
  @@ -300,8 +310,10 @@
   
       /**
        * Parses UNIQUE (NAME,FOO,BAR) statement
  +     *
  +     * @throws ParseException error parsing the input file
        */
  -    private void Create_Table_Column_Unique(Table tbl) throws ParseException
  +    private void create_Table_Column_Unique(Table tbl) throws ParseException
       {
           next();
           if (!token.getStr().toUpperCase().equals("("))
  @@ -333,8 +345,10 @@
   
       /**
        * Parses FOREIGN KEY (BAR) REFERENCES TABLE (BAR) statement
  +     *
  +     * @throws ParseException error parsing the input file
        */
  -    private void Create_Table_Column_Foreign (Table tbl) throws ParseException
  +    private void create_Table_Column_Foreign(Table tbl) throws ParseException
       {
           next();
           if (!token.getStr().toUpperCase().equals("KEY"))
  @@ -402,8 +416,10 @@
   
       /**
        * Parse the data definition of the column statement.
  +     *
  +     * @throws ParseException error parsing the input file
        */
  -    private void Create_Table_Column_Data(Table tbl) throws ParseException
  +    private void create_Table_Column_Data(Table tbl) throws ParseException
       {
           String columnSize = null;
           String columnPrecision = null;
  @@ -549,6 +565,9 @@
   
       /**
        * Execute the parser.
  +     *
  +     * @throws IOException If an I/O error occurs
  +     * @throws ParseException error parsing the input file
        */
       public AppData execute() throws IOException, ParseException
       {
  @@ -574,7 +593,7 @@
   
               if (token.getStr().toUpperCase().equals("CREATE"))
               {
  -                Create();
  +                create();
               }
               if (hasTokens())
               {
  @@ -586,6 +605,9 @@
   
       /**
        * Just 4 testing.
  +     *
  +     * @param args commandline args
  +     * @throws Exception an exception
        */
       public static void main(String args[]) throws Exception
       {
  
  
  
  1.2       +12 -8     db-torque/src/generator/src/java/org/apache/torque/engine/sql/ParseException.java
  
  Index: ParseException.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/java/org/apache/torque/engine/sql/ParseException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ParseException.java	10 Feb 2003 13:20:59 -0000	1.1
  +++ ParseException.java	18 Feb 2003 08:05:50 -0000	1.2
  @@ -25,13 +25,13 @@
    *    Alternately, this acknowledgment may appear in the software itself,
    *    if and wherever such third-party acknowledgments normally appear.
    *
  - * 4. The names "Apache" and "Apache Software Foundation" and 
  - *    "Apache Turbine" must not be used to endorse or promote products 
  - *    derived from this software without prior written permission. For 
  + * 4. The names "Apache" and "Apache Software Foundation" and
  + *    "Apache Turbine" must not be used to endorse or promote products
  + *    derived from this software without prior written permission. For
    *    written permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  - *    "Apache Turbine", nor may "Apache" appear in their name, without 
  + *    "Apache Turbine", nor may "Apache" appear in their name, without
    *    prior written permission of the Apache Software Foundation.
    *
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  @@ -63,9 +63,13 @@
    */
   public class ParseException extends Exception
   {
  -    public ParseException (String err)
  +    /**
  +     * constructor.
  +     *
  +     * @param err error message
  +     */
  +    public ParseException(String err)
       {
  -        super (err);
  +        super(err);
       }
  -
   }
  
  
  
  1.2       +53 -27    db-torque/src/generator/src/java/org/apache/torque/engine/sql/SQLScanner.java
  
  Index: SQLScanner.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/java/org/apache/torque/engine/sql/SQLScanner.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SQLScanner.java	10 Feb 2003 13:20:59 -0000	1.1
  +++ SQLScanner.java	18 Feb 2003 08:05:50 -0000	1.2
  @@ -70,22 +70,37 @@
    */
   public class SQLScanner
   {
  -    private static final String white = "\f\r\t\n ";
  -    private static final String alfa = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  -    private static final String numer = "0123456789";
  -    private static final String alfanum = alfa + numer;
  -    private static final String special = ";(),'";
  -    private static final char commentPound = '#';
  -    private static final char commentSlash = '/';
  -    private static final char commentStar = '*';
  -    private static final char commentDash = '-';
  +    /** white spaces */
  +    private static final String WHITE = "\f\r\t\n ";
  +    /** alphabetic characters */
  +    private static final String ALFA
  +            = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  +    /** numbers */
  +    private static final String NUMER = "0123456789";
  +    /** alphanumeric */
  +    private static final String ALFANUM = ALFA + NUMER;
  +    /** special characters */
  +    private static final String SPECIAL = ";(),'";
  +    /** comment */
  +    private static final char COMMENT_POUND = '#';
  +    /** comment */
  +    private static final char COMMENT_SLASH = '/';
  +    /** comment */
  +    private static final char COMMENT_STAR = '*';
  +    /** comment */
  +    private static final char COMMENT_DASH = '-';
   
  +    /** the input reader */
       private Reader in;
  +    /** character */
       private int chr;
  +    /** token */
       private String token;
  +    /** list of tokens */
       private List tokens;
  -
  +    /** line */
       private int line;
  +    /** column */
       private int col;
   
       /**
  @@ -98,6 +113,8 @@
   
       /**
        * Creates a new scanner with an Input Reader
  +     *
  +     * @param input the input reader
        */
       public SQLScanner(Reader input)
       {
  @@ -106,6 +123,8 @@
   
       /**
        * Set the Input
  +     *
  +     * @param input the input reader
        */
       public void setInput(Reader input)
       {
  @@ -114,8 +133,9 @@
   
   
       /**
  -     * Reads the next character and increments the line and
  -     * column counters.
  +     * Reads the next character and increments the line and column counters.
  +     *
  +     * @throws IOException If an I/O error occurs
        */
       private void readChar() throws IOException
       {
  @@ -137,12 +157,14 @@
   
       /**
        * Scans an identifier.
  +     *
  +     * @throws IOException If an I/O error occurs
        */
       private void scanIdentifier () throws IOException
       {
           token = "";
           char c = (char) chr;
  -        while (chr != -1 && white.indexOf(c) == -1 && special.indexOf(c)
== -1)
  +        while (chr != -1 && WHITE.indexOf(c) == -1 && SPECIAL.indexOf(c)
== -1)
           {
               token = token + (char) chr;
               readChar();
  @@ -154,12 +176,14 @@
   
       /**
        * Scans an identifier which had started with the negative sign.
  +     *
  +     * @throws IOException If an I/O error occurs
        */
       private void scanNegativeIdentifier () throws IOException
       {
           token = "-";
           char c = (char) chr;
  -        while (chr != -1 && white.indexOf(c) == -1 && special.indexOf(c)
== -1)
  +        while (chr != -1 && WHITE.indexOf(c) == -1 && SPECIAL.indexOf(c)
== -1)
           {
               token = token + (char) chr;
               readChar();
  @@ -170,8 +194,10 @@
       }
   
       /**
  -     * Scan the input Reader and returns a list
  -     * of tokens.
  +     * Scan the input Reader and returns a list of tokens.
  +     *
  +     * @return a list of tokens
  +     * @throws IOException If an I/O error occurs
        */
       public List scan () throws IOException
       {
  @@ -188,12 +214,12 @@
           while (chr != -1)
           {
               char c = (char) chr;
  -            inNegative=false;
  +            inNegative = false;
   
  -            if ((char) c == commentDash)
  +            if ((char) c == COMMENT_DASH)
               {
                   readChar();
  -                if ((char) chr == commentDash)
  +                if ((char) chr == COMMENT_DASH)
                   {
                       inCommentDash = true;
                   }
  @@ -212,15 +238,15 @@
                   }
                   readChar();
               }
  -            else if ((char) c == commentPound)
  +            else if ((char) c == COMMENT_POUND)
               {
                   inComment = true;
                   readChar();
               }
  -            else if ((char) c == commentSlash)
  +            else if ((char) c == COMMENT_SLASH)
               {
                   readChar();
  -                if ((char) chr == commentStar)
  +                if ((char) chr == COMMENT_STAR)
                   {
                       inCommentSlashStar = true;
                   }
  @@ -230,7 +256,7 @@
                   if ((char) c == '*')
                   {
                       readChar();
  -                    if ((char) chr == commentSlash)
  +                    if ((char) chr == COMMENT_SLASH)
                       {
                           inCommentSlashStar = false;
                       }
  @@ -241,7 +267,7 @@
                   }
                   readChar();
               }
  -            else if (alfanum.indexOf(c) >= 0)
  +            else if (ALFANUM.indexOf(c) >= 0)
               {
                   if (inNegative)
                   {
  @@ -252,9 +278,9 @@
                       scanIdentifier();
                   }
               }
  -            else if (special.indexOf(c) >= 0)
  +            else if (SPECIAL.indexOf(c) >= 0)
               {
  -                tokens.add(new Token ("" + c, line, col));
  +                tokens.add(new Token("" + c, line, col));
                   readChar();
               }
               else
  
  
  
  1.2       +18 -1     db-torque/src/generator/src/java/org/apache/torque/engine/sql/Token.java
  
  Index: Token.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/java/org/apache/torque/engine/sql/Token.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Token.java	10 Feb 2003 13:20:59 -0000	1.1
  +++ Token.java	18 Feb 2003 08:05:50 -0000	1.2
  @@ -65,12 +65,17 @@
   
   public class Token
   {
  +    /** string representation */
       private String str;
  +    /** line number */
       private int line;
  +    /** column number */
       private int col;
   
       /**
        * Creates a new token without positioning.
  +     *
  +     * @param str string representation
        */
       public Token(String str)
       {
  @@ -79,6 +84,10 @@
   
       /**
        * Creates a new token with positioning settings.
  +     *
  +     * @param str string representation
  +     * @param line line number
  +     * @param col column number
        */
       public Token(String str, int line, int col)
       {
  @@ -89,6 +98,8 @@
   
       /**
        * Returns the string representation of this token.
  +     *
  +     * @return the string representation
        */
       public String getStr()
       {
  @@ -97,6 +108,8 @@
   
       /**
        * Get the line number of this token.
  +     *
  +     * @return the line number
        */
       public int getLine()
       {
  @@ -105,6 +118,8 @@
   
       /**
        * Get the column number of this token.
  +     *
  +     * @return the column number
        */
       public int getCol()
       {
  @@ -113,6 +128,8 @@
   
       /**
        * The same as getStr()
  +     *
  +     * @return the string representation
        */
       public String toString()
       {
  
  
  
  1.2       +9 -5      db-torque/src/generator/src/java/org/apache/torque/task/TorqueDataDumpTask.java
  
  Index: TorqueDataDumpTask.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/java/org/apache/torque/task/TorqueDataDumpTask.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TorqueDataDumpTask.java	10 Feb 2003 13:20:59 -0000	1.1
  +++ TorqueDataDumpTask.java	18 Feb 2003 08:05:51 -0000	1.2
  @@ -215,7 +215,7 @@
        * Initializes initial context
        *
        * @return the context
  -     * @throws Exception
  +     * @throws Exception generic exception
        */
       public Context initControlContext() throws Exception
       {
  @@ -286,9 +286,13 @@
        */
       public class TableTool implements Iterator
       {
  +        /** querydataset */
           private QueryDataSet qds;
  +        /** is empty */
           private boolean isEmpty;
  +        /** current index */
           private int curIndex = -1;
  +        /** current record */
           private Record curRec = null;
   
           /**
  @@ -382,8 +386,8 @@
               }
               catch (Exception se)
               {
  -                log("Exception fetching value " + columnName + ": " +
  -                    se.getMessage(), Project.MSG_ERR);
  +                log("Exception fetching value " + columnName + ": "
  +                        + se.getMessage(), Project.MSG_ERR);
               }
               return null;
           }
  @@ -391,7 +395,7 @@
           /**
            * unsupported! always throws Exception
            *
  -         * @throws UnsupportedOperationException
  +         * @throws UnsupportedOperationException unsupported
            */
           public void remove() throws UnsupportedOperationException
           {
  
  
  

Mime
View raw message