jon 02/04/29 12:47:47
Modified: src/java/org/apache/torque Torque.java
src/java/org/apache/torque/engine/database/model
AppData.java Column.java Database.java
ForeignKey.java Index.java Table.java
src/java/org/apache/torque/engine/database/transform
SQLToAppData.java XmlToData.java
src/java/org/apache/torque/engine/sql SQLScanner.java
src/java/org/apache/torque/map DatabaseMap.java
TableMap.java
src/java/org/apache/torque/oid IDBroker.java
src/java/org/apache/torque/pool ConnectionPool.java
DBConnection.java
src/java/org/apache/torque/task TorqueDataModelTask.java
TorqueDataSQLTask.java TorqueJDBCTransformTask.java
TorqueSQLExec.java
src/java/org/apache/torque/util BasePeer.java Criteria.java
LargeSelect.java SqlExpression.java
src/templates/om Object.vm ObjectWithManager.vm Peer.vm
Log:
patch from: Jeff Schnitzer <[EMAIL PROTECTED]>
Vector becomes List/ArrayList, and Enumeration becomes Iterator. After
this patch, Vector should not appear anywhere in the code (even in
comments) and Enumeration only appears as part of the Log4J API method
calls. I checked each case to make sure that Vector synchronization is
not being relied upon (it never was).
Revision Changes Path
1.54 +3 -3 jakarta-turbine-torque/src/java/org/apache/torque/Torque.java
Index: Torque.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/Torque.java,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- Torque.java 25 Apr 2002 05:03:58 -0000 1.53
+++ Torque.java 29 Apr 2002 19:47:45 -0000 1.54
@@ -61,7 +61,7 @@
import java.util.Iterator;
import java.util.Map;
import java.util.List;
-import java.util.Vector;
+import java.util.ArrayList;
import java.util.Properties;
import org.apache.commons.lang.exception.NestableException;
import org.apache.log4j.Category;
@@ -90,7 +90,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Rafal Krzewski</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Martin Poeschl</a>
- * @version $Id: Torque.java,v 1.53 2002/04/25 05:03:58 jmcnally Exp $
+ * @version $Id: Torque.java,v 1.54 2002/04/29 19:47:45 jon Exp $
*/
public class Torque implements Initializable, Configurable
{
@@ -166,7 +166,7 @@
* are serialized then unserialized prior to Torque being reinitialized.
* This condition exists in a normal catalina restart.
*/
- private static List mapBuilders = new Vector();
+ private static List mapBuilders = new ArrayList();
/**
1.10 +2 -2
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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- AppData.java 16 Apr 2002 07:50:11 -0000 1.9
+++ AppData.java 29 Apr 2002 19:47:45 -0000 1.10
@@ -75,7 +75,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.9 2002/04/16 07:50:11 mpoeschl Exp $
+ * @version $Id: AppData.java,v 1.10 2002/04/29 19:47:45 jon Exp $
*/
public class AppData
{
@@ -272,7 +272,7 @@
}
/**
- * Add a database to the vector and sets the AppData property to this
+ * Add a database to the list and sets the AppData property to this
* AppData
*/
public void addDatabase(Database db)
1.21 +2 -2
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.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- Column.java 14 Apr 2002 12:59:27 -0000 1.20
+++ Column.java 29 Apr 2002 19:47:45 -0000 1.21
@@ -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.20 2002/04/14 12:59:27 mpoeschl Exp $
+ * @version $Id: Column.java,v 1.21 2002/04/29 19:47:45 jon Exp $
*/
public class Column
{
@@ -346,7 +346,7 @@
}
/**
- * Adds a new inheritance definition to the inheritance vector and set the
+ * Adds a new inheritance definition to the inheritance list and set the
* parent column of the inheritance to the current column
*/
public void addInheritance(Inheritance inh)
1.13 +2 -2
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.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- Database.java 11 Apr 2002 22:02:06 -0000 1.12
+++ Database.java 29 Apr 2002 19:47:45 -0000 1.13
@@ -75,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.12 2002/04/11 22:02:06 mpoeschl Exp $
+ * @version $Id: Database.java,v 1.13 2002/04/29 19:47:45 jon Exp $
*/
public class Database
{
@@ -306,7 +306,7 @@
}
/**
- * Add a table to the vector and sets the Database property to this Database
+ * Add a table to the list and sets the Database property to this Database
*/
public void addTable(Table tbl)
{
1.7 +3 -3
jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/ForeignKey.java
Index: ForeignKey.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/ForeignKey.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ForeignKey.java 28 Nov 2001 12:53:13 -0000 1.6
+++ ForeignKey.java 29 Apr 2002 19:47:45 -0000 1.7
@@ -64,7 +64,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Fedor</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel Rall</a>
- * @version $Id: ForeignKey.java,v 1.6 2001/11/28 12:53:13 mpoeschl Exp $
+ * @version $Id: ForeignKey.java,v 1.7 2002/04/29 19:47:45 jon Exp $
*/
public class ForeignKey
{
@@ -256,7 +256,7 @@
}
/**
- * Return the vector of local columns. You should not edit this vector.
+ * Return the list of local columns. You should not edit this List.
*/
public List getLocalColumns()
{
@@ -280,7 +280,7 @@
}
/**
- * Return the vector of local columns. You should not edit this vector.
+ * Return the list of local columns. You should not edit this List.
*/
public List getForeignColumns()
{
1.18 +2 -2
jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/Index.java
Index: Index.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/Index.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- Index.java 25 Feb 2002 19:30:38 -0000 1.17
+++ Index.java 29 Apr 2002 19:47:45 -0000 1.18
@@ -67,7 +67,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @author <a href="mailto:[EMAIL PROTECTED]>Daniel Rall</a>
- * @version $Id: Index.java,v 1.17 2002/02/25 19:30:38 jon Exp $
+ * @version $Id: Index.java,v 1.18 2002/04/29 19:47:45 jon Exp $
*/
public class Index
{
@@ -271,7 +271,7 @@
}
/**
- * Return the list of local columns. You should not edit this vector.
+ * Return the list of local columns. You should not edit this list.
*/
public List getColumns()
{
1.29 +5 -5
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.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- Table.java 14 Apr 2002 12:59:27 -0000 1.28
+++ Table.java 29 Apr 2002 19:47:45 -0000 1.29
@@ -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.28 2002/04/14 12:59:27 mpoeschl Exp $
+ * @version $Id: Table.java,v 1.29 2002/04/29 19:47:45 jon Exp $
*/
public class Table implements IDMethod
{
@@ -387,7 +387,7 @@
}
/**
- * Adds a new column to the column vector and set the
+ * Adds a new column to the column list and set the
* parent table of the column to the current table
*
* @param col the column to add
@@ -495,7 +495,7 @@
}
/**
- * Adds a new FK to the FK vector and set the
+ * Adds a new FK to the FK list and set the
* parent table of the column to the current table
*/
public void addForeignKey(ForeignKey fk)
@@ -550,7 +550,7 @@
}
/**
- * Adds a new index to the index vector and set the
+ * Adds a new index to the index list and set the
* parent table of the column to the current table
*/
public void addIndex(Index index)
@@ -572,7 +572,7 @@
}
/**
- * Adds a new Unique to the Unique vector and set the
+ * Adds a new Unique to the Unique list and set the
* parent table of the column to the current table
*/
public void addUnique(Unique unique)
1.5 +6 -5
jakarta-turbine-torque/src/java/org/apache/torque/engine/database/transform/SQLToAppData.java
Index: SQLToAppData.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/engine/database/transform/SQLToAppData.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SQLToAppData.java 14 Apr 2002 12:59:27 -0000 1.4
+++ SQLToAppData.java 29 Apr 2002 19:47:46 -0000 1.5
@@ -57,7 +57,8 @@
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
-import java.util.Vector;
+import java.util.List;
+import java.util.ArrayList;
import org.apache.torque.engine.database.model.AppData;
import org.apache.torque.engine.database.model.Column;
import org.apache.torque.engine.database.model.Database;
@@ -76,12 +77,12 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Leon Messerschmidt</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jon S. Stevens</a>
- * @version $Id: SQLToAppData.java,v 1.4 2002/04/14 12:59:27 mpoeschl Exp $
+ * @version $Id: SQLToAppData.java,v 1.5 2002/04/29 19:47:46 jon Exp $
*/
public class SQLToAppData
{
private String sqlFile;
- private Vector tokens;
+ private List tokens;
private Token token;
private AppData appData;
private Database appDataDB;
@@ -135,7 +136,7 @@
{
if (count < tokens.size())
{
- token = (Token) tokens.elementAt(count++);
+ token = (Token) tokens.get(count++);
}
else
{
@@ -334,7 +335,7 @@
next();
ForeignKey fk = new ForeignKey();
- Vector localColumns = new Vector();
+ List localColumns = new ArrayList();
tbl.addForeignKey(fk);
String colName = token.getStr();
1.7 +8 -8
jakarta-turbine-torque/src/java/org/apache/torque/engine/database/transform/XmlToData.java
Index: XmlToData.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/engine/database/transform/XmlToData.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XmlToData.java 14 Apr 2002 12:59:27 -0000 1.6
+++ XmlToData.java 29 Apr 2002 19:47:46 -0000 1.7
@@ -61,7 +61,7 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
-import java.util.Vector;
+import java.util.ArrayList;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
@@ -86,13 +86,13 @@
* @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]">Fedor Karpelevitch</a>
- * @version $Id: XmlToData.java,v 1.6 2002/04/14 12:59:27 mpoeschl Exp $
+ * @version $Id: XmlToData.java,v 1.7 2002/04/29 19:47:46 jon Exp $
*/
public class XmlToData extends DefaultHandler implements EntityResolver
{
private Database database;
private String errorMessage;
- private Vector data;
+ private List data;
private String dtdFileName;
private File dtdFile;
private InputSource dataDTD;
@@ -126,7 +126,7 @@
{
try
{
- data = new Vector();
+ data = new ArrayList();
SAXParser parser = saxFactory.newSAXParser();
@@ -170,7 +170,7 @@
else
{
Table table = database.getTableByJavaName(rawName);
- Vector columnValues = new Vector();
+ List columnValues = new ArrayList();
for (int i = 0; i < attributes.getLength(); i++)
{
Column col = table
@@ -268,9 +268,9 @@
public class DataRow
{
private Table table;
- private Vector columnValues;
+ private List columnValues;
- public DataRow(Table table, Vector columnValues)
+ public DataRow(Table table, List columnValues)
{
this.table = table;
this.columnValues = columnValues;
@@ -281,7 +281,7 @@
return table;
}
- public Vector getColumnValues()
+ public List getColumnValues()
{
return columnValues;
}
1.2 +8 -7
jakarta-turbine-torque/src/java/org/apache/torque/engine/sql/SQLScanner.java
Index: SQLScanner.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/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 2 Aug 2001 05:08:34 -0000 1.1
+++ SQLScanner.java 29 Apr 2002 19:47:46 -0000 1.2
@@ -56,7 +56,8 @@
import java.io.IOException;
import java.io.Reader;
-import java.util.Vector;
+import java.util.List;
+import java.util.ArrayList;
/**
* A simple Scanner implementation that scans an
@@ -64,7 +65,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Leon Messerschmidt</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jon S. Stevens</a>
- * @version $Id: SQLScanner.java,v 1.1 2001/08/02 05:08:34 jvanzyl Exp $
+ * @version $Id: SQLScanner.java,v 1.2 2002/04/29 19:47:46 jon Exp $
*/
public class SQLScanner
{
@@ -81,7 +82,7 @@
private Reader in;
private int chr;
private String token;
- private Vector tokens;
+ private List tokens;
private int line;
private int col;
@@ -138,14 +139,14 @@
readChar();
c = (char)chr;
}
- tokens.addElement(new Token (token,line,col));
+ tokens.add(new Token (token,line,col));
}
/**
* Scan the input Reader and returns a list
* of tokens.
*/
- public Vector scan () throws IOException
+ public List scan () throws IOException
{
line = 1;
col = 0;
@@ -153,7 +154,7 @@
boolean inCommentSlashStar = false;
boolean inCommentDash = false;
- tokens = new Vector();
+ tokens = new ArrayList();
readChar();
while (chr != -1)
{
@@ -211,7 +212,7 @@
}
else if (special.indexOf(c) >= 0)
{
- tokens.addElement(new Token (""+c,line,col));
+ tokens.add(new Token (""+c,line,col));
readChar();
}
else
1.5 +5 -5
jakarta-turbine-torque/src/java/org/apache/torque/map/DatabaseMap.java
Index: DatabaseMap.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/map/DatabaseMap.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DatabaseMap.java 19 Sep 2001 22:25:31 -0000 1.4
+++ DatabaseMap.java 29 Apr 2002 19:47:46 -0000 1.5
@@ -54,7 +54,7 @@
* <http://www.apache.org/>.
*/
-import java.util.Enumeration;
+import java.util.Iterator;
import java.util.HashMap;
import java.util.Hashtable;
import org.apache.torque.adapter.IDMethod;
@@ -66,7 +66,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">John D. McNally</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel Rall</a>
- * @version $Id: DatabaseMap.java,v 1.4 2001/09/19 22:25:31 jon Exp $
+ * @version $Id: DatabaseMap.java,v 1.5 2002/04/29 19:47:46 jon Exp $
*/
public class DatabaseMap implements java.io.Serializable
{
@@ -195,11 +195,11 @@
public TableMap[] getTables()
{
TableMap[] dbTables = new TableMap[tables.size()];
- Enumeration e = tables.elements();
+ Iterator it = tables.values().iterator();
int i = 0;
- while (e.hasMoreElements())
+ while (it.hasNext())
{
- dbTables[i++] = (TableMap) e.nextElement() ;
+ dbTables[i++] = (TableMap) it.next() ;
}
return dbTables;
}
1.7 +8 -8
jakarta-turbine-torque/src/java/org/apache/torque/map/TableMap.java
Index: TableMap.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/map/TableMap.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- TableMap.java 14 Mar 2002 00:59:29 -0000 1.6
+++ TableMap.java 29 Apr 2002 19:47:46 -0000 1.7
@@ -55,7 +55,7 @@
*/
import java.util.Date;
-import java.util.Enumeration;
+import java.util.Iterator;
import java.util.Hashtable;
import java.util.StringTokenizer;
import org.apache.torque.adapter.IDMethod;
@@ -66,7 +66,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">John D. McNally</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel Rall</a>
- * @version $Id: TableMap.java,v 1.6 2002/03/14 00:59:29 mpoeschl Exp $
+ * @version $Id: TableMap.java,v 1.7 2002/04/29 19:47:46 jon Exp $
*/
public class TableMap implements IDMethod, java.io.Serializable
{
@@ -202,10 +202,10 @@
*/
public boolean containsObjectColumn()
{
- Enumeration e = columns.elements();
- while (e.hasMoreElements())
+ Iterator it = columns.values().iterator();
+ while (it.hasNext())
{
- Object theType = ((ColumnMap)e.nextElement()).getType();
+ Object theType = ((ColumnMap)it.next()).getType();
if (! ( theType instanceof String ||
theType instanceof Number ||
theType instanceof java.util.Date ) )
@@ -294,11 +294,11 @@
public ColumnMap[] getColumns()
{
ColumnMap[] tableColumns = new ColumnMap[columns.size()];
- Enumeration e = columns.elements();
+ Iterator it = columns.values().iterator();
int i = 0;
- while (e.hasMoreElements())
+ while (it.hasNext())
{
- tableColumns[i++] = (ColumnMap) e.nextElement();
+ tableColumns[i++] = (ColumnMap) it.next();
}
return tableColumns;
}
1.15 +7 -7
jakarta-turbine-torque/src/java/org/apache/torque/oid/IDBroker.java
Index: IDBroker.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/oid/IDBroker.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- IDBroker.java 16 Apr 2002 21:22:49 -0000 1.14
+++ IDBroker.java 29 Apr 2002 19:47:46 -0000 1.15
@@ -61,7 +61,7 @@
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Date;
-import java.util.Enumeration;
+import java.util.Iterator;
import java.util.Hashtable;
import java.util.List;
import org.apache.log4j.Category;
@@ -113,7 +113,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Frank Y. Kim</a>
* @author <a href="mailto:[EMAIL PROTECTED]">John D. McNally</a>
- * @version $Id: IDBroker.java,v 1.14 2002/04/16 21:22:49 kschrader Exp $
+ * @version $Id: IDBroker.java,v 1.15 2002/04/29 19:47:46 jon Exp $
*/
public class IDBroker
implements Runnable, IdGenerator
@@ -151,7 +151,7 @@
* The cached IDs for each table.
*
* Key: String table name.
- * Value: Vector of Integer IDs.
+ * Value: List of Integer IDs.
*/
private Hashtable ids = new Hashtable(DEFAULT_SIZE);
@@ -437,7 +437,7 @@
{
if (availableIds == null)
{
- category.info ("Forced id retrieval - no available vector");
+ category.info ("Forced id retrieval - no available list");
}
else
{
@@ -538,10 +538,10 @@
}
// category.info("IDBroker thread checking for more keys.");
- Enumeration e = ids.keys();
- while (e.hasMoreElements())
+ Iterator it = ids.keySet().iterator();
+ while (it.hasNext())
{
- String tableName = (String)e.nextElement();
+ String tableName = (String)it.next();
category.info("IDBroker thread checking for more keys on table: " +
tableName);
List availableIds = (List)ids.get(tableName);
1.11 +5 -5
jakarta-turbine-torque/src/java/org/apache/torque/pool/ConnectionPool.java
Index: ConnectionPool.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/pool/ConnectionPool.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- ConnectionPool.java 6 Apr 2002 02:17:56 -0000 1.10
+++ ConnectionPool.java 29 Apr 2002 19:47:46 -0000 1.11
@@ -57,12 +57,12 @@
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
-import java.util.Stack;
-import java.util.Vector;
+import java.util.List;
import javax.sql.ConnectionPoolDataSource;
import javax.sql.PooledConnection;
import org.apache.torque.adapter.DB;
import org.apache.torque.adapter.DBFactory;
+import org.apache.commons.collections.ArrayStack;
/**
* This class implements a simple connection pooling scheme. Multiple
@@ -76,14 +76,14 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Paul O'Leary</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Magn�s ��r Torfason</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jon S. Stevens</a>
- * @version $Id: ConnectionPool.java,v 1.10 2002/04/06 02:17:56 dlr Exp $
+ * @version $Id: ConnectionPool.java,v 1.11 2002/04/29 19:47:46 jon Exp $
*/
public class ConnectionPool
{
/**
* Pool containing database connections.
*/
- private Stack pool = null;
+ private ArrayStack pool = null;
/**
* The driver type for this pool.
@@ -189,7 +189,7 @@
long maxConnectionAttempts,
long connectionWaitTimeout)
{
- pool = new Stack();
+ pool = new ArrayStack();
this.driver = driver;
this.url = url;
1.7 +6 -5
jakarta-turbine-torque/src/java/org/apache/torque/pool/DBConnection.java
Index: DBConnection.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/pool/DBConnection.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DBConnection.java 6 Apr 2002 01:53:10 -0000 1.6
+++ DBConnection.java 29 Apr 2002 19:47:46 -0000 1.7
@@ -60,7 +60,8 @@
import java.sql.SQLException;
import java.sql.Statement;
import java.util.EventObject;
-import java.util.Vector;
+import java.util.List;
+import java.util.ArrayList;
import javax.sql.ConnectionEvent;
import javax.sql.ConnectionEventListener;
import javax.sql.PooledConnection;
@@ -79,7 +80,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel L. Rall</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Magn�s ��r Torfason</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jon S. Stevens</a>
- * @version $Id: DBConnection.java,v 1.6 2002/04/06 01:53:10 dlr Exp $
+ * @version $Id: DBConnection.java,v 1.7 2002/04/29 19:47:46 jon Exp $
*/
public class DBConnection
implements ConnectionEventListener
@@ -121,7 +122,7 @@
/**
* ConnectionEventListeners
*/
- private Vector eventListeners;
+ private List eventListeners;
/**
* Log4j category used for logging.
@@ -191,7 +192,7 @@
this.username = username;
this.pool = pool;
this.timestamp = System.currentTimeMillis();
- eventListeners = new Vector();
+ eventListeners = new ArrayList();
}
/**
@@ -214,7 +215,7 @@
this.username = username;
this.pool = pool;
this.timestamp = System.currentTimeMillis();
- eventListeners = new Vector();
+ eventListeners = new ArrayList();
}
/**
1.15 +10 -9
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.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- TorqueDataModelTask.java 17 Apr 2002 18:23:26 -0000 1.14
+++ TorqueDataModelTask.java 29 Apr 2002 19:47:46 -0000 1.15
@@ -57,7 +57,8 @@
import java.io.File;
import java.util.Hashtable;
import java.util.Iterator;
-import java.util.Vector;
+import java.util.List;
+import java.util.ArrayList;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.types.FileSet;
@@ -89,12 +90,12 @@
/**
* Fileset of XML schemas which represent our data models.
*/
- protected Vector filesets = new Vector();
+ protected List filesets = new ArrayList();
/**
* Data models that we collect. One from each XML schema file.
*/
- protected Vector dataModels = new Vector();
+ protected List dataModels = new ArrayList();
/**
* Velocity context which exposes our objects
@@ -173,9 +174,9 @@
* Return the data models that have been
* processed.
*
- * @return Vector data models
+ * @return List data models
*/
- public Vector getDataModels()
+ public List getDataModels()
{
return dataModels;
}
@@ -217,7 +218,7 @@
*/
public void addFileset(FileSet set)
{
- filesets.addElement(set);
+ filesets.add(set);
}
/**
@@ -309,14 +310,14 @@
AppData ad = xmlParser.parseFile(xmlFile);
xmlParser.parseFile(xmlFile);
ad.setName(grokName(xmlFile));
- dataModels.addElement(ad);
+ dataModels.add(ad);
}
else
{
// Deal with the filesets.
for (int i = 0; i < filesets.size(); i++)
{
- FileSet fs = (FileSet) filesets.elementAt(i);
+ FileSet fs = (FileSet) filesets.get(i);
DirectoryScanner ds = fs.getDirectoryScanner(project);
File srcDir = fs.getDir(project);
@@ -331,7 +332,7 @@
AppData ad = xmlParser.parseFile(f.toString());
xmlParser.parseFile(f.toString());
ad.setName(grokName(f.toString()));
- dataModels.addElement(ad);
+ dataModels.add(ad);
}
}
}
1.10 +2 -2
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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- TorqueDataSQLTask.java 17 Apr 2002 18:23:26 -0000 1.9
+++ TorqueDataSQLTask.java 29 Apr 2002 19:47:46 -0000 1.10
@@ -69,7 +69,7 @@
* @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.9 2002/04/17 18:23:26 mpoeschl Exp $
+ * @version $Id: TorqueDataSQLTask.java,v 1.10 2002/04/29 19:47:46 jon Exp $
*/
public class TorqueDataSQLTask extends TorqueDataModelTask
{
@@ -153,7 +153,7 @@
{
super.initControlContext();
- AppData app = (AppData) getDataModels().elementAt(0);
+ AppData app = (AppData) getDataModels().get(0);
Database db = app.getDatabase();
try
1.9 +10 -10
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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- TorqueJDBCTransformTask.java 17 Apr 2002 18:23:26 -0000 1.8
+++ TorqueJDBCTransformTask.java 29 Apr 2002 19:47:46 -0000 1.9
@@ -64,7 +64,7 @@
import java.sql.SQLException;
import java.util.Hashtable;
import java.util.List;
-import java.util.Vector;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import org.apache.torque.engine.database.model.TypeMap;
@@ -84,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.8 2002/04/17 18:23:26 mpoeschl
Exp $
+ * @version $Id: TorqueJDBCTransformTask.java,v 1.9 2002/04/29 19:47:46 jon Exp $
*/
public class TorqueJDBCTransformTask extends Task
{
@@ -385,7 +385,7 @@
throws SQLException
{
log("Getting table list...");
- List tables = new Vector();
+ List tables = new ArrayList();
ResultSet tableNames = null;
// these are the entity types we want from the database
String[] types = {"TABLE", "VIEW"};
@@ -411,8 +411,8 @@
/**
* Retrieves all the column names and types for a given table from
- * JDBC metadata. It returns a vector of vectors. Each element
- * of the returned vector is a vector with:
+ * JDBC metadata. It returns a List of Lists. Each element
+ * of the returned List is a List with:
*
* element 0 => a String object for the column name.
* element 1 => an Integer object for the column type.
@@ -427,7 +427,7 @@
public List getColumns(DatabaseMetaData dbMeta, String tableName)
throws SQLException
{
- List columns = new Vector();
+ List columns = new ArrayList();
ResultSet columnSet = null;
try
{
@@ -440,7 +440,7 @@
Integer nullType = new Integer(columnSet.getInt(11));
String defValue = columnSet.getString(13);
- List col = new Vector(5);
+ List col = new ArrayList(5);
col.add(name);
col.add(sqlType);
col.add(size);
@@ -471,7 +471,7 @@
public List getPrimaryKeys(DatabaseMetaData dbMeta, String tableName)
throws SQLException
{
- List pk = new Vector();
+ List pk = new ArrayList();
ResultSet parts = null;
try
{
@@ -521,13 +521,13 @@
{
fk = new Object[2];
fk[0] = foreignKeys.getString(3); //referenced table name
- refs = new Vector();
+ refs = new ArrayList();
fk[1] = refs;
fks.put(fkName, fk);
}
else
{
- refs = (Vector) fk[1];
+ refs = (ArrayList) fk[1];
}
String[] ref = new String[2];
ref[0] = foreignKeys.getString(8); //local column
1.8 +9 -10
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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- TorqueSQLExec.java 17 Apr 2002 18:23:26 -0000 1.7
+++ TorqueSQLExec.java 29 Apr 2002 19:47:46 -0000 1.8
@@ -65,11 +65,10 @@
import java.io.PrintStream;
import java.io.StringReader;
import java.io.Reader;
+import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
-import java.util.Enumeration;
import java.util.Hashtable;
-import java.util.Vector;
import java.util.Properties;
import java.util.TreeSet;
import java.sql.Connection;
@@ -99,7 +98,7 @@
* @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.7 2002/04/17 18:23:26 mpoeschl Exp $
+ * @version $Id: TorqueSQLExec.java,v 1.8 2002/04/29 19:47:46 jon Exp $
*/
public class TorqueSQLExec extends Task
{
@@ -165,7 +164,7 @@
/**
* SQL transactions to perform
*/
- private Vector transactions = new Vector();
+ private List transactions = new ArrayList();
/**
* SQL Statement delimiter
@@ -513,13 +512,13 @@
String db = (String) k.next();
ArrayList l = (ArrayList) h.get(db);
Iterator j = l.iterator();
- Vector ts = new Vector();
+ List ts = new ArrayList();
while (j.hasNext())
{
String s = (String) j.next();
Transaction t = new Transaction();
t.setSrc(new File(srcDir, s));
- ts.addElement(t);
+ ts.add(t);
}
insertDatabaseSqlFiles(url, db, ts);
@@ -530,7 +529,7 @@
* Take the base url, the target database and insert a set of SQL
* files into the target database.
*/
- private void insertDatabaseSqlFiles(String url, String database, Vector
transactions)
+ private void insertDatabaseSqlFiles(String url, String database, List
transactions)
{
url = Strings.replace(url, "@DB@", database);
System.out.println("Our new url -> " + url);
@@ -603,10 +602,10 @@
}
// Process all transactions
- for (Enumeration e = transactions.elements();
- e.hasMoreElements();)
+ for (Iterator it = transactions.iterator();
+ it.hasNext();)
{
- ((Transaction) e.nextElement()).runTransaction(out);
+ ((Transaction) it.next()).runTransaction(out);
if (!autocommit)
{
log("Commiting transaction", Project.MSG_VERBOSE);
1.36 +59 -60
jakarta-turbine-torque/src/java/org/apache/torque/util/BasePeer.java
Index: BasePeer.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/util/BasePeer.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- BasePeer.java 25 Apr 2002 06:51:54 -0000 1.35
+++ BasePeer.java 29 Apr 2002 19:47:47 -0000 1.36
@@ -76,11 +76,10 @@
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Date;
-import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
-import java.util.Vector;
+import java.util.ArrayList;
import org.apache.torque.TorqueException;
import org.apache.torque.om.NumberKey;
@@ -115,7 +114,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Frank Y. Kim</a>
* @author <a href="mailto:[EMAIL PROTECTED]">John D. McNally</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Brett McLaughlin</a>
- * @version $Id: BasePeer.java,v 1.35 2002/04/25 06:51:54 jmcnally Exp $
+ * @version $Id: BasePeer.java,v 1.36 2002/04/29 19:47:47 jon Exp $
*/
public abstract class BasePeer implements java.io.Serializable
{
@@ -156,10 +155,10 @@
Object value = null;
byte[] byteArray = null;
- Enumeration keys = hash.keys();
- while(keys.hasMoreElements())
+ Iterator keys = hash.keySet().iterator();
+ while(keys.hasNext())
{
- key = (String) keys.nextElement();
+ key = (String) keys.next();
value = hash.get(key);
if ( value instanceof Serializable )
saveData.put ( key, value );
@@ -597,10 +596,10 @@
// criteria if directed to delete all related records.
// StringStack.add() only adds element if it is unique.
StringStack tables = new StringStack();
- Enumeration enum = criteria.keys();
- while (enum.hasMoreElements())
+ Iterator it = criteria.keySet().iterator();
+ while (it.hasNext())
{
- String key = (String) enum.nextElement();
+ String key = (String) it.next();
Criteria.Criterion c = criteria.getCriterion(key);
String[] tableNames = c.getAllTables();
for (int i=0; i<tableNames.length; i++)
@@ -829,10 +828,10 @@
// Get the table name and method for determining the primary
// key value.
String tableName = null;
- Enumeration keys = criteria.keys();
- if (keys.hasMoreElements())
+ Iterator keys = criteria.keySet().iterator();
+ if (keys.hasNext())
{
- tableName = criteria.getTableName((String)keys.nextElement());
+ tableName = criteria.getTableName((String)keys.next());
}
else
{
@@ -1144,10 +1143,10 @@
selectClause.add((String)aliases.get(key) + " AS " + key);
}
- Enumeration e = criteria.keys();
- while (e.hasMoreElements())
+ Iterator critKeys = criteria.keySet().iterator();
+ while (critKeys.hasNext())
{
- String key = (String)e.nextElement();
+ String key = (String)critKeys.next();
Criteria.Criterion criterion =
(Criteria.Criterion)criteria.getCriterion(key);
Criteria.Criterion[] someCriteria =
@@ -1340,13 +1339,13 @@
* Returns all results.
*
* @param criteria A Criteria.
- * @return Vector of Record objects.
+ * @return List of Record objects.
* @exception TorqueException
*/
- public static Vector doSelect(Criteria criteria)
+ public static List doSelect(Criteria criteria)
throws TorqueException
{
- Vector results = null;
+ List results = null;
if (criteria.isUseTransaction())
{
DBConnection dbCon = beginTransaction(criteria.getDbName());
@@ -1377,10 +1376,10 @@
*
* @param criteria A Criteria.
* @param dbCon A DBConnection.
- * @return Vector of Record objects.
+ * @return List of Record objects.
* @exception TorqueException
*/
- public static Vector doSelect(Criteria criteria,
+ public static List doSelect(Criteria criteria,
DBConnection dbCon)
throws TorqueException
{
@@ -1394,10 +1393,10 @@
* executeStatement for update, insert, and delete operations.
*
* @param queryString A String with the sql statement to execute.
- * @return Vector of Record objects.
+ * @return List of Record objects.
* @exception TorqueException
*/
- public static Vector executeQuery(String queryString)
+ public static List executeQuery(String queryString)
throws TorqueException
{
return executeQuery(queryString, Torque.getDefaultDB(), false);
@@ -1410,10 +1409,10 @@
*
* @param queryString A String with the sql statement to execute.
* @param dbName The database to connect to.
- * @return Vector of Record objects.
+ * @return List of Record objects.
* @exception TorqueException
*/
- public static Vector executeQuery(String queryString,
+ public static List executeQuery(String queryString,
String dbName)
throws TorqueException
{
@@ -1427,10 +1426,10 @@
* @param dbName The database to connect to.
* @param singleRecord Whether or not we want to select only a
* single record.
- * @return Vector of Record objects.
+ * @return List of Record objects.
* @exception TorqueException
*/
- public static Vector executeQuery(String queryString,
+ public static List executeQuery(String queryString,
String dbName,
boolean singleRecord)
throws TorqueException
@@ -1445,10 +1444,10 @@
* @param singleRecord Whether or not we want to select only a
* single record.
* @param dbCon A DBConnection.
- * @return Vector of Record objects.
+ * @return List of Record objects.
* @exception TorqueException
*/
- public static Vector executeQuery(String queryString,
+ public static List executeQuery(String queryString,
boolean singleRecord,
DBConnection dbCon)
throws TorqueException
@@ -1466,10 +1465,10 @@
* @param dbName The database to connect to.
* @param singleRecord Whether or not we want to select only a
* single record.
- * @return Vector of Record objects.
+ * @return List of Record objects.
* @exception TorqueException
*/
- public static Vector executeQuery(String queryString,
+ public static List executeQuery(String queryString,
int start,
int numberOfResults,
String dbName,
@@ -1477,7 +1476,7 @@
throws TorqueException
{
DBConnection db = null;
- Vector results = null;
+ List results = null;
try
{
// get a connection to the db
@@ -1502,10 +1501,10 @@
* @param singleRecord Whether or not we want to select only a
* single record.
* @param dbCon A DBConnection.
- * @return Vector of Record objects.
+ * @return List of Record objects.
* @exception TorqueException
*/
- public static Vector executeQuery(String queryString,
+ public static List executeQuery(String queryString,
int start,
int numberOfResults,
boolean singleRecord,
@@ -1523,7 +1522,7 @@
}
QueryDataSet qds = null;
- Vector results = new Vector();
+ List results = new ArrayList();
try
{
// execute the query
@@ -1556,21 +1555,21 @@
/**
- * Returns all records in a QueryDataSet as a Vector of Record
+ * Returns all records in a QueryDataSet as a List of Record
* objects. Used for functionality like util.db.LargeSelect.
*
* @param qds A QueryDataSet.
- * @return Vector of Record objects.
+ * @return List of Record objects.
* @exception TorqueException
*/
- public static Vector getSelectResults( QueryDataSet qds )
+ public static List getSelectResults( QueryDataSet qds )
throws TorqueException
{
return getSelectResults( qds, 0, -1, false);
}
/**
- * Returns all records in a QueryDataSet as a Vector of Record
+ * Returns all records in a QueryDataSet as a List of Record
* objects. Used for functionality like util.db.LargeSelect.
*
* @param qds A QueryDataSet.
@@ -1578,7 +1577,7 @@
* single record.
* @exception TorqueException
*/
- public static Vector getSelectResults( QueryDataSet qds,
+ public static List getSelectResults( QueryDataSet qds,
boolean singleRecord )
throws TorqueException
{
@@ -1586,7 +1585,7 @@
}
/**
- * Returns numberOfResults records in a QueryDataSet as a Vector
+ * Returns numberOfResults records in a QueryDataSet as a List
* of Record objects. Starting at record 0. Used for
* functionality like util.db.LargeSelect.
*
@@ -1596,12 +1595,12 @@
* single record.
* @exception TorqueException
*/
- public static Vector getSelectResults( QueryDataSet qds,
+ public static List getSelectResults( QueryDataSet qds,
int numberOfResults,
boolean singleRecord )
throws TorqueException
{
- Vector results = null;
+ List results = null;
if (numberOfResults != 0)
{
results = getSelectResults(qds, 0, numberOfResults, singleRecord);
@@ -1610,7 +1609,7 @@
}
/**
- * Returns numberOfResults records in a QueryDataSet as a Vector
+ * Returns numberOfResults records in a QueryDataSet as a List
* of Record objects. Starting at record start. Used for
* functionality like util.db.LargeSelect.
*
@@ -1621,23 +1620,23 @@
* single record.
* @exception TorqueException
*/
- public static Vector getSelectResults( QueryDataSet qds,
+ public static List getSelectResults( QueryDataSet qds,
int start,
int numberOfResults,
boolean singleRecord )
throws TorqueException
{
- Vector results;
+ List results;
try
{
if ( numberOfResults <= 0 )
{
- results = new Vector();
+ results = new ArrayList();
qds.fetchRecords();
}
else
{
- results = new Vector(numberOfResults);
+ results = new ArrayList(numberOfResults);
qds.fetchRecords(start, numberOfResults);
}
if ( qds.size() > 1 && singleRecord )
@@ -1645,11 +1644,11 @@
handleMultipleRecords(qds);
}
- // Return a Vector of Record objects.
+ // Return a List of Record objects.
for ( int i=0; i<qds.size(); i++ )
{
Record rec = qds.getRecord(i);
- results.addElement(rec);
+ results.add(rec);
}
}
catch (Exception e)
@@ -1878,11 +1877,11 @@
// Set up a list of required tables. StringStack.add()
// only adds element if it is unique.
StringStack tables = new StringStack();
- Enumeration enum = selectCriteria.keys();
- while (enum.hasMoreElements())
+ Iterator it = selectCriteria.keySet().iterator();
+ while (it.hasNext())
{
tables.add( selectCriteria.getTableName
- ((String) enum.nextElement()) );
+ ((String) it.next()) );
}
for (int i=0; i<tables.size(); i++)
@@ -2175,13 +2174,13 @@
*
* @exception TorqueException Error performing database query.
*/
- public static Vector doPSSelect(Criteria criteria, DBConnection dbCon)
+ public static List doPSSelect(Criteria criteria, DBConnection dbCon)
throws TorqueException
{
- Vector v = null;
+ List v = null;
StringBuffer qry = new StringBuffer();
- Vector params = new Vector(criteria.size());
+ List params = new ArrayList(criteria.size());
createPreparedStatement (criteria, qry, params);
@@ -2242,10 +2241,10 @@
/**
* Do a Prepared Statement select according to the given criteria
*/
- public static Vector doPSSelect(Criteria criteria) throws Exception
+ public static List doPSSelect(Criteria criteria) throws Exception
{
DBConnection dbCon = Torque.getConnection( criteria.getDbName() );
- Vector v = null;
+ List v = null;
try
{
@@ -2337,10 +2336,10 @@
selectClause.add((String)aliases.get(key) + " AS " + key);
}
- Enumeration e = criteria.keys();
- while (e.hasMoreElements())
+ Iterator critKeys = criteria.keySet().iterator();
+ while (critKeys.hasNext())
{
- String key = (String)e.nextElement();
+ String key = (String)critKeys.next();
Criteria.Criterion criterion =
(Criteria.Criterion)criteria.getCriterion(key);
Criteria.Criterion[] someCriteria =
1.23 +33 -35
jakarta-turbine-torque/src/java/org/apache/torque/util/Criteria.java
Index: Criteria.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/util/Criteria.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- Criteria.java 29 Apr 2002 18:24:05 -0000 1.22
+++ Criteria.java 29 Apr 2002 19:47:47 -0000 1.23
@@ -59,7 +59,6 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Enumeration;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Hashtable;
@@ -67,7 +66,6 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.Vector;
import org.apache.torque.Torque;
import org.apache.torque.TorqueException;
import org.apache.torque.adapter.DB;
@@ -92,7 +90,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Brett McLaughlin</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Eric Dobbs</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Henning P. Schmiedehausen</a>
- * @version $Id: Criteria.java,v 1.22 2002/04/29 18:24:05 dobbs Exp $
+ * @version $Id: Criteria.java,v 1.23 2002/04/29 19:47:47 jon Exp $
*/
public class Criteria extends Hashtable
{
@@ -418,9 +416,9 @@
DatabaseMap map = Torque.getDatabaseMap(databaseMapName);
StringStack tables = new StringStack();
- for (Enumeration e = super.elements(); e.hasMoreElements(); )
+ for (Iterator it = super.values().iterator(); it.hasNext(); )
{
- Criterion co = (Criterion)e.nextElement();
+ Criterion co = (Criterion)it.next();
String tableName = co.getTable();
String tableName2 = getTableForAlias(tableName);
if (tableName2 != null)
@@ -850,27 +848,27 @@
}
/**
- * Convenience method to return a Vector.
+ * Convenience method to return a List.
*
* @param name A String with the name of the key.
- * @return A Vector with the value of object at key.
+ * @return A List with the value of object at key.
*/
- public Vector getVector(String name)
+ public List getList(String name)
{
- return (Vector) getCriterion(name).getValue();
+ return (List) getCriterion(name).getValue();
}
/**
- * Convenience method to return a String.
+ * Convenience method to return a List.
*
* @param table String name of table.
* @param column String name of column.
- * @return A String with the value of object at key.
+ * @return A List with the value of object at key.
*/
- public Vector getVector(String table,
- String column)
+ public List getList(String table,
+ String column)
{
- return getVector(
+ return getList(
new StringBuffer(table.length() + column.length() + 1)
.append(table).append('.').append(column)
.toString() );
@@ -1556,7 +1554,7 @@
}
/**
- * Adds an 'IN' clause with the criteria supplied as a Vector.
+ * Adds an 'IN' clause with the criteria supplied as a List.
* For example:
*
* <p>
@@ -1630,7 +1628,7 @@
}
/**
- * Adds a 'NOT IN' clause with the criteria supplied as a Vector.
+ * Adds a 'NOT IN' clause with the criteria supplied as a List.
* For example:
*
* <p>
@@ -1878,10 +1876,10 @@
public String toString()
{
StringBuffer sb = new StringBuffer("Criteria:: ");
- Enumeration e = keys();
- while (e.hasMoreElements())
+ Iterator it = keySet().iterator();
+ while (it.hasNext())
{
- String key = (String)e.nextElement();
+ String key = (String)it.next();
sb.append(key).append("<=>")
.append(super.get(key).toString()).append(": ");
}
@@ -1926,9 +1924,9 @@
)
{
isEquiv = true;
- for (Enumeration e=criteria.keys(); e.hasMoreElements(); )
+ for (Iterator it=criteria.keySet().iterator(); it.hasNext(); )
{
- String key = (String)e.nextElement();
+ String key = (String)it.next();
if ( this.containsKey(key) )
{
Criterion a = this.getCriterion(key);
@@ -2465,7 +2463,7 @@
}
/**
- * Adds an 'IN' clause with the criteria supplied as a Vector.
+ * Adds an 'IN' clause with the criteria supplied as a List.
* For example:
*
* <p>
@@ -2479,11 +2477,11 @@
* "AND"ed to the existing criterion.
*
* @param column The column to run the comparison on
- * @param values A Vector with the allowed values.
+ * @param values A List with the allowed values.
* @return A modified Criteria object.
*/
public Criteria andIn(String column,
- Vector values)
+ List values)
{
and(column, (Object)values, Criteria.IN);
return this;
@@ -2539,7 +2537,7 @@
}
/**
- * Adds a 'NOT IN' clause with the criteria supplied as a Vector.
+ * Adds a 'NOT IN' clause with the criteria supplied as a List.
* For example:
*
* <p>
@@ -2553,11 +2551,11 @@
* "AND"ed to the existing criterion.
*
* @param column The column to run the comparison on
- * @param values A Vector with the disallowed values.
+ * @param values A List with the disallowed values.
* @return A modified Criteria object.
*/
public Criteria andNotIn(String column,
- Vector values)
+ List values)
{
and(column, (Object)values, Criteria.NOT_IN);
return this;
@@ -3077,7 +3075,7 @@
}
/**
- * Adds an 'IN' clause with the criteria supplied as a Vector.
+ * Adds an 'IN' clause with the criteria supplied as a List.
* For example:
*
* <p>
@@ -3091,11 +3089,11 @@
* "OR"ed to the existing criterion.
*
* @param column The column to run the comparison on
- * @param values A Vector with the allowed values.
+ * @param values A List with the allowed values.
* @return A modified Criteria object.
*/
public Criteria orIn(String column,
- Vector values)
+ List values)
{
or(column, (Object)values, Criteria.IN);
return this;
@@ -3151,7 +3149,7 @@
}
/**
- * Adds a 'NOT IN' clause with the criteria supplied as a Vector.
+ * Adds a 'NOT IN' clause with the criteria supplied as a List.
* For example:
*
* <p>
@@ -3165,11 +3163,11 @@
* "OR"ed to the existing criterion.
*
* @param column The column to run the comparison on
- * @param values A Vector with the disallowed values.
+ * @param values A List with the disallowed values.
* @return A modified Criteria object.
*/
public Criteria orNotIn(String column,
- Vector values)
+ List values)
{
or(column, (Object)values, Criteria.NOT_IN);
return this;
@@ -3572,9 +3570,9 @@
StringStack inClause = new StringStack();
- if (value instanceof Vector)
+ if (value instanceof List)
{
- value = ((Vector)value).toArray (new Object[0]);
+ value = ((List)value).toArray (new Object[0]);
}
for (int i = 0; i < Array.getLength(value); i++)
1.3 +20 -19
jakarta-turbine-torque/src/java/org/apache/torque/util/LargeSelect.java
Index: LargeSelect.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/util/LargeSelect.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LargeSelect.java 10 Aug 2001 12:23:04 -0000 1.2
+++ LargeSelect.java 29 Apr 2002 19:47:47 -0000 1.3
@@ -55,7 +55,8 @@
*/
import java.sql.Connection;
-import java.util.Vector;
+import java.util.List;
+import java.util.ArrayList;
import org.apache.torque.Torque;
import org.apache.torque.util.BasePeer;
import org.apache.torque.pool.DBConnection;
@@ -77,7 +78,7 @@
* untested and in all likelihood contains several bugs.
*
* @author <a href="mailto:[EMAIL PROTECTED]">John D. McNally</a>
- * @version $Id: LargeSelect.java,v 1.2 2001/08/10 12:23:04 knielsen Exp $
+ * @version $Id: LargeSelect.java,v 1.3 2002/04/29 19:47:47 jon Exp $
*/
public class LargeSelect
implements Runnable
@@ -92,7 +93,7 @@
private String dbName;
private DBConnection db = null;
private QueryDataSet qds = null;
- private Vector results = null;
+ private List results = null;
private Thread thread = null;
private boolean killThread = false;
private int position;
@@ -201,7 +202,7 @@
{
this.memoryLimit = memoryLimit;
this.name = name;
- results = new Vector();
+ results = new ArrayList();
query = BasePeer.createQueryString(criteria);
dbName = criteria.getDbName();
blockEnd = blockBegin + memoryLimit - 1;
@@ -211,10 +212,10 @@
/**
* Gets the next block of rows.
*
- * @return A Vector of query results.
+ * @return A List of query results.
* @exception Exception, a generic exception.
*/
- public Vector getNextResults()
+ public List getNextResults()
throws Exception
{
return getResults(position, miniblock);
@@ -223,10 +224,10 @@
/**
* Gets a block of rows which have previously been retrieved.
*
- * @return a Vector of query results.
+ * @return a List of query results.
* @exception Exception, a generic exception.
*/
- public Vector getPreviousResults()
+ public List getPreviousResults()
throws Exception
{
return getResults(position-2*miniblock, miniblock);
@@ -237,10 +238,10 @@
* rows in the block was specified in the constructor.
*
* @param start The starting row.
- * @return a Vector of query results.
+ * @return a List of query results.
* @exception Exception, a generic exception.
*/
- public Vector getResults(int start) throws Exception
+ public List getResults(int start) throws Exception
{
return getResults(start, miniblock);
}
@@ -251,11 +252,11 @@
*
* @param start The starting row.
* @param size The number of rows.
- * @return a Vector of query results.
+ * @return a List of query results.
* @exception Exception, a generic exception.
*/
- synchronized public Vector getResults(int start,
- int size)
+ synchronized public List getResults(int start,
+ int size)
throws Exception
{
if (size > memoryLimit)
@@ -308,10 +309,10 @@
throw new Exception("parameter configuration not accounted for");
}
- Vector returnResults = new Vector(size);
+ List returnResults = new ArrayList(size);
for (int i=(start-blockBegin); i<(start-blockBegin+size); i++)
{
- returnResults.addElement( results.elementAt(i) );
+ returnResults.add( results.get(i) );
}
position = start+size;
return returnResults;
@@ -344,12 +345,12 @@
{
size = blockEnd - currentlyFilledTo;
}
- Vector tempResults = BasePeer.getSelectResults( qds,
- size,
- false);
+ List tempResults = BasePeer.getSelectResults( qds,
+ size,
+ false);
for (int i=0; i<tempResults.size(); i++)
{
- results.addElement( tempResults.elementAt(i) );
+ results.add( tempResults.get(i) );
}
currentlyFilledTo += miniblock;
qds.clearRecords();
1.15 +2 -2
jakarta-turbine-torque/src/java/org/apache/torque/util/SqlExpression.java
Index: SqlExpression.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/util/SqlExpression.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- SqlExpression.java 12 Mar 2002 12:52:27 -0000 1.14
+++ SqlExpression.java 29 Apr 2002 19:47:47 -0000 1.15
@@ -78,7 +78,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">John D. McNally</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel Rall</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Fedor Karpelevitch</a>
- * @version $Id: SqlExpression.java,v 1.14 2002/03/12 12:52:27 mpoeschl Exp $
+ * @version $Id: SqlExpression.java,v 1.15 2002/04/29 19:47:47 jon Exp $
*/
public class SqlExpression
{
@@ -544,7 +544,7 @@
* Creates an appropriate string for an 'IN' clause from an
* object. Adds quoting and/or UPPER() as appropriate. This is
* broken out into a seperate method as it is used in two places
- * in buildIn, depending on whether an array or Vector is being
+ * in buildIn, depending on whether an array or List is being
* looped over.
*
* @param value The value to process.
1.26 +11 -11 jakarta-turbine-torque/src/templates/om/Object.vm
Index: Object.vm
===================================================================
RCS file: /home/cvs/jakarta-turbine-torque/src/templates/om/Object.vm,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- Object.vm 11 Apr 2002 02:06:12 -0000 1.25
+++ Object.vm 29 Apr 2002 19:47:47 -0000 1.26
@@ -356,7 +356,7 @@
/**
* Collection to store aggregation of $collName
*/
- protected Vector $collName;
+ protected List $collName;
/**
* Temporary storage of $collName to save a possible db hit in
@@ -367,7 +367,7 @@
{
if ($collName == null)
{
- $collName = new Vector();
+ $collName = new ArrayList();
}
}
@@ -393,7 +393,7 @@
* the collection. Otherwise returns the results of
* get${relCol}(new Criteria())
*/
- public Vector get${relCol}() throws TorqueException
+ public List get${relCol}() throws TorqueException
{
if ($collName == null)
{
@@ -411,13 +411,13 @@
* an empty collection or the current collection, the criteria
* is ignored on a new object.
*/
- public Vector get${relCol}(Criteria criteria) throws TorqueException
+ public List get${relCol}(Criteria criteria) throws TorqueException
{
if ($collName == null)
{
if ( isNew() )
{
- $collName = new Vector();
+ $collName = new ArrayList();
}
else
{
@@ -523,14 +523,14 @@
* api reasonable. You can provide public methods for those you
* actually need in ${table.JavaName}.
*/
- protected Vector get${relCol}Join${relCol2}(Criteria criteria)
+ protected List get${relCol}Join${relCol2}(Criteria criteria)
throws TorqueException
{
if ($collName == null)
{
if ( isNew() )
{
- $collName = new Vector();
+ $collName = new ArrayList();
}
else
{
@@ -581,14 +581,14 @@
* api reasonable. You can provide public methods for those you
* actually need in ${table.JavaName}.
*/
- protected Vector get${relCol}JoinAllExcept${table.JavaName}(Criteria criteria)
+ protected List get${relCol}JoinAllExcept${table.JavaName}(Criteria criteria)
throws TorqueException
{
if ($collName == null)
{
if ( isNew() )
{
- $collName = new Vector();
+ $collName = new ArrayList();
}
else
{
@@ -637,7 +637,7 @@
## getByName code
##
#if (!$table.isAlias() && $addGetByNameMethod)
- private static Vector fieldNames_ = null;
+ private static List fieldNames_ = null;
/**
* Generate a list of field names.
@@ -646,7 +646,7 @@
{
if (fieldNames_ == null)
{
- fieldNames_ = new Vector();
+ fieldNames_ = new ArrayList();
#foreach ($col in $table.Columns)
fieldNames_.add("${col.JavaName}");
#end
1.5 +11 -11 jakarta-turbine-torque/src/templates/om/ObjectWithManager.vm
Index: ObjectWithManager.vm
===================================================================
RCS file: /home/cvs/jakarta-turbine-torque/src/templates/om/ObjectWithManager.vm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ObjectWithManager.vm 14 Mar 2002 02:03:41 -0000 1.4
+++ ObjectWithManager.vm 29 Apr 2002 19:47:47 -0000 1.5
@@ -358,7 +358,7 @@
/**
* Collection to store aggregation of $collName
*/
- protected Vector $collName;
+ protected List $collName;
/**
* Temporary storage of $collName to save a possible db hit in
@@ -369,7 +369,7 @@
{
if ($collName == null)
{
- $collName = new Vector();
+ $collName = new ArrayList();
}
}
@@ -400,7 +400,7 @@
* the collection. Otherwise returns the results of
* get${relCol}(new Criteria())
*/
- public Vector get${relCol}() throws TorqueException
+ public List get${relCol}() throws TorqueException
{
if ($collName == null)
{
@@ -418,13 +418,13 @@
* an empty collection or the current collection, the criteria
* is ignored on a new object.
*/
- public Vector get${relCol}(Criteria criteria) throws TorqueException
+ public List get${relCol}(Criteria criteria) throws TorqueException
{
if ($collName == null)
{
if ( isNew() )
{
- $collName = new Vector();
+ $collName = new ArrayList();
}
else
{
@@ -530,14 +530,14 @@
* api reasonable. You can provide public methods for those you
* actually need in ${table.JavaName}.
*/
- protected Vector get${relCol}Join${relCol2}(Criteria criteria)
+ protected List get${relCol}Join${relCol2}(Criteria criteria)
throws TorqueException
{
if ($collName == null)
{
if ( isNew() )
{
- $collName = new Vector();
+ $collName = new ArrayList();
}
else
{
@@ -588,14 +588,14 @@
* api reasonable. You can provide public methods for those you
* actually need in ${table.JavaName}.
*/
- protected Vector get${relCol}JoinAllExcept${table.JavaName}(Criteria criteria)
+ protected List get${relCol}JoinAllExcept${table.JavaName}(Criteria criteria)
throws TorqueException
{
if ($collName == null)
{
if ( isNew() )
{
- $collName = new Vector();
+ $collName = new ArrayList();
}
else
{
@@ -644,7 +644,7 @@
## getByName code
##
#if (!$table.isAlias() && $addGetByNameMethod)
- private static Vector fieldNames_ = null;
+ private static List fieldNames_ = null;
/**
* Generate a list of field names.
@@ -653,7 +653,7 @@
{
if (fieldNames_ == null)
{
- fieldNames_ = new Vector();
+ fieldNames_ = new ArrayList();
#foreach ($col in $table.Columns)
fieldNames_.add("${col.JavaName}");
#end
1.26 +26 -26 jakarta-turbine-torque/src/templates/om/Peer.vm
Index: Peer.vm
===================================================================
RCS file: /home/cvs/jakarta-turbine-torque/src/templates/om/Peer.vm,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- Peer.vm 9 Apr 2002 15:59:44 -0000 1.25
+++ Peer.vm 29 Apr 2002 19:47:47 -0000 1.26
@@ -127,12 +127,12 @@
* resultset MUST return columns in the right order. You can use
* getFieldNames() in BaseObject to get the correct sequence.
*/
- public static Vector resultSet2Objects (java.sql.ResultSet results) throws
TorqueException
+ public static List resultSet2Objects (java.sql.ResultSet results) throws
TorqueException
{
try
{
QueryDataSet qds = null;
- Vector rows = null;
+ List rows = null;
try
{
qds = new QueryDataSet( results );
@@ -354,14 +354,14 @@
}
/** Method to do selects */
- public static Vector doSelect( Criteria criteria ) throws TorqueException
+ public static List doSelect( Criteria criteria ) throws TorqueException
{
return populateObjects( doSelectVillageRecords(criteria) );
}
/** Method to do selects within a transaction */
- public static Vector doSelect( Criteria criteria,
+ public static List doSelect( Criteria criteria,
DBConnection dbCon )
throws TorqueException
{
@@ -375,7 +375,7 @@
* alter the data and call save(), your results may vary, but are
* certainly likely to result in hard to track MT bugs.
*/
- public static Vector doSelectVillageRecords( Criteria criteria )
+ public static List doSelectVillageRecords( Criteria criteria )
throws TorqueException
{
return $basePrefix${table.JavaName}Peer
@@ -386,7 +386,7 @@
* Grabs the raw Village records to be formed into objects.
* This method should be used for transactions
*/
- public static Vector doSelectVillageRecords( Criteria criteria,
+ public static List doSelectVillageRecords( Criteria criteria,
DBConnection dbCon )
throws TorqueException
{
@@ -446,7 +446,7 @@
{
criteria.setDbName(DATABASE_NAME);
}
- // BasePeer returns a Vector of Value (Village) arrays. The array
+ // BasePeer returns a List of Value (Village) arrays. The array
// order follows the order columns were placed in the Select clause.
if ( dbCon == null)
{
@@ -459,18 +459,18 @@
}
/**
- * The returned vector will contain objects of the default type or
+ * The returned List will contain objects of the default type or
* objects that inherit from the default.
*/
- public static Vector populateObjects(Vector records)
+ public static List populateObjects(List records)
throws TorqueException
{
- Vector results = new Vector(records.size());
+ List results = new ArrayList(records.size());
// populate the object(s)
for ( int i=0; i<records.size(); i++ )
{
- Record row = (Record)records.elementAt(i);
+ Record row = (Record)records.get(i);
#if ($table.ChildrenColumn)
results.add(${table.JavaName}Peer.row2Object(row, 1,
${table.JavaName}Peer.getOMClass(row, 1)));
@@ -717,7 +717,7 @@
}
/** Method to do selects */
- public static Vector doSelect($table.JavaName obj) throws TorqueException
+ public static List doSelect($table.JavaName obj) throws TorqueException
{
return doSelect(buildCriteria(obj));
}
@@ -864,14 +864,14 @@
#set ( $i = $i + 1 )
#end
#end
- Vector v = doSelect(criteria, dbcon);
+ List v = doSelect(criteria, dbcon);
if ( v.size() != 1)
{
throw new TorqueException("Failed to select one and only one row.");
}
else
{
- return ($table.JavaName)v.firstElement();
+ return ($table.JavaName)v.get(0);
}
}
@@ -1013,14 +1013,14 @@
#set ( $clo=$col.Name.toLowerCase() )
criteria.add( $cup, $clo );
#end
- Vector v = doSelect(criteria, dbcon);
+ List v = doSelect(criteria, dbcon);
if ( v.size() != 1)
{
throw new TorqueException("Failed to select one and only one row.");
}
else
{
- return ($table.JavaName) v.firstElement();
+ return ($table.JavaName) v.get(0);
}
}
#end
@@ -1080,7 +1080,7 @@
* api reasonable. You can provide public methods for those you
* actually need in ${table.JavaName}Peer.
*/
- protected static Vector doSelectJoin${joinColumnId}(Criteria c)
+ protected static List doSelectJoin${joinColumnId}(Criteria c)
throws TorqueException
{
#if ($targetDatabase == "postgresql" && $table.requiresTransactionInPostgres())
@@ -1149,12 +1149,12 @@
#end
#end
- Vector rows = BasePeer.doSelect(c);
- Vector results = new Vector();
+ List rows = BasePeer.doSelect(c);
+ List results = new ArrayList();
for (int i=0; i<rows.size(); i++)
{
- Record row = (Record)rows.elementAt(i);
+ Record row = (Record)rows.get(i);
#set ($classDecl = "Class")
#if ($table.ChildrenColumn)
@@ -1180,7 +1180,7 @@
boolean newObject = true;
for (int j=0; j<results.size(); j++)
{
- $className temp_obj1 = ($className)results.elementAt(j);
+ $className temp_obj1 = ($className)results.get(j);
$joinClassName temp_obj2 =
($joinClassName)temp_obj1.get${joinInterface}();
if ( temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey() ) )
{
@@ -1240,7 +1240,7 @@
* api reasonable. You can provide public methods for those you
* actually need in ${table.JavaName}Peer.
*/
- protected static Vector doSelectJoinAllExcept${excludeString}(Criteria c)
+ protected static List doSelectJoinAllExcept${excludeString}(Criteria c)
throws TorqueException
{
#if ($targetDatabase == "postgresql" && $table.requiresTransactionInPostgres())
@@ -1312,12 +1312,12 @@
#end
#end
- Vector rows = BasePeer.doSelect(c);
- Vector results = new Vector();
+ List rows = BasePeer.doSelect(c);
+ List results = new ArrayList();
for (int i=0; i<rows.size(); i++)
{
- Record row = (Record)rows.elementAt(i);
+ Record row = (Record)rows.get(i);
#set ($classDecl = "Class")
#if ($table.ChildrenColumn)
@@ -1375,7 +1375,7 @@
#if ($index == 2) boolean #end newObject = true;
for (int j=0; j<results.size(); j++)
{
- $className temp_obj1 = ($className)results.elementAt(j);
+ $className temp_obj1 = ($className)results.get(j);
$joinClassName temp_obj$index =
($joinClassName)temp_obj1.get${joinString}();
if (
temp_obj${index}.getPrimaryKey().equals(obj${index}.getPrimaryKey() ) )
{
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>