Version: 1.1.1

org.biomoby.registry.rdfagent.util
Class Config

java.lang.Object
  extended by org.biomoby.registry.rdfagent.util.Config

public class Config
extends Object

a class to handle configs for different things. reads file on the format

  [sectionName1]
  key=value
  key2=value2
  [sectionName2]
  key=value
  key2=value2 
  key_with_equals\=still_key=value3
  
everything after the first '#' is considered a comment. blank lines are ignored. If you want keys with '=' in them escape it to '\=' and you should be fine.


Constructor Summary
Config(String filename)
          Create a Config for the specified file
 
Method Summary
 Properties getProperties(String sectionName)
          get the properties for a given section
 String getProperty(String section, String key, String defaultstring)
          get a property for given key in specified section
 Enumeration getSections()
          get the available sections
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Config

public Config(String filename)
       throws IOException
Create a Config for the specified file

Parameters:
filename - the File we read the config from
Throws:
IOException
Method Detail

getSections

public Enumeration getSections()
get the available sections

Returns:
an Enumeration of the available sections (including the empty section).

getProperties

public Properties getProperties(String sectionName)
get the properties for a given section

Parameters:
sectionName - the section we want properties for.
Returns:
a Properties if section exist or null.

getProperty

public String getProperty(String section,
                          String key,
                          String defaultstring)
get a property for given key in specified section

Parameters:
section - the section we should look in.
key - the key we want a value for.
defaultstring - the string to use if no value is found.
Returns:
a string if section + key is set, null otherwise

Version: 1.1.1

Submit a bug or feature
Generated: Sat May 29 04:26:35 EDT 2010