net.livesite.util
Class RuntimeConfig

java.lang.Object
  extended by net.livesite.util.RuntimeConfig

public class RuntimeConfig
extends Object

Access to runtime configuration values. These values are stored in property files which are on the classpath (part of the JAR.) The "runtime" part meaning we use the localization scheme build into the ResourceBundle methods.


Field Summary
static ResourceBundle runtimeBundle
           
static ResourceBundle versionBundle
           
 
Constructor Summary
RuntimeConfig()
           
 
Method Summary
static String getExceptionString(String key, String[] args)
          A wrapper for calling getPopulateString to get an exception message.
static String getString(String key)
          Returns a value from the runtime properties file.
static String getString(String key, String[] args)
          Returns the populated value from the runtime properties file.
static String getVersionString()
          Returns the current version like: v1.2.3
static String getVersionString(String segment)
          Returns a value from the version properties file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

versionBundle

public static ResourceBundle versionBundle

runtimeBundle

public static ResourceBundle runtimeBundle
Constructor Detail

RuntimeConfig

public RuntimeConfig()
Method Detail

getString

public static String getString(String key)
                        throws Exception
Returns a value from the runtime properties file.

Parameters:
key - the key for the desired string
Throws:
Exception - see java.util.ResourceBundle.getString

getVersionString

public static String getVersionString()
                               throws Exception
Returns the current version like: v1.2.3

Throws:
Exception - see java.util.ResourceBundle.getString

getVersionString

public static String getVersionString(String segment)
                               throws Exception
Returns a value from the version properties file.

Parameters:
segment - the version segment: "major", "minor", or "rev"
Throws:
Exception - see java.util.ResourceBundle.getString

getString

public static String getString(String key,
                               String[] args)
                        throws Exception
Returns the populated value from the runtime properties file. The value is parsed such that the property
welmsg=Hello 1, it is currently 2
will become
Hello Ryan, it is currently raining
when called with the parameters
"welmsg", new String[] { "Ryan", "raining" }

Parameters:
key - the runtime property key which represents the message
args - arguments to populate the message
Throws:
Exception

getExceptionString

public static String getExceptionString(String key,
                                        String[] args)
A wrapper for calling getPopulateString to get an exception message. This differs in that it does not throw an exception.