manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1129397 [1/2] - in /incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core: database/ interfaces/
Date Mon, 30 May 2011 22:00:06 GMT
Author: kwright
Date: Mon May 30 22:00:05 2011
New Revision: 1129397

URL: http://svn.apache.org/viewvc?rev=1129397&view=rev
Log:
Refactor classes to be Java 1.5 compliant, using best practices where feasible.

Modified:
    incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/BaseTable.java
    incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java
    incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
    incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java
    incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java
    incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/Database.java
    incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/QueryDescription.java
    incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/RRow.java
    incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/RSet.java
    incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ConfigParams.java
    incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/Configuration.java
    incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ConfigurationNode.java
    incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IDBInterface.java
    incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IResultRow.java

Modified: incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/BaseTable.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/BaseTable.java?rev=1129397&r1=1129396&r2=1129397&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/BaseTable.java (original)
+++ incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/BaseTable.java Mon May 30 22:00:05 2011
@@ -82,7 +82,7 @@ public class BaseTable
   *@param whereClause is the where clause describing the match (including the WHERE), or null if none.
   *@param whereParameters are the parameters that come with the where clause, if any.
   */
-  protected void performUpdate(Map parameterMap, String whereClause, ArrayList whereParameters, StringSet invalidateKeys)
+  protected void performUpdate(Map parameterMap, String whereClause, List whereParameters, StringSet invalidateKeys)
     throws ManifoldCFException
   {
     dbInterface.performUpdate(tableName,parameterMap,whereClause,whereParameters,invalidateKeys);
@@ -93,7 +93,7 @@ public class BaseTable
   *@param whereClause is the where clause describing the match (including the WHERE), or null if none.
   *@param whereParameters are the parameters that come with the where clause, if any.
   */
-  protected void performDelete(String whereClause, ArrayList whereParameters, StringSet invalidateKeys)
+  protected void performDelete(String whereClause, List whereParameters, StringSet invalidateKeys)
     throws ManifoldCFException
   {
     dbInterface.performDelete(tableName,whereClause,whereParameters,invalidateKeys);
@@ -119,7 +119,7 @@ public class BaseTable
   *@param columnDeleteList is the list of column names to delete.
   *@param invalidateKeys are the cache keys that should be invalidated, if any.
   */
-  public void performAlter(Map columnMap, Map columnModifyMap, ArrayList columnDeleteList,
+  public void performAlter(Map columnMap, Map columnModifyMap, List<String> columnDeleteList,
     StringSet invalidateKeys)
     throws ManifoldCFException
   {
@@ -131,7 +131,7 @@ public class BaseTable
   *@param columnList is the list of columns that need to be included
   * in the index, in order.
   */
-  protected void addTableIndex(boolean unique, ArrayList columnList)
+  protected void addTableIndex(boolean unique, List<String> columnList)
     throws ManifoldCFException
   {
     dbInterface.addTableIndex(tableName,unique,columnList);
@@ -209,7 +209,7 @@ public class BaseTable
   *@param params are the parameterized values, if needed.
   *@param invalidateKeys are the cache keys to invalidate.
   */
-  protected void performModification(String query, ArrayList params, StringSet invalidateKeys)
+  protected void performModification(String query, List params, StringSet invalidateKeys)
     throws ManifoldCFException
   {
     dbInterface.performModification(query,params,invalidateKeys);
@@ -223,7 +223,7 @@ public class BaseTable
   * or null if no LRU behavior desired.
   *@return a resultset.
   */
-  protected IResultSet performQuery(String query, ArrayList params, StringSet cacheKeys, String queryClass)
+  protected IResultSet performQuery(String query, List params, StringSet cacheKeys, String queryClass)
     throws ManifoldCFException
   {
     return dbInterface.performQuery(query,params,cacheKeys,queryClass);
@@ -238,7 +238,7 @@ public class BaseTable
   *@param resultLimit is the maximum number of results desired.
   *@return a resultset.
   */
-  protected IResultSet performQuery(String query, ArrayList params, StringSet cacheKeys, String queryClass, int resultLimit)
+  protected IResultSet performQuery(String query, List params, StringSet cacheKeys, String queryClass, int resultLimit)
     throws ManifoldCFException
   {
     return dbInterface.performQuery(query,params,cacheKeys,queryClass,resultLimit,null);
@@ -334,15 +334,15 @@ public class BaseTable
   * This filter wraps a query and returns a new query whose results are similar to POSTGRESQL's DISTINCT-ON feature.
   * Specifically, for each combination of the specified distinct fields in the result, only the first such row is included in the final
   * result.
-  *@param outputParameters is a blank arraylist into which to put parameters.  Null may be used if the baseParameters parameter is null.
+  *@param outputParameters is a blank list into which to put parameters.  Null may be used if the baseParameters parameter is null.
   *@param baseQuery is the base query, which can either be tables and where clause, or can be another SELECT in parens,
   * e.g. "(SELECT ...) t3"
   *@param baseParameters are the parameters corresponding to the baseQuery.
   *@param distinctFields are the fields to consider to be distinct.
   *@param otherFields are the rest of the fields to return, keyed by the AS name, value being the column value, e.g. "value AS key"
-  *@return a revised query that performs the necessary DISTINCT ON operation.  The arraylist outputParameters will also be appropriately filled in.
+  *@return a revised query that performs the necessary DISTINCT ON operation.  The list outputParameters will also be appropriately filled in.
   */
-  public String constructDistinctOnClause(ArrayList outputParameters, String baseQuery, ArrayList baseParameters, String[] distinctFields, Map otherFields)
+  public String constructDistinctOnClause(List outputParameters, String baseQuery, List baseParameters, String[] distinctFields, Map otherFields)
   {
     return dbInterface.constructDistinctOnClause(outputParameters,baseQuery,baseParameters,distinctFields,otherFields);
   }

Modified: incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java?rev=1129397&r1=1129396&r2=1129397&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java (original)
+++ incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceDerby.java Mon May 30 22:00:05 2011
@@ -53,22 +53,22 @@ public class DBInterfaceDerby extends Da
   boolean inTransaction = false;
   
   // This is where we keep track of tables that we need to analyze on transaction exit
-  protected ArrayList tablesToAnalyze = new ArrayList();
+  protected List<String> tablesToAnalyze = new ArrayList<String>();
 
   // Keep track of tables to reindex on transaction exit
-  protected ArrayList tablesToReindex = new ArrayList();
+  protected List<String> tablesToReindex = new ArrayList<String>();
 
   // This is where we keep temporary table statistics, which accumulate until they reach a threshold, and then are added into shared memory.
   
   /** Accumulated reindex statistics.  This map is keyed by the table name, and contains TableStatistics values. */
-  protected static Map currentReindexStatistics = new HashMap();
+  protected static Map<String,TableStatistics> currentReindexStatistics = new HashMap<String,TableStatistics>();
   /** Table reindex thresholds, as read from configuration information.  Keyed by table name, contains Integer values. */
-  protected static Map reindexThresholds = new HashMap();
+  protected static Map<String,Integer> reindexThresholds = new HashMap<String,Integer>();
   
   /** Accumulated analyze statistics.  This map is keyed by the table name, and contains TableStatistics values. */
-  protected static Map currentAnalyzeStatistics = new HashMap();
+  protected static Map<String,TableStatistics> currentAnalyzeStatistics = new HashMap<String,TableStatistics>();
   /** Table analyze thresholds, as read from configuration information.  Keyed by table name, contains Integer values. */
-  protected static Map analyzeThresholds = new HashMap();
+  protected static Map<String,Integer> analyzeThresholds = new HashMap<String,Integer>();
   
   /** The number of inserts, deletes, etc. before we update the shared area. */
   protected static final int commitThreshold = 100;
@@ -176,10 +176,10 @@ public class DBInterfaceDerby extends Da
   * invalidated.
   *@param parameterMap is the map of column name/values to write.
   */
-  public void performInsert(String tableName, Map parameterMap, StringSet invalidateKeys)
+  public void performInsert(String tableName, Map<String,Object> parameterMap, StringSet invalidateKeys)
     throws ManifoldCFException
   {
-    ArrayList paramArray = new ArrayList();
+    List paramArray = new ArrayList();
 
     StringBuilder bf = new StringBuilder();
     bf.append("INSERT INTO ");
@@ -189,12 +189,12 @@ public class DBInterfaceDerby extends Da
     StringBuilder values = new StringBuilder(" VALUES (");
 
     // loop for cols
-    Iterator it = parameterMap.entrySet().iterator();
+    Iterator<Map.Entry<String,Object>> it = parameterMap.entrySet().iterator();
     boolean first = true;
     while (it.hasNext())
     {
-      Map.Entry e = (Map.Entry)it.next();
-      String key = (String)e.getKey();
+      Map.Entry<String,Object> e = it.next();
+      String key = e.getKey();
 
       Object o = e.getValue();
       if (o != null)
@@ -229,10 +229,11 @@ public class DBInterfaceDerby extends Da
   *@param whereClause is the where clause describing the match (including the WHERE), or null if none.
   *@param whereParameters are the parameters that come with the where clause, if any.
   */
-  public void performUpdate(String tableName, Map parameterMap, String whereClause, ArrayList whereParameters, StringSet invalidateKeys)
+  public void performUpdate(String tableName, Map<String,Object> parameterMap, String whereClause,
+    List whereParameters, StringSet invalidateKeys)
     throws ManifoldCFException
   {
-    ArrayList paramArray = new ArrayList();
+    List paramArray = new ArrayList();
 
     StringBuilder bf = new StringBuilder();
     bf.append("UPDATE ");
@@ -240,12 +241,12 @@ public class DBInterfaceDerby extends Da
     bf.append(" SET ") ;
 
     // loop for parameters
-    Iterator it = parameterMap.entrySet().iterator();
+    Iterator<Map.Entry<String,Object>> it = parameterMap.entrySet().iterator();
     boolean first = true;
     while (it.hasNext())
     {
-      Map.Entry e = (Map.Entry)it.next();
-      String key = (String)e.getKey();
+      Map.Entry<String,Object> e = it.next();
+      String key = e.getKey();
 
       Object o = e.getValue();
 
@@ -294,7 +295,7 @@ public class DBInterfaceDerby extends Da
   *@param whereClause is the where clause describing the match (including the WHERE), or null if none.
   *@param whereParameters are the parameters that come with the where clause, if any.
   */
-  public void performDelete(String tableName, String whereClause, ArrayList whereParameters, StringSet invalidateKeys)
+  public void performDelete(String tableName, String whereClause, List whereParameters, StringSet invalidateKeys)
     throws ManifoldCFException
   {
     StringBuilder bf = new StringBuilder();
@@ -320,19 +321,19 @@ public class DBInterfaceDerby extends Da
   * layer.
   *@param invalidateKeys are the cache keys that should be invalidated, if any.
   */
-  public void performCreate(String tableName, Map columnMap, StringSet invalidateKeys)
+  public void performCreate(String tableName, Map<String,ColumnDescription> columnMap, StringSet invalidateKeys)
     throws ManifoldCFException
   {
     int constraintNumber = 0;
     StringBuilder queryBuffer = new StringBuilder("CREATE TABLE ");
     queryBuffer.append(tableName);
     queryBuffer.append('(');
-    Iterator iter = columnMap.keySet().iterator();
+    Iterator<String> iter = columnMap.keySet().iterator();
     boolean first = true;
     while (iter.hasNext())
     {
-      String columnName = (String)iter.next();
-      ColumnDescription cd = (ColumnDescription)columnMap.get(columnName);
+      String columnName = iter.next();
+      ColumnDescription cd = columnMap.get(columnName);
       if (!first)
         queryBuffer.append(',');
       else
@@ -383,7 +384,8 @@ public class DBInterfaceDerby extends Da
   *@param columnDeleteList is the list of column names to delete.
   *@param invalidateKeys are the cache keys that should be invalidated, if any.
   */
-  public void performAlter(String tableName, Map columnMap, Map columnModifyMap, ArrayList columnDeleteList,
+  public void performAlter(String tableName, Map<String,ColumnDescription> columnMap,
+    Map<String,ColumnDescription> columnModifyMap, List<String> columnDeleteList,
     StringSet invalidateKeys)
     throws ManifoldCFException
   {
@@ -395,7 +397,7 @@ public class DBInterfaceDerby extends Da
         int i = 0;
         while (i < columnDeleteList.size())
         {
-          String columnName = (String)columnDeleteList.get(i++);
+          String columnName = columnDeleteList.get(i++);
           performModification("ALTER TABLE ONLY "+tableName+" DROP "+columnName,null,invalidateKeys);
         }
       }
@@ -403,11 +405,11 @@ public class DBInterfaceDerby extends Da
       // Do the modifies.  This involves renaming each column to a temp column, then creating a new one, then copying
       if (columnModifyMap != null)
       {
-        Iterator iter = columnModifyMap.keySet().iterator();
+        Iterator<String> iter = columnModifyMap.keySet().iterator();
         while (iter.hasNext())
         {
-          String columnName = (String)iter.next();
-          ColumnDescription cd = (ColumnDescription)columnModifyMap.get(columnName);
+          String columnName = iter.next();
+          ColumnDescription cd = columnModifyMap.get(columnName);
           String renameColumn = "__temp__";
           // Create a new column we can copy the data into.
           performModification("RENAME COLUMN "+tableName+"."+columnName+" TO "+renameColumn,null,invalidateKeys);
@@ -428,11 +430,11 @@ public class DBInterfaceDerby extends Da
       // Now, do the adds
       if (columnMap != null)
       {
-        Iterator iter = columnMap.keySet().iterator();
+        Iterator<String> iter = columnMap.keySet().iterator();
         while (iter.hasNext())
         {
-          String columnName = (String)iter.next();
-          ColumnDescription cd = (ColumnDescription)columnMap.get(columnName);
+          String columnName = iter.next();
+          ColumnDescription cd = columnMap.get(columnName);
           StringBuilder sb = new StringBuilder();
           appendDescription(sb,columnName,cd,false);
           performModification("ALTER TABLE "+tableName+" ADD "+sb.toString(),null,invalidateKeys);
@@ -474,14 +476,14 @@ public class DBInterfaceDerby extends Da
   *@param columnList is the list of columns that need to be included
   * in the index, in order.
   */
-  public void addTableIndex(String tableName, boolean unique, ArrayList columnList)
+  public void addTableIndex(String tableName, boolean unique, List<String> columnList)
     throws ManifoldCFException
   {
     String[] columns = new String[columnList.size()];
     int i = 0;
     while (i < columns.length)
     {
-      columns[i] = (String)columnList.get(i);
+      columns[i] = columnList.get(i);
       i++;
     }
     performAddIndex(null,tableName,new IndexDescription(unique,columns));
@@ -568,7 +570,7 @@ public class DBInterfaceDerby extends Da
     lockManager.enterWriteCriticalSection(tableStatisticsLock);
     try
     {
-      TableStatistics ts = (TableStatistics)currentAnalyzeStatistics.get(tableName);
+      TableStatistics ts = currentAnalyzeStatistics.get(tableName);
       // Lock this table's statistics files
       lockManager.enterWriteLock(tableStatisticsLock);
       try
@@ -605,7 +607,7 @@ public class DBInterfaceDerby extends Da
     lockManager.enterWriteCriticalSection(tableStatisticsLock);
     try
     {
-      TableStatistics ts = (TableStatistics)currentReindexStatistics.get(tableName);
+      TableStatistics ts = currentReindexStatistics.get(tableName);
       // Lock this table's statistics files
       lockManager.enterWriteLock(tableStatisticsLock);
       try
@@ -634,7 +636,7 @@ public class DBInterfaceDerby extends Da
   {
     if (getTransactionID() == null)
     {
-      ArrayList list = new ArrayList();
+      List list = new ArrayList();
       list.add("APP");
       list.add(tableName.toUpperCase());
       performModification("CALL SYSCS_UTIL.SYSCS_UPDATE_STATISTICS(?,?,null)",list,null);
@@ -654,12 +656,12 @@ public class DBInterfaceDerby extends Da
         try
         {
           // To reindex, we (a) get all the table's indexes, (b) drop them, (c) recreate them
-          Map x = getTableIndexes(tableName,null,null);
-          Iterator iter = x.keySet().iterator();
+          Map<String,IndexDescription> x = getTableIndexes(tableName,null,null);
+          Iterator<String> iter = x.keySet().iterator();
           while (iter.hasNext())
           {
-            String indexName = (String)iter.next();
-            IndexDescription id = (IndexDescription)x.get(indexName);
+            String indexName = iter.next();
+            IndexDescription id = x.get(indexName);
             performRemoveIndex(indexName);
             performAddIndex(indexName,tableName,id);
           }
@@ -809,7 +811,7 @@ public class DBInterfaceDerby extends Da
   *@param params are the parameterized values, if needed.
   *@param invalidateKeys are the cache keys to invalidate.
   */
-  public void performModification(String query, ArrayList params, StringSet invalidateKeys)
+  public void performModification(String query, List params, StringSet invalidateKeys)
     throws ManifoldCFException
   {
     while (true)
@@ -858,18 +860,18 @@ public class DBInterfaceDerby extends Da
   *@return a map of column names and ColumnDescription objects, describing the schema, or null if the
   * table doesn't exist.
   */
-  public Map getTableSchema(String tableName, StringSet cacheKeys, String queryClass)
+  public Map<String,ColumnDescription> getTableSchema(String tableName, StringSet cacheKeys, String queryClass)
     throws ManifoldCFException
   {
     String query = "SELECT CAST(t0.columnname AS VARCHAR(128)) AS columnname,CAST(t0.columndatatype AS VARCHAR(128)) AS columndatatype FROM sys.syscolumns t0, sys.systables t1 WHERE t0.referenceid=t1.tableid AND CAST(t1.tablename AS VARCHAR(128))=? ORDER BY t0.columnnumber ASC";
-    ArrayList list = new ArrayList();
+    List list = new ArrayList();
     list.add(tableName.toUpperCase());
 
     IResultSet set = performQuery(query,list,cacheKeys,queryClass);
     if (set.getRowCount() == 0)
       return null;
     // Digest the result
-    HashMap rval = new HashMap();
+    Map<String,ColumnDescription> rval = new HashMap<String,ColumnDescription>();
     int i = 0;
     while (i < set.getRowCount())
     {
@@ -890,14 +892,14 @@ public class DBInterfaceDerby extends Da
   *@param queryClass is the name of the query class, or null.
   *@return a map of index names and IndexDescription objects, describing the indexes.
   */
-  public Map getTableIndexes(String tableName, StringSet cacheKeys, String queryClass)
+  public Map<String,IndexDescription> getTableIndexes(String tableName, StringSet cacheKeys, String queryClass)
     throws ManifoldCFException
   {
-    Map rval = new HashMap();
+    Map<String,IndexDescription> rval = new HashMap<String,IndexDescription>();
 
     // This query returns all index names for the table
     String query = "SELECT t0.conglomeratename FROM sys.sysconglomerates t0,sys.systables t1 WHERE t0.tableid=t1.tableid AND t0.isindex IS NOT NULL AND CAST(t1.tablename AS VARCHAR(128))=?";
-    ArrayList list = new ArrayList();
+    List list = new ArrayList();
     list.add(tableName);
     
     // It doesn't look like there's a way to find exactly what is in the index, and what the columns are.  Since
@@ -947,7 +949,7 @@ public class DBInterfaceDerby extends Da
   * or null if no LRU behavior desired.
   *@return a resultset.
   */
-  public IResultSet performQuery(String query, ArrayList params, StringSet cacheKeys, String queryClass)
+  public IResultSet performQuery(String query, List params, StringSet cacheKeys, String queryClass)
     throws ManifoldCFException
   {
     try
@@ -970,7 +972,7 @@ public class DBInterfaceDerby extends Da
   *@param returnLimit is a description of how to limit the return result, or null if no limit.
   *@return a resultset.
   */
-  public IResultSet performQuery(String query, ArrayList params, StringSet cacheKeys, String queryClass,
+  public IResultSet performQuery(String query, List params, StringSet cacheKeys, String queryClass,
     int maxResults, ILimitChecker returnLimit)
     throws ManifoldCFException
   {
@@ -995,7 +997,7 @@ public class DBInterfaceDerby extends Da
   *@param returnLimit is a description of how to limit the return result, or null if no limit.
   *@return a resultset.
   */
-  public IResultSet performQuery(String query, ArrayList params, StringSet cacheKeys, String queryClass,
+  public IResultSet performQuery(String query, List params, StringSet cacheKeys, String queryClass,
     int maxResults, ResultSpecification resultSpec, ILimitChecker returnLimit)
     throws ManifoldCFException
   {
@@ -1077,15 +1079,16 @@ public class DBInterfaceDerby extends Da
   * This filter wraps a query and returns a new query whose results are similar to POSTGRESQL's DISTINCT-ON feature.
   * Specifically, for each combination of the specified distinct fields in the result, only the first such row is included in the final
   * result.
-  *@param outputParameters is a blank arraylist into which to put parameters.  Null may be used if the baseParameters parameter is null.
+  *@param outputParameters is a blank list into which to put parameters.  Null may be used if the baseParameters parameter is null.
   *@param baseQuery is the base query, which is another SELECT statement, without parens,
   * e.g. "SELECT ..."
   *@param baseParameters are the parameters corresponding to the baseQuery.
   *@param distinctFields are the fields to consider to be distinct.  These should all be keys in otherFields below.
   *@param otherFields are the rest of the fields to return, keyed by the AS name, value being the base query column value, e.g. "value AS key"
-  *@return a revised query that performs the necessary DISTINCT ON operation.  The arraylist outputParameters will also be appropriately filled in.
+  *@return a revised query that performs the necessary DISTINCT ON operation.  The list outputParameters will also be appropriately filled in.
   */
-  public String constructDistinctOnClause(ArrayList outputParameters, String baseQuery, ArrayList baseParameters, String[] distinctFields, Map otherFields)
+  public String constructDistinctOnClause(List outputParameters, String baseQuery, List baseParameters, String[] distinctFields,
+    Map<String,String> otherFields)
   {
     // Derby does not really support this functionality.
     // We could hack a workaround, along the following lines:
@@ -1110,11 +1113,11 @@ public class DBInterfaceDerby extends Da
 
     StringBuilder sb = new StringBuilder("SELECT ");
     boolean needComma = false;
-    Iterator iter = otherFields.keySet().iterator();
+    Iterator<String> iter = otherFields.keySet().iterator();
     while (iter.hasNext())
     {
-      String fieldName = (String)iter.next();
-      String columnValue = (String)otherFields.get(fieldName);
+      String fieldName = iter.next();
+      String columnValue = otherFields.get(fieldName);
       if (needComma)
         sb.append(",");
       needComma = true;
@@ -1163,7 +1166,7 @@ public class DBInterfaceDerby extends Da
     lockManager.enterWriteCriticalSection(tableStatisticsLock);
     try
     {
-      Integer threshold = (Integer)reindexThresholds.get(tableName);
+      Integer threshold = reindexThresholds.get(tableName);
       int reindexThreshold;
       if (threshold == null)
       {
@@ -1174,7 +1177,7 @@ public class DBInterfaceDerby extends Da
       else
         reindexThreshold = threshold.intValue();
       
-      TableStatistics ts = (TableStatistics)currentReindexStatistics.get(tableName);
+      TableStatistics ts = currentReindexStatistics.get(tableName);
       if (ts == null)
       {
         ts = new TableStatistics();
@@ -1220,7 +1223,7 @@ public class DBInterfaceDerby extends Da
     lockManager.enterWriteCriticalSection(tableStatisticsLock);
     try
     {
-      Integer threshold = (Integer)analyzeThresholds.get(tableName);
+      Integer threshold = analyzeThresholds.get(tableName);
       int analyzeThreshold;
       if (threshold == null)
       {
@@ -1231,7 +1234,7 @@ public class DBInterfaceDerby extends Da
       else
         analyzeThreshold = threshold.intValue();
       
-      TableStatistics ts = (TableStatistics)currentAnalyzeStatistics.get(tableName);
+      TableStatistics ts = currentAnalyzeStatistics.get(tableName);
       if (ts == null)
       {
         ts = new TableStatistics();
@@ -1381,13 +1384,13 @@ public class DBInterfaceDerby extends Da
       int i = 0;
       while (i < tablesToAnalyze.size())
       {
-        analyzeTableInternal((String)tablesToAnalyze.get(i++));
+        analyzeTableInternal(tablesToAnalyze.get(i++));
       }
       tablesToAnalyze.clear();
       i = 0;
       while (i < tablesToReindex.size())
       {
-        reindexTableInternal((String)tablesToReindex.get(i++));
+        reindexTableInternal(tablesToReindex.get(i++));
       }
       tablesToReindex.clear();
     }

Modified: incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java?rev=1129397&r1=1129396&r2=1129397&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java (original)
+++ incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceHSQLDB.java Mon May 30 22:00:05 2011
@@ -130,10 +130,10 @@ public class DBInterfaceHSQLDB extends D
   * invalidated.
   *@param parameterMap is the map of column name/values to write.
   */
-  public void performInsert(String tableName, Map parameterMap, StringSet invalidateKeys)
+  public void performInsert(String tableName, Map<String,Object> parameterMap, StringSet invalidateKeys)
     throws ManifoldCFException
   {
-    ArrayList paramArray = new ArrayList();
+    List paramArray = new ArrayList();
 
     StringBuilder bf = new StringBuilder();
     bf.append("INSERT INTO ");
@@ -143,12 +143,12 @@ public class DBInterfaceHSQLDB extends D
     StringBuilder values = new StringBuilder(" VALUES (");
 
     // loop for cols
-    Iterator it = parameterMap.entrySet().iterator();
+    Iterator<Map.Entry<String,Object>> it = parameterMap.entrySet().iterator();
     boolean first = true;
     while (it.hasNext())
     {
-      Map.Entry e = (Map.Entry)it.next();
-      String key = (String)e.getKey();
+      Map.Entry<String,Object> e = it.next();
+      String key = e.getKey();
 
       Object o = e.getValue();
       if (o != null)
@@ -183,10 +183,11 @@ public class DBInterfaceHSQLDB extends D
   *@param whereClause is the where clause describing the match (including the WHERE), or null if none.
   *@param whereParameters are the parameters that come with the where clause, if any.
   */
-  public void performUpdate(String tableName, Map parameterMap, String whereClause, ArrayList whereParameters, StringSet invalidateKeys)
+  public void performUpdate(String tableName, Map<String,Object> parameterMap, String whereClause,
+    List whereParameters, StringSet invalidateKeys)
     throws ManifoldCFException
   {
-    ArrayList paramArray = new ArrayList();
+    List paramArray = new ArrayList();
 
     StringBuilder bf = new StringBuilder();
     bf.append("UPDATE ");
@@ -194,12 +195,12 @@ public class DBInterfaceHSQLDB extends D
     bf.append(" SET ") ;
 
     // loop for parameters
-    Iterator it = parameterMap.entrySet().iterator();
+    Iterator<Map.Entry<String,Object>> it = parameterMap.entrySet().iterator();
     boolean first = true;
     while (it.hasNext())
     {
-      Map.Entry e = (Map.Entry)it.next();
-      String key = (String)e.getKey();
+      Map.Entry<String,Object> e = it.next();
+      String key = e.getKey();
 
       Object o = e.getValue();
 
@@ -248,7 +249,7 @@ public class DBInterfaceHSQLDB extends D
   *@param whereClause is the where clause describing the match (including the WHERE), or null if none.
   *@param whereParameters are the parameters that come with the where clause, if any.
   */
-  public void performDelete(String tableName, String whereClause, ArrayList whereParameters, StringSet invalidateKeys)
+  public void performDelete(String tableName, String whereClause, List whereParameters, StringSet invalidateKeys)
     throws ManifoldCFException
   {
     StringBuilder bf = new StringBuilder();
@@ -274,18 +275,18 @@ public class DBInterfaceHSQLDB extends D
   * layer.
   *@param invalidateKeys are the cache keys that should be invalidated, if any.
   */
-  public void performCreate(String tableName, Map columnMap, StringSet invalidateKeys)
+  public void performCreate(String tableName, Map<String,ColumnDescription> columnMap, StringSet invalidateKeys)
     throws ManifoldCFException
   {
     StringBuilder queryBuffer = new StringBuilder("CREATE TABLE ");
     queryBuffer.append(tableName);
     queryBuffer.append('(');
-    Iterator iter = columnMap.keySet().iterator();
+    Iterator<String> iter = columnMap.keySet().iterator();
     boolean first = true;
     while (iter.hasNext())
     {
-      String columnName = (String)iter.next();
-      ColumnDescription cd = (ColumnDescription)columnMap.get(columnName);
+      String columnName = iter.next();
+      ColumnDescription cd = columnMap.get(columnName);
       if (!first)
         queryBuffer.append(',');
       else
@@ -333,7 +334,8 @@ public class DBInterfaceHSQLDB extends D
   *@param columnDeleteList is the list of column names to delete.
   *@param invalidateKeys are the cache keys that should be invalidated, if any.
   */
-  public void performAlter(String tableName, Map columnMap, Map columnModifyMap, ArrayList columnDeleteList,
+  public void performAlter(String tableName, Map<String,ColumnDescription> columnMap,
+    Map<String,ColumnDescription> columnModifyMap, List<String> columnDeleteList,
     StringSet invalidateKeys)
     throws ManifoldCFException
   {
@@ -345,7 +347,7 @@ public class DBInterfaceHSQLDB extends D
         int i = 0;
         while (i < columnDeleteList.size())
         {
-          String columnName = (String)columnDeleteList.get(i++);
+          String columnName = columnDeleteList.get(i++);
           performModification("ALTER TABLE "+tableName+" DROP "+columnName+" RESTRICT",null,invalidateKeys);
         }
       }
@@ -353,12 +355,12 @@ public class DBInterfaceHSQLDB extends D
       // Do the modifies.  This involves renaming each column to a temp column, then creating a new one, then copying
       if (columnModifyMap != null)
       {
-        Iterator iter = columnModifyMap.keySet().iterator();
+        Iterator<String> iter = columnModifyMap.keySet().iterator();
         while (iter.hasNext())
         {
           StringBuilder sb;
-          String columnName = (String)iter.next();
-          ColumnDescription cd = (ColumnDescription)columnModifyMap.get(columnName);
+          String columnName = iter.next();
+          ColumnDescription cd = columnModifyMap.get(columnName);
           String renameColumn = "__temp__";
           sb = new StringBuilder();
           appendDescription(sb,renameColumn,cd,true);
@@ -383,11 +385,11 @@ public class DBInterfaceHSQLDB extends D
       // Now, do the adds
       if (columnMap != null)
       {
-        Iterator iter = columnMap.keySet().iterator();
+        Iterator<String> iter = columnMap.keySet().iterator();
         while (iter.hasNext())
         {
-          String columnName = (String)iter.next();
-          ColumnDescription cd = (ColumnDescription)columnMap.get(columnName);
+          String columnName = iter.next();
+          ColumnDescription cd = columnMap.get(columnName);
           StringBuilder sb = new StringBuilder();
           appendDescription(sb,columnName,cd,false);
           performModification("ALTER TABLE "+tableName+" ADD "+sb.toString(),null,invalidateKeys);
@@ -429,14 +431,14 @@ public class DBInterfaceHSQLDB extends D
   *@param columnList is the list of columns that need to be included
   * in the index, in order.
   */
-  public void addTableIndex(String tableName, boolean unique, ArrayList columnList)
+  public void addTableIndex(String tableName, boolean unique, List<String> columnList)
     throws ManifoldCFException
   {
     String[] columns = new String[columnList.size()];
     int i = 0;
     while (i < columns.length)
     {
-      columns[i] = (String)columnList.get(i);
+      columns[i] = columnList.get(i);
       i++;
     }
     performAddIndex(null,tableName,new IndexDescription(unique,columns));
@@ -605,7 +607,7 @@ public class DBInterfaceHSQLDB extends D
   *@param params are the parameterized values, if needed.
   *@param invalidateKeys are the cache keys to invalidate.
   */
-  public void performModification(String query, ArrayList params, StringSet invalidateKeys)
+  public void performModification(String query, List params, StringSet invalidateKeys)
     throws ManifoldCFException
   {
     try
@@ -625,11 +627,11 @@ public class DBInterfaceHSQLDB extends D
   *@return a map of column names and ColumnDescription objects, describing the schema, or null if the
   * table doesn't exist.
   */
-  public Map getTableSchema(String tableName, StringSet cacheKeys, String queryClass)
+  public Map<String,ColumnDescription> getTableSchema(String tableName, StringSet cacheKeys, String queryClass)
     throws ManifoldCFException
   {
     StringBuilder query = new StringBuilder();
-    ArrayList list = new ArrayList();
+    List list = new ArrayList();
     list.add(tableName.toUpperCase());
     query.append("SELECT column_name, is_nullable, data_type, character_maximum_length ")
       .append("FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='PUBLIC' AND table_name=?");
@@ -648,7 +650,7 @@ public class DBInterfaceHSQLDB extends D
       primaryKey = "";
     
     // Digest the result
-    HashMap rval = new HashMap();
+    Map<String,ColumnDescription> rval = new HashMap<String,ColumnDescription>();
     int i = 0;
     while (i < set.getRowCount())
     {
@@ -678,18 +680,18 @@ public class DBInterfaceHSQLDB extends D
   *@param queryClass is the name of the query class, or null.
   *@return a map of index names and IndexDescription objects, describing the indexes.
   */
-  public Map getTableIndexes(String tableName, StringSet cacheKeys, String queryClass)
+  public Map<String,IndexDescription> getTableIndexes(String tableName, StringSet cacheKeys, String queryClass)
     throws ManifoldCFException
   {
-    Map rval = new HashMap();
+    Map<String,IndexDescription> rval = new HashMap<String,IndexDescription>();
 
     String query = "SELECT index_name,column_name,non_unique,ordinal_position FROM INFORMATION_SCHEMA.SYSTEM_INDEXINFO "+
       "WHERE table_schem='PUBLIC' AND TABLE_NAME=? ORDER BY index_name,ordinal_position ASC";
-    ArrayList list = new ArrayList();
+    List list = new ArrayList();
     list.add(tableName.toUpperCase());
     IResultSet result = performQuery(query,list,cacheKeys,queryClass);
     String lastIndexName = null;
-    ArrayList indexColumns = null;
+    List<String> indexColumns = null;
     boolean isUnique = false;
     int i = 0;
     while (i < result.getRowCount())
@@ -710,7 +712,7 @@ public class DBInterfaceHSQLDB extends D
       if (lastIndexName == null)
       {
         lastIndexName = indexName;
-        indexColumns = new ArrayList();
+        indexColumns = new ArrayList<String>();
         isUnique = false;
       }
       indexColumns.add(columnName);
@@ -723,7 +725,7 @@ public class DBInterfaceHSQLDB extends D
     return rval;
   }
 
-  protected void addIndex(Map rval, String indexName, boolean isUnique, ArrayList indexColumns)
+  protected void addIndex(Map rval, String indexName, boolean isUnique, List<String> indexColumns)
   {
     if (indexName.indexOf("sys_idx") != -1)
       return;
@@ -731,7 +733,7 @@ public class DBInterfaceHSQLDB extends D
     int i = 0;
     while (i < columnNames.length)
     {
-      columnNames[i] = (String)indexColumns.get(i);
+      columnNames[i] = indexColumns.get(i);
       i++;
     }
     rval.put(indexName,new IndexDescription(isUnique,columnNames));
@@ -767,7 +769,7 @@ public class DBInterfaceHSQLDB extends D
   * or null if no LRU behavior desired.
   *@return a resultset.
   */
-  public IResultSet performQuery(String query, ArrayList params, StringSet cacheKeys, String queryClass)
+  public IResultSet performQuery(String query, List params, StringSet cacheKeys, String queryClass)
     throws ManifoldCFException
   {
     try
@@ -790,7 +792,7 @@ public class DBInterfaceHSQLDB extends D
   *@param returnLimit is a description of how to limit the return result, or null if no limit.
   *@return a resultset.
   */
-  public IResultSet performQuery(String query, ArrayList params, StringSet cacheKeys, String queryClass,
+  public IResultSet performQuery(String query, List params, StringSet cacheKeys, String queryClass,
     int maxResults, ILimitChecker returnLimit)
     throws ManifoldCFException
   {
@@ -815,7 +817,7 @@ public class DBInterfaceHSQLDB extends D
   *@param returnLimit is a description of how to limit the return result, or null if no limit.
   *@return a resultset.
   */
-  public IResultSet performQuery(String query, ArrayList params, StringSet cacheKeys, String queryClass,
+  public IResultSet performQuery(String query, List params, StringSet cacheKeys, String queryClass,
     int maxResults, ResultSpecification resultSpec, ILimitChecker returnLimit)
     throws ManifoldCFException
   {
@@ -879,15 +881,16 @@ public class DBInterfaceHSQLDB extends D
   * This filter wraps a query and returns a new query whose results are similar to POSTGRESQL's DISTINCT-ON feature.
   * Specifically, for each combination of the specified distinct fields in the result, only the first such row is included in the final
   * result.
-  *@param outputParameters is a blank arraylist into which to put parameters.  Null may be used if the baseParameters parameter is null.
+  *@param outputParameters is a blank list into which to put parameters.  Null may be used if the baseParameters parameter is null.
   *@param baseQuery is the base query, which is another SELECT statement, without parens,
   * e.g. "SELECT ..."
   *@param baseParameters are the parameters corresponding to the baseQuery.
   *@param distinctFields are the fields to consider to be distinct.  These should all be keys in otherFields below.
   *@param otherFields are the rest of the fields to return, keyed by the AS name, value being the base query column value, e.g. "value AS key"
-  *@return a revised query that performs the necessary DISTINCT ON operation.  The arraylist outputParameters will also be appropriately filled in.
+  *@return a revised query that performs the necessary DISTINCT ON operation.  The list outputParameters will also be appropriately filled in.
   */
-  public String constructDistinctOnClause(ArrayList outputParameters, String baseQuery, ArrayList baseParameters, String[] distinctFields, Map otherFields)
+  public String constructDistinctOnClause(List outputParameters, String baseQuery, List baseParameters,
+    String[] distinctFields, Map<String,String> otherFields)
   {
     // HSQLDB does not really support this functionality.
     // We could hack a workaround, along the following lines:
@@ -912,11 +915,11 @@ public class DBInterfaceHSQLDB extends D
 
     StringBuilder sb = new StringBuilder("SELECT ");
     boolean needComma = false;
-    Iterator iter = otherFields.keySet().iterator();
+    Iterator<String> iter = otherFields.keySet().iterator();
     while (iter.hasNext())
     {
-      String fieldName = (String)iter.next();
-      String columnValue = (String)otherFields.get(fieldName);
+      String fieldName = iter.next();
+      String columnValue = otherFields.get(fieldName);
       if (needComma)
         sb.append(",");
       needComma = true;

Modified: incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java?rev=1129397&r1=1129396&r2=1129397&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java (original)
+++ incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfaceMySQL.java Mon May 30 22:00:05 2011
@@ -79,10 +79,10 @@ public class DBInterfaceMySQL extends Da
   * invalidated.
   *@param parameterMap is the map of column name/values to write.
   */
-  public void performInsert(String tableName, Map parameterMap, StringSet invalidateKeys)
+  public void performInsert(String tableName, Map<String,Object> parameterMap, StringSet invalidateKeys)
     throws ManifoldCFException
   {
-    ArrayList paramArray = new ArrayList();
+    List paramArray = new ArrayList();
 
     StringBuilder bf = new StringBuilder();
     bf.append("INSERT INTO ");
@@ -92,12 +92,12 @@ public class DBInterfaceMySQL extends Da
     StringBuilder values = new StringBuilder(" VALUES (");
 
     // loop for cols
-    Iterator it = parameterMap.entrySet().iterator();
+    Iterator<Map.Entry<String,Object>> it = parameterMap.entrySet().iterator();
     boolean first = true;
     while (it.hasNext())
     {
-      Map.Entry e = (Map.Entry)it.next();
-      String key = (String)e.getKey();
+      Map.Entry<String,Object> e = it.next();
+      String key = e.getKey();
 
       Object o = e.getValue();
       if (o != null)
@@ -132,10 +132,11 @@ public class DBInterfaceMySQL extends Da
   *@param whereClause is the where clause describing the match (including the WHERE), or null if none.
   *@param whereParameters are the parameters that come with the where clause, if any.
   */
-  public void performUpdate(String tableName, Map parameterMap, String whereClause, ArrayList whereParameters, StringSet invalidateKeys)
+  public void performUpdate(String tableName, Map<String,Object> parameterMap, String whereClause,
+    List whereParameters, StringSet invalidateKeys)
     throws ManifoldCFException
   {
-    ArrayList paramArray = new ArrayList();
+    List paramArray = new ArrayList();
 
     StringBuilder bf = new StringBuilder();
     bf.append("UPDATE ");
@@ -143,12 +144,12 @@ public class DBInterfaceMySQL extends Da
     bf.append(" SET ") ;
 
     // loop for parameters
-    Iterator it = parameterMap.entrySet().iterator();
+    Iterator<Map.Entry<String,Object>> it = parameterMap.entrySet().iterator();
     boolean first = true;
     while (it.hasNext())
     {
-      Map.Entry e = (Map.Entry)it.next();
-      String key = (String)e.getKey();
+      Map.Entry<String,Object> e = it.next();
+      String key = e.getKey();
 
       Object o = e.getValue();
 
@@ -197,7 +198,7 @@ public class DBInterfaceMySQL extends Da
   *@param whereClause is the where clause describing the match (including the WHERE), or null if none.
   *@param whereParameters are the parameters that come with the where clause, if any.
   */
-  public void performDelete(String tableName, String whereClause, ArrayList whereParameters, StringSet invalidateKeys)
+  public void performDelete(String tableName, String whereClause, List whereParameters, StringSet invalidateKeys)
     throws ManifoldCFException
   {
     StringBuilder bf = new StringBuilder();
@@ -223,18 +224,18 @@ public class DBInterfaceMySQL extends Da
   * layer.
   *@param invalidateKeys are the cache keys that should be invalidated, if any.
   */
-  public void performCreate(String tableName, Map columnMap, StringSet invalidateKeys)
+  public void performCreate(String tableName, Map<String,ColumnDescription> columnMap, StringSet invalidateKeys)
     throws ManifoldCFException
   {
     StringBuilder queryBuffer = new StringBuilder("CREATE TABLE ");
     queryBuffer.append(tableName);
     queryBuffer.append('(');
-    Iterator iter = columnMap.keySet().iterator();
+    Iterator<String> iter = columnMap.keySet().iterator();
     boolean first = true;
     while (iter.hasNext())
     {
-      String columnName = (String)iter.next();
-      ColumnDescription cd = (ColumnDescription)columnMap.get(columnName);
+      String columnName = iter.next();
+      ColumnDescription cd = columnMap.get(columnName);
       if (!first)
         queryBuffer.append(',');
       else
@@ -277,7 +278,8 @@ public class DBInterfaceMySQL extends Da
   *@param columnDeleteList is the list of column names to delete.
   *@param invalidateKeys are the cache keys that should be invalidated, if any.
   */
-  public void performAlter(String tableName, Map columnMap, Map columnModifyMap, ArrayList columnDeleteList,
+  public void performAlter(String tableName, Map<String,ColumnDescription> columnMap,
+    Map<String,ColumnDescription> columnModifyMap, List<String> columnDeleteList,
     StringSet invalidateKeys)
     throws ManifoldCFException
   {
@@ -290,14 +292,14 @@ public class DBInterfaceMySQL extends Da
   *@param columnList is the list of columns that need to be included
   * in the index, in order.
   */
-  public void addTableIndex(String tableName, boolean unique, ArrayList columnList)
+  public void addTableIndex(String tableName, boolean unique, List<String> columnList)
     throws ManifoldCFException
   {
     String[] columns = new String[columnList.size()];
     int i = 0;
     while (i < columns.length)
     {
-      columns[i] = (String)columnList.get(i);
+      columns[i] = columnList.get(i);
       i++;
     }
     performAddIndex(null,tableName,new IndexDescription(unique,columns));
@@ -387,7 +389,7 @@ public class DBInterfaceMySQL extends Da
   {
     // Connect to super database
     Database masterDatabase = new Database(context,_url+"mysql",_driver,"mysql",adminUserName,adminPassword);
-    ArrayList list = new ArrayList();
+    List list = new ArrayList();
     list.add("utf8");
     masterDatabase.executeQuery("CREATE DATABASE "+databaseName+" CHARACTER SET ?",list,
       null,invalidateKeys,null,false,0,null,null);
@@ -420,7 +422,7 @@ public class DBInterfaceMySQL extends Da
   *@param params are the parameterized values, if needed.
   *@param invalidateKeys are the cache keys to invalidate.
   */
-  public void performModification(String query, ArrayList params, StringSet invalidateKeys)
+  public void performModification(String query, List params, StringSet invalidateKeys)
     throws ManifoldCFException
   {
     executeQuery(query,params,null,invalidateKeys,null,false,0,null,null);
@@ -432,12 +434,12 @@ public class DBInterfaceMySQL extends Da
   *@param queryClass is the name of the query class, or null.
   *@return a map of column names and ColumnDescription objects, describing the schema.
   */
-  public Map getTableSchema(String tableName, StringSet cacheKeys, String queryClass)
+  public Map<String,ColumnDescription> getTableSchema(String tableName, StringSet cacheKeys, String queryClass)
     throws ManifoldCFException
   {
     IResultSet set = performQuery("DESCRIBE "+tableName,null,cacheKeys,queryClass);
     // Digest the result
-    HashMap rval = new HashMap();
+    Map<String,ColumnDescription> rval = new HashMap<String,ColumnDescription>();
     int i = 0;
     while (i < set.getRowCount())
     {
@@ -458,7 +460,7 @@ public class DBInterfaceMySQL extends Da
   *@param queryClass is the name of the query class, or null.
   *@return a map of index names and IndexDescription objects, describing the indexes.
   */
-  public Map getTableIndexes(String tableName, StringSet cacheKeys, String queryClass)
+  public Map<String,IndexDescription> getTableIndexes(String tableName, StringSet cacheKeys, String queryClass)
     throws ManifoldCFException
   {
     // MHL
@@ -499,7 +501,7 @@ public class DBInterfaceMySQL extends Da
   * or null if no LRU behavior desired.
   *@return a resultset.
   */
-  public IResultSet performQuery(String query, ArrayList params, StringSet cacheKeys, String queryClass)
+  public IResultSet performQuery(String query, List params, StringSet cacheKeys, String queryClass)
     throws ManifoldCFException
   {
     return executeQuery(query,params,cacheKeys,null,queryClass,true,-1,null,null);
@@ -515,7 +517,7 @@ public class DBInterfaceMySQL extends Da
   *@param returnLimit is a description of how to limit the return result, or null if no limit.
   *@return a resultset.
   */
-  public IResultSet performQuery(String query, ArrayList params, StringSet cacheKeys, String queryClass,
+  public IResultSet performQuery(String query, List params, StringSet cacheKeys, String queryClass,
     int maxResults, ILimitChecker returnLimit)
     throws ManifoldCFException
   {
@@ -533,7 +535,7 @@ public class DBInterfaceMySQL extends Da
   *@param returnLimit is a description of how to limit the return result, or null if no limit.
   *@return a resultset.
   */
-  public IResultSet performQuery(String query, ArrayList params, StringSet cacheKeys, String queryClass,
+  public IResultSet performQuery(String query, List params, StringSet cacheKeys, String queryClass,
     int maxResults, ResultSpecification resultSpec, ILimitChecker returnLimit)
     throws ManifoldCFException
   {
@@ -591,15 +593,16 @@ public class DBInterfaceMySQL extends Da
   * This filter wraps a query and returns a new query whose results are similar to POSTGRESQL's DISTINCT-ON feature.
   * Specifically, for each combination of the specified distinct fields in the result, only the first such row is included in the final
   * result.
-  *@param outputParameters is a blank arraylist into which to put parameters.  Null may be used if the baseParameters parameter is null.
+  *@param outputParameters is a blank list into which to put parameters.  Null may be used if the baseParameters parameter is null.
   *@param baseQuery is the base query, which is another SELECT statement, without parens,
   * e.g. "SELECT ..."
   *@param baseParameters are the parameters corresponding to the baseQuery.
   *@param distinctFields are the fields to consider to be distinct.  These should all be keys in otherFields below.
   *@param otherFields are the rest of the fields to return, keyed by the AS name, value being the base query column value, e.g. "value AS key"
-  *@return a revised query that performs the necessary DISTINCT ON operation.  The arraylist outputParameters will also be appropriately filled in.
+  *@return a revised query that performs the necessary DISTINCT ON operation.  The list outputParameters will also be appropriately filled in.
   */
-  public String constructDistinctOnClause(ArrayList outputParameters, String baseQuery, ArrayList baseParameters, String[] distinctFields, Map otherFields)
+  public String constructDistinctOnClause(List outputParameters, String baseQuery, List baseParameters,
+    String[] distinctFields, Map<String,String> otherFields)
   {
     // I don't know whether MySql supports this functionality or not.
     // MHL
@@ -609,11 +612,11 @@ public class DBInterfaceMySQL extends Da
 
     StringBuilder sb = new StringBuilder("SELECT ");
     boolean needComma = false;
-    Iterator iter = otherFields.keySet().iterator();
+    Iterator<String> iter = otherFields.keySet().iterator();
     while (iter.hasNext())
     {
-      String fieldName = (String)iter.next();
-      String columnValue = (String)otherFields.get(fieldName);
+      String fieldName = iter.next();
+      String columnValue = otherFields.get(fieldName);
       if (needComma)
         sb.append(",");
       needComma = true;

Modified: incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java?rev=1129397&r1=1129396&r2=1129397&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java (original)
+++ incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/DBInterfacePostgreSQL.java Mon May 30 22:00:05 2011
@@ -48,22 +48,22 @@ public class DBInterfacePostgreSQL exten
   protected int serializableDepth = 0;
 
   // This is where we keep track of tables that we need to analyze on transaction exit
-  protected ArrayList tablesToAnalyze = new ArrayList();
+  protected List<String> tablesToAnalyze = new ArrayList<String>();
 
   // Keep track of tables to reindex on transaction exit
-  protected ArrayList tablesToReindex = new ArrayList();
+  protected List<String> tablesToReindex = new ArrayList<String>();
 
   // This is where we keep temporary table statistics, which accumulate until they reach a threshold, and then are added into shared memory.
   
   /** Accumulated reindex statistics.  This map is keyed by the table name, and contains TableStatistics values. */
-  protected static Map currentReindexStatistics = new HashMap();
+  protected static Map<String,TableStatistics> currentReindexStatistics = new HashMap<String,TableStatistics>();
   /** Table reindex thresholds, as read from configuration information.  Keyed by table name, contains Integer values. */
-  protected static Map reindexThresholds = new HashMap();
+  protected static Map<String,Integer> reindexThresholds = new HashMap<String,Integer>();
   
   /** Accumulated analyze statistics.  This map is keyed by the table name, and contains TableStatistics values. */
-  protected static Map currentAnalyzeStatistics = new HashMap();
+  protected static Map<String,TableStatistics> currentAnalyzeStatistics = new HashMap<String,TableStatistics>();
   /** Table analyze thresholds, as read from configuration information.  Keyed by table name, contains Integer values. */
-  protected static Map analyzeThresholds = new HashMap();
+  protected static Map<String,Integer> analyzeThresholds = new HashMap<String,Integer>();
   
   /** The number of inserts, deletes, etc. before we update the shared area. */
   protected static final int commitThreshold = 100;
@@ -146,10 +146,10 @@ public class DBInterfacePostgreSQL exten
   * invalidated.
   *@param parameterMap is the map of column name/values to write.
   */
-  public void performInsert(String tableName, Map parameterMap, StringSet invalidateKeys)
+  public void performInsert(String tableName, Map<String,Object> parameterMap, StringSet invalidateKeys)
     throws ManifoldCFException
   {
-    ArrayList paramArray = new ArrayList();
+    List paramArray = new ArrayList();
 
     StringBuilder bf = new StringBuilder();
     bf.append("INSERT INTO ");
@@ -159,12 +159,12 @@ public class DBInterfacePostgreSQL exten
     StringBuilder values = new StringBuilder(" VALUES (");
 
     // loop for cols
-    Iterator it = parameterMap.entrySet().iterator();
+    Iterator<Map.Entry<String,Object>> it = parameterMap.entrySet().iterator();
     boolean first = true;
     while (it.hasNext())
     {
-      Map.Entry e = (Map.Entry)it.next();
-      String key = (String)e.getKey();
+      Map.Entry<String,Object> e = it.next();
+      String key = e.getKey();
 
       Object o = e.getValue();
       if (o != null)
@@ -199,10 +199,11 @@ public class DBInterfacePostgreSQL exten
   *@param whereClause is the where clause describing the match (including the WHERE), or null if none.
   *@param whereParameters are the parameters that come with the where clause, if any.
   */
-  public void performUpdate(String tableName, Map parameterMap, String whereClause, ArrayList whereParameters, StringSet invalidateKeys)
+  public void performUpdate(String tableName, Map<String,Object> parameterMap, String whereClause,
+    List whereParameters, StringSet invalidateKeys)
     throws ManifoldCFException
   {
-    ArrayList paramArray = new ArrayList();
+    List paramArray = new ArrayList();
 
     StringBuilder bf = new StringBuilder();
     bf.append("UPDATE ");
@@ -210,12 +211,12 @@ public class DBInterfacePostgreSQL exten
     bf.append(" SET ") ;
 
     // loop for parameters
-    Iterator it = parameterMap.entrySet().iterator();
+    Iterator<Map.Entry<String,Object>> it = parameterMap.entrySet().iterator();
     boolean first = true;
     while (it.hasNext())
     {
-      Map.Entry e = (Map.Entry)it.next();
-      String key = (String)e.getKey();
+      Map.Entry<String,Object> e = it.next();
+      String key = e.getKey();
 
       Object o = e.getValue();
 
@@ -264,7 +265,7 @@ public class DBInterfacePostgreSQL exten
   *@param whereClause is the where clause describing the match (including the WHERE), or null if none.
   *@param whereParameters are the parameters that come with the where clause, if any.
   */
-  public void performDelete(String tableName, String whereClause, ArrayList whereParameters, StringSet invalidateKeys)
+  public void performDelete(String tableName, String whereClause, List whereParameters, StringSet invalidateKeys)
     throws ManifoldCFException
   {
     StringBuilder bf = new StringBuilder();
@@ -290,18 +291,18 @@ public class DBInterfacePostgreSQL exten
   * layer.
   *@param invalidateKeys are the cache keys that should be invalidated, if any.
   */
-  public void performCreate(String tableName, Map columnMap, StringSet invalidateKeys)
+  public void performCreate(String tableName, Map<String,ColumnDescription> columnMap, StringSet invalidateKeys)
     throws ManifoldCFException
   {
     StringBuilder queryBuffer = new StringBuilder("CREATE TABLE ");
     queryBuffer.append(tableName);
     queryBuffer.append('(');
-    Iterator iter = columnMap.keySet().iterator();
+    Iterator<String> iter = columnMap.keySet().iterator();
     boolean first = true;
     while (iter.hasNext())
     {
-      String columnName = (String)iter.next();
-      ColumnDescription cd = (ColumnDescription)columnMap.get(columnName);
+      String columnName = iter.next();
+      ColumnDescription cd = columnMap.get(columnName);
       if (!first)
         queryBuffer.append(',');
       else
@@ -349,7 +350,8 @@ public class DBInterfacePostgreSQL exten
   *@param columnDeleteList is the list of column names to delete.
   *@param invalidateKeys are the cache keys that should be invalidated, if any.
   */
-  public void performAlter(String tableName, Map columnMap, Map columnModifyMap, ArrayList columnDeleteList,
+  public void performAlter(String tableName, Map<String,ColumnDescription> columnMap,
+    Map<String,ColumnDescription> columnModifyMap, List<String> columnDeleteList,
     StringSet invalidateKeys)
     throws ManifoldCFException
   {
@@ -361,7 +363,7 @@ public class DBInterfacePostgreSQL exten
         int i = 0;
         while (i < columnDeleteList.size())
         {
-          String columnName = (String)columnDeleteList.get(i++);
+          String columnName = columnDeleteList.get(i++);
           performModification("ALTER TABLE ONLY "+tableName+" DROP "+columnName,null,invalidateKeys);
         }
       }
@@ -369,11 +371,11 @@ public class DBInterfacePostgreSQL exten
       // Do the modifies.  This involves renaming each column to a temp column, then creating a new one, then copying
       if (columnModifyMap != null)
       {
-        Iterator iter = columnModifyMap.keySet().iterator();
+        Iterator<String> iter = columnModifyMap.keySet().iterator();
         while (iter.hasNext())
         {
-          String columnName = (String)iter.next();
-          ColumnDescription cd = (ColumnDescription)columnModifyMap.get(columnName);
+          String columnName = iter.next();
+          ColumnDescription cd = columnModifyMap.get(columnName);
           String renameColumn = "__temp__";
           // Rename current column
           performModification("ALTER TABLE ONLY "+tableName+" RENAME "+columnName+" TO "+renameColumn,null,invalidateKeys);
@@ -394,11 +396,11 @@ public class DBInterfacePostgreSQL exten
       // Now, do the adds
       if (columnMap != null)
       {
-        Iterator iter = columnMap.keySet().iterator();
+        Iterator<String> iter = columnMap.keySet().iterator();
         while (iter.hasNext())
         {
-          String columnName = (String)iter.next();
-          ColumnDescription cd = (ColumnDescription)columnMap.get(columnName);
+          String columnName = iter.next();
+          ColumnDescription cd = columnMap.get(columnName);
           StringBuilder sb = new StringBuilder();
           appendDescription(sb,columnName,cd,false);
           performModification("ALTER TABLE ONLY "+tableName+" ADD "+sb.toString(),null,invalidateKeys);
@@ -442,14 +444,14 @@ public class DBInterfacePostgreSQL exten
   *@param columnList is the list of columns that need to be included
   * in the index, in order.
   */
-  public void addTableIndex(String tableName, boolean unique, ArrayList columnList)
+  public void addTableIndex(String tableName, boolean unique, List<String> columnList)
     throws ManifoldCFException
   {
     String[] columns = new String[columnList.size()];
     int i = 0;
     while (i < columns.length)
     {
-      columns[i] = (String)columnList.get(i);
+      columns[i] = columnList.get(i);
       i++;
     }
     performAddIndex(null,tableName,new IndexDescription(unique,columns));
@@ -525,7 +527,7 @@ public class DBInterfacePostgreSQL exten
     try
     {
       // Create user
-      ArrayList params = new ArrayList();
+      List params = new ArrayList();
       params.add(userName);
       IResultSet set = masterDatabase.executeQuery("SELECT * FROM pg_user WHERE usename=?",params,
         null,null,null,true,-1,null,null);
@@ -629,7 +631,7 @@ public class DBInterfacePostgreSQL exten
   *@param params are the parameterized values, if needed.
   *@param invalidateKeys are the cache keys to invalidate.
   */
-  public void performModification(String query, ArrayList params, StringSet invalidateKeys)
+  public void performModification(String query, List params, StringSet invalidateKeys)
     throws ManifoldCFException
   {
     try
@@ -649,11 +651,11 @@ public class DBInterfacePostgreSQL exten
   *@return a map of column names and ColumnDescription objects, describing the schema, or null if the
   * table doesn't exist.
   */
-  public Map getTableSchema(String tableName, StringSet cacheKeys, String queryClass)
+  public Map<String,ColumnDescription> getTableSchema(String tableName, StringSet cacheKeys, String queryClass)
     throws ManifoldCFException
   {
     StringBuilder query = new StringBuilder();
-    ArrayList list = new ArrayList();
+    List list = new ArrayList();
     query.append("SELECT pg_attribute.attname AS \"Field\",");
     query.append("CASE pg_type.typname WHEN 'int2' THEN 'smallint' WHEN 'int4' THEN 'int'");
     query.append(" WHEN 'int8' THEN 'bigint' WHEN 'varchar' THEN 'varchar(' || pg_attribute.atttypmod-4 || ')'");
@@ -672,7 +674,7 @@ public class DBInterfacePostgreSQL exten
     if (set.getRowCount() == 0)
       return null;
     // Digest the result
-    HashMap rval = new HashMap();
+    Map<String,ColumnDescription> rval = new HashMap<String,ColumnDescription>();
     int i = 0;
     while (i < set.getRowCount())
     {
@@ -693,15 +695,15 @@ public class DBInterfacePostgreSQL exten
   *@param queryClass is the name of the query class, or null.
   *@return a map of index names and IndexDescription objects, describing the indexes.
   */
-  public Map getTableIndexes(String tableName, StringSet cacheKeys, String queryClass)
+  public Map<String,IndexDescription> getTableIndexes(String tableName, StringSet cacheKeys, String queryClass)
     throws ManifoldCFException
   {
-    Map rval = new HashMap();
+    Map<String,IndexDescription> rval = new HashMap<String,IndexDescription>();
 
     String query = "SELECT pg_catalog.pg_get_indexdef(i.indexrelid, 0, true) AS indexdef "+
       "FROM pg_catalog.pg_class c, pg_catalog.pg_class c2, pg_catalog.pg_index i "+
       "WHERE c.relname = ? AND c.oid = i.indrelid AND i.indexrelid = c2.oid";
-    ArrayList list = new ArrayList();
+    List list = new ArrayList();
     list.add(tableName);
     
     IResultSet result = performQuery(query,list,cacheKeys,queryClass);
@@ -738,7 +740,7 @@ public class DBInterfacePostgreSQL exten
       if (parenPosition == -1)
         throw new ManifoldCFException("Cannot parse index description: '"+indexdef+"'");
       parsePosition = parenPosition + 1;
-      ArrayList columns = new ArrayList();
+      List<String> columns = new ArrayList<String>();
       while (true)
       {
         int nextIndex = indexdef.indexOf(",",parsePosition);
@@ -762,7 +764,7 @@ public class DBInterfacePostgreSQL exten
       int j = 0;
       while (j < columnNames.length)
       {
-        columnNames[j] = (String)columns.get(j);
+        columnNames[j] = columns.get(j);
         j++;
       }
       rval.put(indexName,new IndexDescription(isUnique,columnNames));
@@ -801,7 +803,7 @@ public class DBInterfacePostgreSQL exten
   * or null if no LRU behavior desired.
   *@return a resultset.
   */
-  public IResultSet performQuery(String query, ArrayList params, StringSet cacheKeys, String queryClass)
+  public IResultSet performQuery(String query, List params, StringSet cacheKeys, String queryClass)
     throws ManifoldCFException
   {
     try
@@ -824,7 +826,7 @@ public class DBInterfacePostgreSQL exten
   *@param returnLimit is a description of how to limit the return result, or null if no limit.
   *@return a resultset.
   */
-  public IResultSet performQuery(String query, ArrayList params, StringSet cacheKeys, String queryClass,
+  public IResultSet performQuery(String query, List params, StringSet cacheKeys, String queryClass,
     int maxResults, ILimitChecker returnLimit)
     throws ManifoldCFException
   {
@@ -849,7 +851,7 @@ public class DBInterfacePostgreSQL exten
   *@param returnLimit is a description of how to limit the return result, or null if no limit.
   *@return a resultset.
   */
-  public IResultSet performQuery(String query, ArrayList params, StringSet cacheKeys, String queryClass,
+  public IResultSet performQuery(String query, List params, StringSet cacheKeys, String queryClass,
     int maxResults, ResultSpecification resultSpec, ILimitChecker returnLimit)
     throws ManifoldCFException
   {
@@ -924,15 +926,16 @@ public class DBInterfacePostgreSQL exten
   * This filter wraps a query and returns a new query whose results are similar to POSTGRESQL's DISTINCT-ON feature.
   * Specifically, for each combination of the specified distinct fields in the result, only the first such row is included in the final
   * result.
-  *@param outputParameters is a blank arraylist into which to put parameters.  Null may be used if the baseParameters parameter is null.
+  *@param outputParameters is a blank list into which to put parameters.  Null may be used if the baseParameters parameter is null.
   *@param baseQuery is the base query, which is another SELECT statement, without parens,
   * e.g. "SELECT ..."
   *@param baseParameters are the parameters corresponding to the baseQuery.
   *@param distinctFields are the fields to consider to be distinct.  These should all be keys in otherFields below.
   *@param otherFields are the rest of the fields to return, keyed by the AS name, value being the base query column value, e.g. "value AS key"
-  *@return a revised query that performs the necessary DISTINCT ON operation.  The arraylist outputParameters will also be appropriately filled in.
+  *@return a revised query that performs the necessary DISTINCT ON operation.  The list outputParameters will also be appropriately filled in.
   */
-  public String constructDistinctOnClause(ArrayList outputParameters, String baseQuery, ArrayList baseParameters, String[] distinctFields, Map otherFields)
+  public String constructDistinctOnClause(List outputParameters, String baseQuery, List baseParameters,
+    String[] distinctFields, Map<String,String> otherFields)
   {
     // Copy arguments
     if (baseParameters != null)
@@ -947,12 +950,12 @@ public class DBInterfacePostgreSQL exten
       sb.append(distinctFields[i++]);
     }
     sb.append(") ");
-    Iterator iter = otherFields.keySet().iterator();
+    Iterator<String> iter = otherFields.keySet().iterator();
     boolean needComma = false;
     while (iter.hasNext())
     {
-      String fieldName = (String)iter.next();
-      String columnValue = (String)otherFields.get(fieldName);
+      String fieldName = iter.next();
+      String columnValue = otherFields.get(fieldName);
       if (needComma)
         sb.append(",");
       needComma = true;
@@ -1075,13 +1078,13 @@ public class DBInterfacePostgreSQL exten
       int i = 0;
       while (i < tablesToAnalyze.size())
       {
-        analyzeTableInternal((String)tablesToAnalyze.get(i++));
+        analyzeTableInternal(tablesToAnalyze.get(i++));
       }
       tablesToAnalyze.clear();
       i = 0;
       while (i < tablesToReindex.size())
       {
-        reindexTableInternal((String)tablesToReindex.get(i++));
+        reindexTableInternal(tablesToReindex.get(i++));
       }
       tablesToReindex.clear();
     }
@@ -1109,7 +1112,7 @@ public class DBInterfacePostgreSQL exten
   }
   
   /** Abstract method for explaining a query */
-  protected void explainQuery(String query, ArrayList params)
+  protected void explainQuery(String query, List params)
     throws ManifoldCFException
   {
     IResultSet x = executeUncachedQuery("EXPLAIN "+query,params,true,
@@ -1118,7 +1121,7 @@ public class DBInterfacePostgreSQL exten
     while (k < x.getRowCount())
     {
       IResultRow row = x.getRow(k++);
-      Iterator iter = row.getColumns();
+      Iterator<String> iter = row.getColumns();
       String colName = (String)iter.next();
       Logging.db.warn(" Plan: "+row.getValue(colName).toString());
     }
@@ -1161,7 +1164,7 @@ public class DBInterfacePostgreSQL exten
     lockManager.enterWriteCriticalSection(tableStatisticsLock);
     try
     {
-      TableStatistics ts = (TableStatistics)currentAnalyzeStatistics.get(tableName);
+      TableStatistics ts = currentAnalyzeStatistics.get(tableName);
       // Lock this table's statistics files
       lockManager.enterWriteLock(tableStatisticsLock);
       try
@@ -1198,7 +1201,7 @@ public class DBInterfacePostgreSQL exten
     lockManager.enterWriteCriticalSection(tableStatisticsLock);
     try
     {
-      TableStatistics ts = (TableStatistics)currentReindexStatistics.get(tableName);
+      TableStatistics ts = currentReindexStatistics.get(tableName);
       // Lock this table's statistics files
       lockManager.enterWriteLock(tableStatisticsLock);
       try
@@ -1282,7 +1285,7 @@ public class DBInterfacePostgreSQL exten
     lockManager.enterWriteCriticalSection(tableStatisticsLock);
     try
     {
-      Integer threshold = (Integer)reindexThresholds.get(tableName);
+      Integer threshold = reindexThresholds.get(tableName);
       int reindexThreshold;
       if (threshold == null)
       {
@@ -1293,7 +1296,7 @@ public class DBInterfacePostgreSQL exten
       else
         reindexThreshold = threshold.intValue();
       
-      TableStatistics ts = (TableStatistics)currentReindexStatistics.get(tableName);
+      TableStatistics ts = currentReindexStatistics.get(tableName);
       if (ts == null)
       {
         ts = new TableStatistics();
@@ -1339,7 +1342,7 @@ public class DBInterfacePostgreSQL exten
     lockManager.enterWriteCriticalSection(tableStatisticsLock);
     try
     {
-      Integer threshold = (Integer)analyzeThresholds.get(tableName);
+      Integer threshold = analyzeThresholds.get(tableName);
       int analyzeThreshold;
       if (threshold == null)
       {
@@ -1350,7 +1353,7 @@ public class DBInterfacePostgreSQL exten
       else
         analyzeThreshold = threshold.intValue();
       
-      TableStatistics ts = (TableStatistics)currentAnalyzeStatistics.get(tableName);
+      TableStatistics ts = currentAnalyzeStatistics.get(tableName);
       if (ts == null)
       {
         ts = new TableStatistics();

Modified: incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/Database.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/Database.java?rev=1129397&r1=1129396&r2=1129397&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/Database.java (original)
+++ incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/Database.java Mon May 30 22:00:05 2011
@@ -100,7 +100,7 @@ public class Database
   }
   
   /** Abstract method for explaining a query */
-  protected void explainQuery(String query, ArrayList params)
+  protected void explainQuery(String query, List params)
     throws ManifoldCFException
   {
   }
@@ -137,7 +137,7 @@ public class Database
   *  Pass null if no limits are desired.
   * @return the resultset
   */
-  public IResultSet executeQuery(String query, ArrayList params, StringSet cacheKeys, StringSet invalidateKeys,
+  public IResultSet executeQuery(String query, List params, StringSet cacheKeys, StringSet invalidateKeys,
     String queryClass, boolean needResult, int maxReturn, ResultSpecification spec, ILimitChecker returnLimits)
     throws ManifoldCFException
   {
@@ -391,7 +391,7 @@ public class Database
   {
     protected Connection connection;
     protected String query;
-    protected ArrayList params;
+    protected List params;
     protected boolean bResults;
     protected int maxResults;
     protected ResultSpecification spec;
@@ -399,7 +399,7 @@ public class Database
     protected Throwable exception = null;
     protected IResultSet rval = null;
 
-    public ExecuteQueryThread(Connection connection, String query, ArrayList params, boolean bResults, int maxResults,
+    public ExecuteQueryThread(Connection connection, String query, List params, boolean bResults, int maxResults,
       ResultSpecification spec, ILimitChecker returnLimit)
     {
       super();
@@ -438,7 +438,7 @@ public class Database
   }
 
   /** Do query execution via a subthread, so the primary thread can be interrupted */
-  protected IResultSet executeViaThread(Connection connection, String query, ArrayList params, boolean bResults, int maxResults,
+  protected IResultSet executeViaThread(Connection connection, String query, List params, boolean bResults, int maxResults,
     ResultSpecification spec, ILimitChecker returnLimit)
     throws ManifoldCFException
   {
@@ -477,7 +477,7 @@ public class Database
   /** This method does NOT appear in any interface; it is here to
   * service the cache object.
   */
-  protected IResultSet executeUncachedQuery(String query, ArrayList params, boolean bResults, int maxResults,
+  protected IResultSet executeUncachedQuery(String query, List params, boolean bResults, int maxResults,
     ResultSpecification spec, ILimitChecker returnLimit)
     throws ManifoldCFException
   {
@@ -526,9 +526,9 @@ public class Database
   * @param query String the query string
   * @param bResults boolean whether to load the resultset or not
   * @param maxResults is the maximum number of results to load: -1 if all
-  * @param params ArrayList if params !=null, use preparedStatement
+  * @param params List if params !=null, use preparedStatement
   */
-  protected IResultSet execute(Connection connection, String query, ArrayList params, boolean bResults, int maxResults,
+  protected IResultSet execute(Connection connection, String query, List params, boolean bResults, int maxResults,
     ResultSpecification spec, ILimitChecker returnLimit)
     throws ManifoldCFException
   {
@@ -761,7 +761,7 @@ public class Database
   }
 
   // pass params to preparedStatement
-  protected static void loadPS(PreparedStatement ps, ArrayList data)
+  protected static void loadPS(PreparedStatement ps, List data)
     throws java.sql.SQLException, ManifoldCFException
   {
     if (data!=null)
@@ -820,7 +820,7 @@ public class Database
 
   /** Clean up parameters after query has been triggered.
   */
-  protected static void cleanupParameters(ArrayList data)
+  protected static void cleanupParameters(List data)
     throws ManifoldCFException
   {
     if (data != null)

Modified: incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/QueryDescription.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/QueryDescription.java?rev=1129397&r1=1129396&r2=1129397&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/QueryDescription.java (original)
+++ incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/QueryDescription.java Mon May 30 22:00:05 2011
@@ -31,7 +31,7 @@ public class QueryDescription extends or
   // We don't want to hold onto the actual open database handle!
   protected String databaseName;
   protected String query;
-  protected ArrayList parameters;
+  protected List parameters;
   protected String criticalSectionName = null;
   protected String cacheClassName;
   protected StringSet keys;
@@ -39,7 +39,7 @@ public class QueryDescription extends or
   protected ResultSpecification spec;
   protected ILimitChecker returnLimit;
 
-  public QueryDescription(String databaseName, String query, ArrayList parameters,
+  public QueryDescription(String databaseName, String query, List parameters,
     String cacheClassName, StringSet cacheKeys, int maxReturn, ResultSpecification spec,
     ILimitChecker returnLimit)
   {
@@ -49,7 +49,7 @@ public class QueryDescription extends or
     this.parameters = null;
     if (parameters != null)
     {
-      this.parameters = (ArrayList)parameters.clone();
+      this.parameters = listClone(parameters);
     }
     keys = cacheKeys;
     this.maxReturn = maxReturn;
@@ -74,11 +74,11 @@ public class QueryDescription extends or
     return query;
   }
 
-  public ArrayList getParameters()
+  public List getParameters()
   {
     if (parameters == null)
       return null;
-    return (ArrayList)parameters.clone();
+    return listClone(parameters);
   }
 
   public int getMaxReturn()
@@ -216,6 +216,16 @@ public class QueryDescription extends or
     return criticalSectionName;
   }
 
+  protected static List listClone(List list)
+  {
+    List rval = new ArrayList(list.size());
+    for (Object o : list)
+    {
+      rval.add(o);
+    }
+    return rval;
+  }
+  
 }
 
 

Modified: incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/RRow.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/RRow.java?rev=1129397&r1=1129396&r2=1129397&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/RRow.java (original)
+++ incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/RRow.java Mon May 30 22:00:05 2011
@@ -27,7 +27,7 @@ public class RRow implements IResultRow
 {
   public static final String _rcsid = "@(#)$Id: RRow.java 988245 2010-08-23 18:39:35Z kwright $";
 
-  protected Map rowData = new HashMap();
+  protected Map<String,Object> rowData = new HashMap<String,Object>();
 
   public RRow()
   {
@@ -49,7 +49,7 @@ public class RRow implements IResultRow
   /** Obtain the set of columns for a row.
   @return an iterator that will list all the (String) column names stored in that row.
   */
-  public Iterator getColumns()
+  public Iterator<String> getColumns()
   {
     return rowData.keySet().iterator();
   }

Modified: incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/RSet.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/RSet.java?rev=1129397&r1=1129396&r2=1129397&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/RSet.java (original)
+++ incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/database/RSet.java Mon May 30 22:00:05 2011
@@ -26,7 +26,7 @@ public class RSet implements IResultSet
   public static final String _rcsid = "@(#)$Id: RSet.java 988245 2010-08-23 18:39:35Z kwright $";
 
   // Instance of a result
-  protected ArrayList _rows = new ArrayList();
+  protected List<IResultRow> rows = new ArrayList<IResultRow>();
 
   public RSet()
   {
@@ -36,7 +36,7 @@ public class RSet implements IResultSet
   */
   public void addRow(IResultRow m)
   {
-    _rows.add(m);
+    rows.add(m);
   }
 
   /** Get a specific row in the resultset.
@@ -45,7 +45,7 @@ public class RSet implements IResultSet
   */
   public IResultRow getRow(int rowNumber)
   {
-    return (IResultRow)_rows.get(rowNumber);
+    return rows.get(rowNumber);
   }
 
   /** Get the number of rows in this resultset.
@@ -53,7 +53,7 @@ public class RSet implements IResultSet
   */
   public int getRowCount()
   {
-    return _rows.size();
+    return rows.size();
   }
 
   /** Get an array of all the rows.
@@ -63,11 +63,11 @@ public class RSet implements IResultSet
   */
   public IResultRow[] getRows()
   {
-    IResultRow[] rval = new IResultRow[_rows.size()];
+    IResultRow[] rval = new IResultRow[rows.size()];
     int i = 0;
-    while (i < _rows.size())
+    while (i < rows.size())
     {
-      rval[i] = (IResultRow)_rows.get(i);
+      rval[i] = rows.get(i);
       i++;
     }
     return rval;

Modified: incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ConfigParams.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ConfigParams.java?rev=1129397&r1=1129396&r2=1129397&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ConfigParams.java (original)
+++ incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ConfigParams.java Mon May 30 22:00:05 2011
@@ -35,7 +35,7 @@ public class ConfigParams extends Config
   protected final static String ATTR_NAME = "name";
 
   // The parameter map (which stores name/value pairs also listed in the children)
-  protected HashMap params = new HashMap();
+  protected Map<String,String> params = new HashMap<String,String>();
 
   /** Constructor.
   */
@@ -48,14 +48,14 @@ public class ConfigParams extends Config
   *@param map is the initialized (mutable) map describing the name/value configuration parameters.
   * This method of setting up a ConfigParams object will go away when the parameters are all in XML.
   */
-  public ConfigParams(Map map)
+  public ConfigParams(Map<String,String> map)
   {
     super("configuration");
-    Iterator iter = map.keySet().iterator();
+    Iterator<String> iter = map.keySet().iterator();
     while (iter.hasNext())
     {
-      String key = (String)iter.next();
-      String value = (String)map.get(key);
+      String key = iter.next();
+      String value = map.get(key);
       ConfigNode cn = new ConfigNode(PARAMETER_TYPE);
       cn.setAttribute(ATTR_NAME,key);
       cn.setValue(value);
@@ -137,7 +137,7 @@ public class ConfigParams extends Config
   */
   public String getParameter(String key)
   {
-    return (String)params.get(key);
+    return params.get(key);
   }
 
   /** Get an obfuscated parameter value.



Mime
View raw message