net.nutch.util
Class NutchConf

java.lang.Object
  extended bynet.nutch.util.NutchConf

public class NutchConf
extends Object

Provides access to Nutch configuration parameters.

Default values for all parameters are specified in a file named nutch-default.xml located on the classpath. Overrides for these defaults should be in an optional file named nutch-site.xml, also located on the classpath. Typically these files reside in the conf/ subdirectory at the top-level of a Nutch installation.


Constructor Summary
NutchConf()
           
 
Method Summary
static void addConfResource(String name)
          Adds a resource name to the chain of resources read.
static String get(String name)
          Returns the value of the name property, or null if no such property exists.
static String get(String name, String defaultValue)
          Returns the value of the name property.
static boolean getBoolean(String name, boolean defaultValue)
          Returns the value of the name property as an boolean.
static InputStream getConfResourceAsInputStream(String name)
          Returns an input stream attached to the configuration resource with the given name.
static Reader getConfResourceAsReader(String name)
          Returns a reader attached to the configuration resource with the given name.
static float getFloat(String name, float defaultValue)
          Returns the value of the name property as a float.
static int getInt(String name, int defaultValue)
          Returns the value of the name property as an integer.
static long getLong(String name, long defaultValue)
          Returns the value of the name property as a long.
static String[] getStrings(String name)
          Returns the value of the name property as an array of strings.
static void main(String[] args)
          For debugging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NutchConf

public NutchConf()
Method Detail

addConfResource

public static void addConfResource(String name)
Adds a resource name to the chain of resources read. The first resource is always nutch-default.xml, and the last is always nutch-site.xml. New resources are inserted between these, so they can override defaults, but not site-specifics.


get

public static String get(String name)
Returns the value of the name property, or null if no such property exists.


get

public static String get(String name,
                         String defaultValue)
Returns the value of the name property. If no such property exists, then defaultValue is returned.


getInt

public static int getInt(String name,
                         int defaultValue)
Returns the value of the name property as an integer. If no such property is specified, or if the specified value is not a valid integer, then defaultValue is returned.


getLong

public static long getLong(String name,
                           long defaultValue)
Returns the value of the name property as a long. If no such property is specified, or if the specified value is not a valid long, then defaultValue is returned.


getFloat

public static float getFloat(String name,
                             float defaultValue)
Returns the value of the name property as a float. If no such property is specified, or if the specified value is not a valid float, then defaultValue is returned.


getConfResourceAsInputStream

public static InputStream getConfResourceAsInputStream(String name)
Returns an input stream attached to the configuration resource with the given name.


getConfResourceAsReader

public static Reader getConfResourceAsReader(String name)
Returns a reader attached to the configuration resource with the given name.


getBoolean

public static boolean getBoolean(String name,
                                 boolean defaultValue)
Returns the value of the name property as an boolean. If no such property is specified, or if the specified value is not a valid boolean, then defaultValue is returned. Valid boolean values are "true" and "false".


getStrings

public static String[] getStrings(String name)
Returns the value of the name property as an array of strings. If no such property is specified, then null is returned. Values are whitespace or comma delimted.


main

public static void main(String[] args)
For debugging. List all properties to the terminal and exits.



Copyright © 2004 The Nutch Organization.