com.cafesoft.core.service
Class ServiceConfigSupport

java.lang.Object
  |
  +--com.cafesoft.core.service.ServiceConfigSupport

public class ServiceConfigSupport
extends Object

A Helper class that performs common functions on ServiceConfig Objects

Since:
7/18/02

Constructor Summary
ServiceConfigSupport()
           
 
Method Summary
static boolean getBooleanParam(ServiceConfig config, String paramName, boolean defaultValue)
          Get a boolean param from the ServiceConfig object
static Properties getInitProperties(ServiceConfig config)
          Get the initial parameters from the ServiceConfig object and put them into a new Properties object This method is useful in situations where a Properties object is used to initialize an Object and the parent Object has a ServiceConfig Object instead.
static int getRequiredIntParam(ServiceConfig config, String source, String paramName, int defaultValue, Logger logger)
          Get an Integer parameter from the ServiceConfig object
static String getRequiredStringParam(ServiceConfig config, String source, String paramName, String defaultValue, Logger logger)
          Get a required String param from the ServiceConfig object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceConfigSupport

public ServiceConfigSupport()
Method Detail

getInitProperties

public static final Properties getInitProperties(ServiceConfig config)
Get the initial parameters from the ServiceConfig object and put them into a new Properties object

This method is useful in situations where a Properties object is used to initialize an Object and the parent Object has a ServiceConfig Object instead.

Parameters:
config - the ServiceConfig object that contains the initial parameters
Returns:
a new Properties object that contains all initial parameters

getRequiredIntParam

public static final int getRequiredIntParam(ServiceConfig config,
                                            String source,
                                            String paramName,
                                            int defaultValue,
                                            Logger logger)
Get an Integer parameter from the ServiceConfig object

Parameters:
config - the ServiceConfig object that contains all initialization parameters
source - the source object that is attempting to get the parameter. This value is used to give a contextual warning message.
paramName - the name of the Parameter for which to retreive the integer value
defaultValue - the default value to use if a valid integer can not be evaluated.
logger - the logger to log warning messages to
Returns:
the requested int value if the parameter exists and is a valid integer. Otherwise, the method returns the default value

getRequiredStringParam

public static final String getRequiredStringParam(ServiceConfig config,
                                                  String source,
                                                  String paramName,
                                                  String defaultValue,
                                                  Logger logger)
Get a required String param from the ServiceConfig object

Parameters:
config - the ServiceConfig object that contains all initialization properties.
source - the source object that is attempting to get the parameter. This value is used to give a contextual warning message.
paramName - the name of the Parameter for which to retreive the String value.
defaultValue - the default value to use if the parameter is not defined in the ServiceConfig object.
logger - the logger to log warning messages to
Returns:
the requested String value if the parameter exists else the default value.

getBooleanParam

public static final boolean getBooleanParam(ServiceConfig config,
                                            String paramName,
                                            boolean defaultValue)
Get a boolean param from the ServiceConfig object

Parameters:
config - the ServiceConfig object to get the boolean value from
paramName - the parameter name of the boolean value
defaultValue - the default value if the parameter is not found in the ServiceConfig object
Returns:
the boolean value assigned to the parameter name, or if the parameter name is not present in the Config Object then the default value is returned


Generated on 8:41:50 AM June 06, 2005, © 1996-2005 Cafésoft LLC. All rights reserved.