You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nutch.apache.org by cu...@apache.org on 2005/09/19 08:08:28 UTC

svn commit: r290067 - in /lucene/nutch/branches/mapred/src/java/org/apache/nutch: mapred/InputFormatBase.java util/NutchConf.java

Author: cutting
Date: Sun Sep 18 23:08:19 2005
New Revision: 290067

URL: http://svn.apache.org/viewcvs?rev=290067&view=rev
Log:
Improved error string & javadoc.  Contributed by Paul Baclace.

Modified:
    lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/InputFormatBase.java
    lucene/nutch/branches/mapred/src/java/org/apache/nutch/util/NutchConf.java

Modified: lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/InputFormatBase.java
URL: http://svn.apache.org/viewcvs/lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/InputFormatBase.java?rev=290067&r1=290066&r2=290067&view=diff
==============================================================================
--- lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/InputFormatBase.java (original)
+++ lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/InputFormatBase.java Sun Sep 18 23:08:19 2005
@@ -46,8 +46,17 @@
                                                Reporter reporter)
     throws IOException;
 
-  /** Subclasses may override to, e.g., select only files matching a regular
-   * expression.*/ 
+  /** List input directories.
+   * Subclasses may override to, e.g., select only files matching a regular
+   * expression.
+   * Property mapred.input.subdir, if set, names a subdirectory that
+   * is appended to all input dirs specified by job, and if the given fs
+   * lists those too, each is added to the returned array of File.
+   * @param fs
+   * @param job
+   * @return array of File objects, never zero length.
+   * @throws IOException if zero items.
+   */
   protected File[] listFiles(NutchFileSystem fs, JobConf job)
     throws IOException {
     File[] dirs = job.getInputDirs();
@@ -73,7 +82,7 @@
     }
 
     if (result.size() == 0) {
-      throw new IOException("No input files in: "+job.getInputDirs());
+      throw new IOException("No input directories specified in: "+job);
     }
     return (File[])result.toArray(new File[result.size()]);
   }

Modified: lucene/nutch/branches/mapred/src/java/org/apache/nutch/util/NutchConf.java
URL: http://svn.apache.org/viewcvs/lucene/nutch/branches/mapred/src/java/org/apache/nutch/util/NutchConf.java?rev=290067&r1=290066&r2=290067&view=diff
==============================================================================
--- lucene/nutch/branches/mapred/src/java/org/apache/nutch/util/NutchConf.java (original)
+++ lucene/nutch/branches/mapred/src/java/org/apache/nutch/util/NutchConf.java Sun Sep 18 23:08:19 2005
@@ -30,14 +30,17 @@
 import javax.xml.transform.stream.StreamResult;
 
 /** Provides access to Nutch configuration parameters.
- *
+ * <p>An ordered list of configuration parameter files with
+ * default and always-overrides site parameters.
  * <p>Default values for all parameters are specified in a file named
  * <tt>nutch-default.xml</tt> located on the classpath.  Overrides for these
  * defaults should be in an optional file named <tt>nutch-site.xml</tt>, also
  * located on the classpath.  Typically these files reside in the
  * <tt>conf/</tt> subdirectory at the top-level of a Nutch installation.
+ * <p>The resource files are read upon first access of values (set, get,
+ * or write) after {@link #addConfResource(String)} or
+ * {@link #addConfResource(File)}.
  */
-    
 public class NutchConf {
   private static final Logger LOG =
     LogFormatter.getLogger("org.apache.nutch.util.NutchConf");
@@ -57,7 +60,7 @@
     resourceNames.add("nutch-site.xml");
   }
 
-  /** A new configuration with the same settings as another. */
+  /** A new configuration with the same settings cloned from another. */
   public NutchConf(NutchConf other) {
     this.resourceNames = (ArrayList)other.resourceNames.clone();
     if (other.properties != null)
@@ -392,6 +395,25 @@
     } catch (Exception e) {
       throw new RuntimeException(e);
     }
+  }
+
+
+  public String toString() {
+    StringBuffer sb = new StringBuffer(resourceNames.size()*30);
+    sb.append("NutchConf: ");
+    ListIterator i = resourceNames.listIterator();
+    while (i.hasNext()) {
+      if (i.nextIndex() != 0) {
+        sb.append(" , ");
+      }
+      Object obj = i.next();
+      if (obj instanceof File) {
+        sb.append((File)obj);
+      } else {
+        sb.append((String)obj);
+      }
+    }
+    return sb.toString();
   }
 
   /** For debugging.  List non-default properties to the terminal and exit. */