Use jakarta feedparser to parse RSS2 files.
[mir.git] / source / mir / producer / ExternalDbProducerNode.java
index 301ed80..3ff4b30 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001-2006 The Mir-coders group
  *
  * This file is part of Mir.
  *
@@ -19,8 +19,6 @@
  *
  * In addition, as a special exception, The Mir-coders gives permission to link
  * the code of this program with  any library licensed under the Apache Software License,
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
- * (or with modified versions of the above that use the same license as the above),
  * and distribute linked combinations including the two.  You must obey the
  * GNU General Public License in all respects for all of the code used other than
  * the above mentioned libraries.  If you modify this file, you may extend this
  */
 package mir.producer;
 
-import mir.util.ExceptionRoutines;
 import mir.util.ParameterExpander;
 
-import java.sql.*;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.Statement;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 public class ExternalDbProducerNode extends ProducerNodeDecorator {
   private String key;
@@ -71,12 +74,13 @@ public class ExternalDbProducerNode extends ProducerNodeDecorator {
       String expandedPassword = ParameterExpander.expandExpression(aProductionContext.getValueSet(), password);
       String expandedQuery = ParameterExpander.expandExpression(aProductionContext.getValueSet(), query);
 
-      if (expandedDriver.equals("postgresql")) {
+      if ("postgresql".equals(expandedDriver)) {
         Class.forName("org.postgresql.Driver");
       }
-      if (expandedDriver.equals("mysql")) {
+      if ("mysql".equals(expandedDriver)) {
         Class.forName("com.mysql.jdbc.Driver");
-      } else {
+      }
+      else {
         throw new Exception("Unsupported DB Driver:" + expandedDriver);
       }
 
@@ -88,13 +92,13 @@ public class ExternalDbProducerNode extends ProducerNodeDecorator {
       ResultSet rs = st.executeQuery(expandedQuery);
       ResultSetMetaData rsmd = rs.getMetaData();
       int numberOfColumns = rsmd.getColumnCount();
-      ArrayList fieldNames = new ArrayList(numberOfColumns);
+      List fieldNames = new ArrayList(numberOfColumns);
       for (int i = 0; i < numberOfColumns; i++) {
         fieldNames.add(rsmd.getColumnName(i + 1));
       }
 
       while (rs.next() && !isAborted(aProductionContext)) {
-        HashMap result = new HashMap();
+        Map result = new HashMap();
         Iterator fields = fieldNames.iterator();
         while (fields.hasNext()) {
           String field = (String) fields.next();