com.bowstreet.util
Class SystemProperties

java.lang.Object
  extended by com.bowstreet.util.SystemProperties

public class SystemProperties
extends java.lang.Object

Class to access Factory Property files. This class provides access to key/value pairs loaded from bowstreet.properties & cluster.properties and optionally override.properties which are located in the WEB-INF\config directory.


Constructor Summary
SystemProperties()
           
 
Method Summary
static java.lang.String getDocumentRoot()
          Gets the String value of the Document Root directory file path.
static SystemProperties getInstance()
          Get the singleton instance of SystemProperties.
static java.lang.String getProperty(java.lang.String key)
          Gets a configuration property from one of the properties files
static java.lang.String getProperty(java.lang.String key, java.lang.String defaultVal)
          Get a configuration property and return the default if none are found.
static boolean getPropertyBoolean(java.lang.String key)
          Return the boolean value of a "true/false" property value.
static int getPropertyInt(java.lang.String key, int defaultValue)
          Get a configuration property as an int, returning the specified default if the config value can't be returned for some reason.
static long getPropertyLong(java.lang.String key, long defaultValue)
          Get a configuration property as a long, returning the specified default if the config value can't be returned for some reason.
static java.lang.String getWebInfDir()
          Gets the String value of the WEB-INF directory file path.
static boolean isRunningOnServer()
          Determine if we are running in an application server or in Designer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SystemProperties

public SystemProperties()
Method Detail

getDocumentRoot

public static java.lang.String getDocumentRoot()
Gets the String value of the Document Root directory file path. This is the on disk path to the servable content root for the application. In a Designer project, this would be the WebContent folder. In a deployed application, this would be the root of the application or portlet WAR.

Returns:
String value of the Document Root Directory file path.

getInstance

public static SystemProperties getInstance()
Get the singleton instance of SystemProperties.

Returns:
SystemProperties singleton

getProperty

public static java.lang.String getProperty(java.lang.String key)
Gets a configuration property from one of the properties files

Parameters:
key - - the property name
Returns:
String property value

getProperty

public static java.lang.String getProperty(java.lang.String key,
                                           java.lang.String defaultVal)
Get a configuration property and return the default if none are found.

Parameters:
key - - the property name.
defaultVal - default value to return if property not found.
Returns:
String property value.

getPropertyBoolean

public static boolean getPropertyBoolean(java.lang.String key)
Return the boolean value of a "true/false" property value. The default if not found is false.

Parameters:
key - - the property name
Returns:
boolean property value - default is false if property not found.

getPropertyInt

public static int getPropertyInt(java.lang.String key,
                                 int defaultValue)
Get a configuration property as an int, returning the specified default if the config value can't be returned for some reason.

Parameters:
key - - the property name.
defaultValue - default value to return if property not found.
Returns:
int property value.

getPropertyLong

public static long getPropertyLong(java.lang.String key,
                                   long defaultValue)
Get a configuration property as a long, returning the specified default if the config value can't be returned for some reason.

Parameters:
key - - the property name.
defaultValue - default value to return if property not found.
Returns:
long property value.

getWebInfDir

public static java.lang.String getWebInfDir()
Gets the String value of the WEB-INF directory file path.

Returns:
String value of the WEB-INF directory file path.

isRunningOnServer

public static boolean isRunningOnServer()
Determine if we are running in an application server or in Designer.

Returns:
TRUE if called when running in an application server. FALSE if running in Designer.


Copyright © 2009 IBM. All Rights Reserved.