Return-Path: X-Original-To: apmail-incubator-connectors-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-connectors-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 657EE62DF for ; Mon, 30 May 2011 22:00:33 +0000 (UTC) Received: (qmail 8019 invoked by uid 500); 30 May 2011 22:00:33 -0000 Delivered-To: apmail-incubator-connectors-commits-archive@incubator.apache.org Received: (qmail 7981 invoked by uid 500); 30 May 2011 22:00:33 -0000 Mailing-List: contact connectors-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: connectors-dev@incubator.apache.org Delivered-To: mailing list connectors-commits@incubator.apache.org Received: (qmail 7974 invoked by uid 99); 30 May 2011 22:00:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 May 2011 22:00:33 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 May 2011 22:00:28 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 6798923889E7; Mon, 30 May 2011 22:00:06 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1129397 [2/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 -0000 To: connectors-commits@incubator.apache.org From: kwright@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110530220006.6798923889E7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/Configuration.java URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/Configuration.java?rev=1129397&r1=1129396&r2=1129397&view=diff ============================================================================== --- incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/Configuration.java (original) +++ incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/Configuration.java Mon May 30 22:00:05 2011 @@ -41,7 +41,7 @@ public class Configuration implements IH // The root node type protected String rootNodeLabel; // The children - protected ArrayList children = new ArrayList(); + protected List children = new ArrayList(); // Read-only flag protected boolean readOnly = false; @@ -111,7 +111,7 @@ public class Configuration implements IH int i = 0; while (i < children.size()) { - ConfigurationNode child = (ConfigurationNode)children.get(i++); + ConfigurationNode child = children.get(i++); // Duplicate the child ConfigurationNode newChild = child.createDuplicate(readOnly); rval.addChild(rval.getChildCount(),newChild); @@ -130,7 +130,7 @@ public class Configuration implements IH int i = 0; while (i < children.size()) { - ConfigurationNode child = (ConfigurationNode)children.get(i++); + ConfigurationNode child = children.get(i++); child.makeReadOnly(); } } @@ -150,7 +150,7 @@ public class Configuration implements IH int i = 0; while (i < children.size()) { - ConfigurationNode node = (ConfigurationNode)children.get(i++); + ConfigurationNode node = children.get(i++); writeNode(doc,top,node); } @@ -173,8 +173,8 @@ public class Configuration implements IH // same type, which requires us to do an appropriate pass to gather that stuff together. // Since we also need to maintain order, it is essential that we detect the out-of-order condition // properly, and use an alternate representation if we should find it. - Map childMap = new HashMap(); - ArrayList childList = new ArrayList(); + Map> childMap = new HashMap>(); + List childList = new ArrayList(); String lastChildType = null; boolean needAlternate = false; int i = 0; @@ -182,10 +182,10 @@ public class Configuration implements IH { ConfigurationNode child = findChild(i++); String key = child.getType(); - ArrayList list = (ArrayList)childMap.get(key); + List list = childMap.get(key); if (list == null) { - list = new ArrayList(); + list = new ArrayList(); childMap.put(key,list); childList.add(key); } @@ -224,8 +224,8 @@ public class Configuration implements IH int q = 0; while (q < childList.size()) { - String key = (String)childList.get(q++); - ArrayList list = (ArrayList)childMap.get(key); + String key = childList.get(q++); + List list = childMap.get(key); if (list.size() > 1) { // Write the key @@ -235,7 +235,7 @@ public class Configuration implements IH i = 0; while (i < list.size()) { - ConfigurationNode child = (ConfigurationNode)list.get(i++); + ConfigurationNode child = list.get(i++); writeNode(writer,child,false,false); } writer.endArray(); @@ -243,7 +243,7 @@ public class Configuration implements IH else { // Write it as a singleton - writeNode(writer,(ConfigurationNode)list.get(0),true,false); + writeNode(writer,list.get(0),true,false); } } } @@ -334,10 +334,10 @@ public class Configuration implements IH writer.value(value); } - Iterator iter = node.getAttributes(); + Iterator iter = node.getAttributes(); while (iter.hasNext()) { - String attribute = (String)iter.next(); + String attribute = iter.next(); String attrValue = node.getAttributeValue(attribute); writer.key(JSON_ATTRIBUTE+attribute); writer.value(attrValue); @@ -347,8 +347,8 @@ public class Configuration implements IH // same type, which requires us to do an appropriate pass to gather that stuff together. // Since we also need to maintain order, it is essential that we detect the out-of-order condition // properly, and use an alternate representation if we should find it. - Map childMap = new HashMap(); - ArrayList childList = new ArrayList(); + Map> childMap = new HashMap>(); + List childList = new ArrayList(); String lastChildType = null; boolean needAlternate = false; int i = 0; @@ -356,10 +356,10 @@ public class Configuration implements IH { ConfigurationNode child = node.findChild(i++); String key = child.getType(); - ArrayList list = (ArrayList)childMap.get(key); + List list = childMap.get(key); if (list == null) { - list = new ArrayList(); + list = new ArrayList(); childMap.put(key,list); childList.add(key); } @@ -398,8 +398,8 @@ public class Configuration implements IH int q = 0; while (q < childList.size()) { - String key = (String)childList.get(q++); - ArrayList list = (ArrayList)childMap.get(key); + String key = childList.get(q++); + List list = childMap.get(key); if (list.size() > 1) { // Write the key @@ -409,7 +409,7 @@ public class Configuration implements IH i = 0; while (i < list.size()) { - ConfigurationNode child = (ConfigurationNode)list.get(i++); + ConfigurationNode child = list.get(i++); writeNode(writer,child,false,false); } writer.endArray(); @@ -417,7 +417,7 @@ public class Configuration implements IH else { // Write it as a singleton - writeNode(writer,(ConfigurationNode)list.get(0),true,false); + writeNode(writer,list.get(0),true,false); } } } @@ -712,7 +712,7 @@ public class Configuration implements IH */ public ConfigurationNode findChild(int index) { - return (ConfigurationNode)children.get(index); + return children.get(index); } /** Remove child n. @@ -722,7 +722,7 @@ public class Configuration implements IH { if (readOnly) throw new IllegalStateException("Attempt to change read-only object"); - ConfigurationNode node = (ConfigurationNode)children.remove(index); + ConfigurationNode node = children.remove(index); removeOuterNode(node); } Modified: incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ConfigurationNode.java URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ConfigurationNode.java?rev=1129397&r1=1129396&r2=1129397&view=diff ============================================================================== --- incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ConfigurationNode.java (original) +++ incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/ConfigurationNode.java Mon May 30 22:00:05 2011 @@ -28,8 +28,8 @@ public class ConfigurationNode implement public static final String _rcsid = "@(#)$Id: ConfigurationNode.java 988245 2010-08-23 18:39:35Z kwright $"; // Member variables - protected ArrayList children = null; - protected HashMap attributes = null; + protected List children = null; + protected Map attributes = null; protected String type = null; protected String value = null; @@ -52,13 +52,13 @@ public class ConfigurationNode implement this.readOnly = source.readOnly; if (source.attributes != null) { - Iterator iter = source.attributes.keySet().iterator(); + Iterator iter = source.attributes.keySet().iterator(); while (iter.hasNext()) { - String attribute = (String)iter.next(); - String attrValue = (String)source.attributes.get(attribute); + String attribute = iter.next(); + String attrValue = source.attributes.get(attribute); if (this.attributes == null) - this.attributes = new HashMap(); + this.attributes = new HashMap(); this.attributes.put(attribute,attrValue); } } @@ -113,14 +113,14 @@ public class ConfigurationNode implement ConfigurationNode rval = createNewNode(); rval.value = value; if (attributes != null) - rval.attributes = (HashMap)attributes.clone(); + rval.attributes = cloneAttributes(attributes); if (children != null) { - rval.children = new ArrayList(); + rval.children = new ArrayList(); int i = 0; while (i < children.size()) { - ConfigurationNode node = (ConfigurationNode)children.get(i++); + ConfigurationNode node = children.get(i++); rval.children.add(node.createDuplicate(readOnly)); } } @@ -170,7 +170,7 @@ public class ConfigurationNode implement */ public ConfigurationNode findChild(int index) { - return (ConfigurationNode)children.get(index); + return children.get(index); } /** Remove child n. @@ -198,7 +198,7 @@ public class ConfigurationNode implement throw new IllegalStateException("Attempt to change read-only object"); if (children == null) - children = new ArrayList(); + children = new ArrayList(); children.add(index,child); } @@ -241,10 +241,10 @@ public class ConfigurationNode implement /** Iterate over attributes. *@return the attribute iterator. */ - public Iterator getAttributes() + public Iterator getAttributes() { if (attributes == null) - return new HashMap().keySet().iterator(); + return new HashMap().keySet().iterator(); return attributes.keySet().iterator(); } @@ -256,7 +256,7 @@ public class ConfigurationNode implement { if (attributes == null) return null; - return (String)attributes.get(attribute); + return attributes.get(attribute); } /** Calculate a hashcode */ @@ -267,12 +267,12 @@ public class ConfigurationNode implement rval += value.hashCode(); if (attributes != null) { - Iterator iter = attributes.keySet().iterator(); + Iterator iter = attributes.keySet().iterator(); // Make sure this is not sensitive to order! while (iter.hasNext()) { - String key = (String)iter.next(); - String attrValue = (String)attributes.get(key); + String key = iter.next(); + String attrValue = attributes.get(key); rval += key.hashCode() + attrValue.hashCode(); } } @@ -312,12 +312,12 @@ public class ConfigurationNode implement } if (attributes != null && n.attributes != null) { - Iterator iter = attributes.keySet().iterator(); + Iterator iter = attributes.keySet().iterator(); while (iter.hasNext()) { - String key = (String)iter.next(); - String attrValue = (String)attributes.get(key); - String nAttrValue = (String)n.attributes.get(key); + String key = iter.next(); + String attrValue = attributes.get(key); + String nAttrValue = n.attributes.get(key); if (nAttrValue == null || !attrValue.equals(nAttrValue)) return false; } @@ -327,8 +327,8 @@ public class ConfigurationNode implement int i = 0; while (i < children.size()) { - ConfigurationNode child = (ConfigurationNode)children.get(i); - ConfigurationNode nChild = (ConfigurationNode)n.children.get(i); + ConfigurationNode child = children.get(i); + ConfigurationNode nChild = n.children.get(i); if (!child.equals(nChild)) return false; i++; @@ -337,4 +337,15 @@ public class ConfigurationNode implement return true; } + protected static Map cloneAttributes(Map attributes) + { + Map rval = new HashMap(); + Iterator> iter = attributes.entrySet().iterator(); + while (iter.hasNext()) + { + Map.Entry entry = iter.next(); + rval.put(entry.getKey(),entry.getValue()); + } + return rval; + } } Modified: incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IDBInterface.java URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IDBInterface.java?rev=1129397&r1=1129396&r2=1129397&view=diff ============================================================================== --- incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IDBInterface.java (original) +++ incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IDBInterface.java Mon May 30 22:00:05 2011 @@ -78,7 +78,7 @@ public interface IDBInterface * 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 parameterMap, StringSet invalidateKeys) throws ManifoldCFException; /** Perform an update operation. @@ -88,7 +88,8 @@ public interface IDBInterface *@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 parameterMap, String whereClause, + List whereParameters, StringSet invalidateKeys) throws ManifoldCFException; /** Perform a delete operation. @@ -97,7 +98,7 @@ public interface IDBInterface *@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; /** Perform a table creation operation. @@ -107,7 +108,7 @@ public interface IDBInterface * layer. The types are ColumnDefinition objects. *@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 columnMap, StringSet invalidateKeys) throws ManifoldCFException; /** Perform a table alter operation. @@ -120,7 +121,8 @@ public interface IDBInterface *@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 columnMap, + Map columnModifyMap, List columnDeleteList, StringSet invalidateKeys) throws ManifoldCFException; @@ -130,7 +132,7 @@ public interface IDBInterface *@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 columnList) throws ManifoldCFException; /** Add an index to a table. @@ -188,7 +190,7 @@ public interface IDBInterface *@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 getTableSchema(String tableName, StringSet cacheKeys, String queryClass) throws ManifoldCFException; /** Get a table's indexes. @@ -197,7 +199,7 @@ public interface IDBInterface *@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 getTableIndexes(String tableName, StringSet cacheKeys, String queryClass) throws ManifoldCFException; /** Get a database's tables. @@ -213,7 +215,7 @@ public interface IDBInterface *@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; /** Perform a general "data fetch" query. @@ -224,7 +226,7 @@ public interface IDBInterface * 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; /** Perform a general "data fetch" query. @@ -237,7 +239,7 @@ public interface IDBInterface *@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; @@ -252,7 +254,7 @@ public interface IDBInterface *@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; @@ -287,15 +289,16 @@ public interface IDBInterface * 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 otherFields); /** Obtain the maximum number of individual items that should be * present in an IN clause. Exceeding this amount will potentially cause the query performance Modified: incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IResultRow.java URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IResultRow.java?rev=1129397&r1=1129396&r2=1129397&view=diff ============================================================================== --- incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IResultRow.java (original) +++ incubator/lcf/branches/CONNECTORS-203/framework/core/src/main/java/org/apache/manifoldcf/core/interfaces/IResultRow.java Mon May 30 22:00:05 2011 @@ -34,7 +34,7 @@ public interface 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 getColumns(); /** Get the row value for a column. *@param columnName is the name of the column.