fr.imag.adele.bundle.util.config
Class Configuration

java.lang.Object
  extended byfr.imag.adele.bundle.util.config.Configuration

public class Configuration
extends Object

configuration utility

Author:
donsez

Constructor Summary
Configuration()
           
 
Method Summary
static Hashtable getHashtable(Properties props, String keyListPropertyName)
          builds a hashtable from properties. the key list is in the property keyListPropertyName
Example getHashtable(props,"keylist") returns a hashtable with 3 key-value entry keylist=bar;bubba;foo bar=BAR foo=1.5;float bubba=100;int
static Map getMap(Properties props, String keyListPropertyName)
          builds a map from properties. the key list is in the property keyListPropertyName
Example getMap(props,"keylist") returns a hashtable with 3 key-value entry keylist=bar;bubba;foo bar=BAR foo=1.5;float bubba=100;int
static Vector getVector(Properties props, String vectorPropertyName)
          builds a (ordered) vector from properties. the index list is in the property keyListPropertyName
Example getVector(props,"tab") returns a 4 elements vector (tab.5 is ignored since tab.4 does not exist) tab.0=bar tab.1=foo tab.2=1.5;float tab.3=100;int tab.5=10000;long
static Properties loadProperties(InputStream in)
          loads properties from a input stream
static Properties loadProperties(String filename)
          loads properties from a file
static void printProperties(PrintStream ps, Properties prop)
          print properties in a printwriter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Configuration

public Configuration()
Method Detail

loadProperties

public static Properties loadProperties(String filename)
loads properties from a file

Parameters:
filename - the properties file name
Returns:
the properties

printProperties

public static void printProperties(PrintStream ps,
                                   Properties prop)
print properties in a printwriter

Parameters:
prop - the properties to print

loadProperties

public static Properties loadProperties(InputStream in)
loads properties from a input stream

Parameters:
in - the imput stream
Returns:
the properties

getMap

public static Map getMap(Properties props,
                         String keyListPropertyName)
builds a map from properties. the key list is in the property keyListPropertyName
Example getMap(props,"keylist") returns a hashtable with 3 key-value entry
 keylist=bar;bubba;foo
 bar=BAR
 foo=1.5;float
 bubba=100;int
 

Parameters:
props - the properties
keyListPropertyName - the property name of the key list (separed by ;)
Returns:
The map

getHashtable

public static Hashtable getHashtable(Properties props,
                                     String keyListPropertyName)
builds a hashtable from properties. the key list is in the property keyListPropertyName
Example getHashtable(props,"keylist") returns a hashtable with 3 key-value entry
 keylist=bar;bubba;foo
 bar=BAR
 foo=1.5;float
 bubba=100;int
 

Parameters:
props - the properties
keyListPropertyName - the property name of the key list (separed by ;)
Returns:
The hashtable

getVector

public static Vector getVector(Properties props,
                               String vectorPropertyName)
builds a (ordered) vector from properties. the index list is in the property keyListPropertyName
Example getVector(props,"tab") returns a 4 elements vector (tab.5 is ignored since tab.4 does not exist)
 tab.0=bar
 tab.1=foo
 tab.2=1.5;float
 tab.3=100;int
 tab.5=10000;long
 

Parameters:
props - the properties
vectorPropertyName - the property name of the key list (separed by ;)
Returns:
The vector