com.davesag.smpp.util
Class ConfigUtils

java.lang.Object
  extended bycom.davesag.smpp.util.ConfigUtils

public class ConfigUtils
extends Object

This helps us load objects and properties as well as perform various config tasks.


Field Summary
protected static Log log
           
 
Constructor Summary
ConfigUtils()
           
 
Method Summary
static String getError(String err)
          get a specific error.
static Properties getErrors()
          get the error messages.
static Properties getProperties()
          get the general application properties.
static String getProperty(String key)
          get a specific property.
static String getResponseFormat(String resp)
          get a specific response format.
static Properties getResponses()
          get the responses messages.
static Object loadObjectByName(String name)
          Uses the default ClassLoader to load the named class, catches all the individual exceptions and rethrows as a more general ClassNotFoundException.
static Properties loadProperties(Class clazz, String filename)
          Load a properties file using a specific class.
static Properties loadProperties(String filename)
          Load a properties file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static Log log
Constructor Detail

ConfigUtils

public ConfigUtils()
Method Detail

getProperties

public static Properties getProperties()
get the general application properties.

Returns:
response properties.

getResponses

public static Properties getResponses()
get the responses messages.

Returns:
response properties.

getErrors

public static Properties getErrors()
get the error messages.

Returns:
error properties.

getProperty

public static String getProperty(String key)
get a specific property.

Parameters:
key - The property's key
Returns:
the property for the given key.

getError

public static String getError(String err)
get a specific error.

Parameters:
err - The error's key
Returns:
the error message for the given key.

getResponseFormat

public static String getResponseFormat(String resp)
get a specific response format.

Parameters:
resp - The response format's key
Returns:
the response format for the given key.

loadProperties

public static Properties loadProperties(String filename)
                                 throws IOException
Load a properties file.

Parameters:
filename - The name of the properties file.
Returns:
the Properties.
Throws:
IOException

loadProperties

public static Properties loadProperties(Class clazz,
                                        String filename)
                                 throws IOException
Load a properties file using a specific class.

Parameters:
clazz - any class in the current classpath. Defaults to this class.
filename - The name of the properties file.
Returns:
the Properties.
Throws:
IOException

loadObjectByName

public static Object loadObjectByName(String name)
                               throws ClassNotFoundException
Uses the default ClassLoader to load the named class, catches all the individual exceptions and rethrows as a more general ClassNotFoundException.

Parameters:
name - The name of the class to load.
Returns:
the loaded Object.
Throws:
ClassNotFoundException - if anything went wrong.


SMPP Commander API version 20 Jan 2005. (C) 2004 Dave Sag.