|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.nutch.util.NutchConf
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()
A new configuration. |
Method Summary | |
void |
addConfResource(File file)
Adds a file to the chain of resources read. |
void |
addConfResource(String name)
Adds a resource name to the chain of resources read. |
static NutchConf |
get()
Return the default configuration. |
String |
get(String name)
Returns the value of the name property, or null if no
such property exists. |
String |
get(String name,
String defaultValue)
Returns the value of the name property. |
boolean |
getBoolean(String name,
boolean defaultValue)
Returns the value of the name property as an boolean. |
Class |
getClass(String name,
Class defaultValue)
Returns the value of the name property as a Class. |
Class |
getClass(String propertyName,
Class defaultValue,
Class xface)
Returns the value of the name property as a Class. |
InputStream |
getConfResourceAsInputStream(String name)
Returns an input stream attached to the configuration resource with the given name . |
Reader |
getConfResourceAsReader(String name)
Returns a reader attached to the configuration resource with the given name . |
float |
getFloat(String name,
float defaultValue)
Returns the value of the name property as a float. |
int |
getInt(String name,
int defaultValue)
Returns the value of the name property as an integer. |
long |
getLong(String name,
long defaultValue)
Returns the value of the name property as a long. |
URL |
getResource(String name)
Returns the URL for the named resource. |
String[] |
getStrings(String name)
Returns the value of the name property as an array of
strings. |
static void |
main(String[] args)
For debugging. |
void |
set(String name,
Object value)
Sets the value of the name property. |
void |
setClass(String propertyName,
Class theClass,
Class xface)
Sets the value of the name property to the name of a class. |
void |
setInt(String name,
int value)
Sets the value of the name property to an integer. |
void |
write(OutputStream out)
Writes non-default properties in this configuration. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public NutchConf()
Method Detail |
public static NutchConf get()
public void addConfResource(String name)
public void addConfResource(File file)
public String get(String name)
name
property, or null if no
such property exists.
public void set(String name, Object value)
name
property.
public String get(String name, String defaultValue)
name
property. If no such property
exists, then defaultValue
is returned.
public int getInt(String name, int defaultValue)
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.
public void setInt(String name, int value)
name
property to an integer.
public long getLong(String name, long defaultValue)
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.
public float getFloat(String name, float defaultValue)
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.
public boolean getBoolean(String name, boolean defaultValue)
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".
public String[] getStrings(String name)
name
property as an array of
strings. If no such property is specified, then null
is returned. Values are whitespace or comma delimted.
public Class getClass(String name, Class defaultValue)
name
property as a Class. If no
such property is specified, then defaultValue
is returned.
public Class getClass(String propertyName, Class defaultValue, Class xface)
name
property as a Class. If no
such property is specified, then defaultValue
is returned.
An error is thrown if the returned class does not implement the named
interface.
public void setClass(String propertyName, Class theClass, Class xface)
name
property to the name of a class.
First checks that the class implements the named interface.
public URL getResource(String name)
public InputStream getConfResourceAsInputStream(String name)
name
.
public Reader getConfResourceAsReader(String name)
name
.
public void write(OutputStream out) throws IOException
IOException
public static void main(String[] args) throws Exception
Exception
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |