org.jasig.portal.core
Class PropertiesManager

java.lang.Object
  extended by org.jasig.portal.core.PropertiesManager

public class PropertiesManager
extends java.lang.Object

Provides access to properties and manages the portal base directory.

Since:
uPortal 2.0
Version:
$Revision: 1.1 $
Author:
Ken Weiner, kweiner@unicon.net

Field Summary
protected static org.apache.commons.logging.Log log
           
private static java.lang.String PORTAL_PROPERTIES_FILE_NAME
           
static java.lang.String PORTAL_PROPERTIES_FILE_SYSTEM_VARIABLE
           
private static java.util.Properties props
           
 
Constructor Summary
PropertiesManager()
           
 
Method Summary
static java.lang.String getProperty(java.lang.String name)
          Returns the value of a property for a given name.
static boolean getPropertyAsBoolean(java.lang.String name)
          Returns the value of a property for a given name.
static byte getPropertyAsByte(java.lang.String name)
          Returns the value of a property for a given name as a byte
static double getPropertyAsDouble(java.lang.String name)
          Returns the value of a property for a given name as a long
static float getPropertyAsFloat(java.lang.String name)
          Returns the value of a property for a given name as a float
static int getPropertyAsInt(java.lang.String name)
          Returns the value of a property for a given name as an int
static long getPropertyAsLong(java.lang.String name)
          Returns the value of a property for a given name as a long
static short getPropertyAsShort(java.lang.String name)
          Returns the value of a property for a given name as a short
static java.lang.String getPropertyUntrimmed(java.lang.String name)
          Returns the value of a property for a given name including any whitespace that may be at the beginning or end of the property value.
protected static void loadProps()
          Load up the portal properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.commons.logging.Log log

PORTAL_PROPERTIES_FILE_SYSTEM_VARIABLE

public static final java.lang.String PORTAL_PROPERTIES_FILE_SYSTEM_VARIABLE
See Also:
Constant Field Values

PORTAL_PROPERTIES_FILE_NAME

private static final java.lang.String PORTAL_PROPERTIES_FILE_NAME
See Also:
Constant Field Values

props

private static final java.util.Properties props
Constructor Detail

PropertiesManager

public PropertiesManager()
Method Detail

loadProps

protected static void loadProps()
Load up the portal properties. Right now the portal properties is a simple .properties file with name value pairs. It may evolve to become an XML file later on.


getProperty

public static java.lang.String getProperty(java.lang.String name)
Returns the value of a property for a given name. Any whitespace is trimmed off the beginning and end of the property value.

Parameters:
name - the name of the requested property
Returns:
value the value of the property matching the requested name

getPropertyUntrimmed

public static java.lang.String getPropertyUntrimmed(java.lang.String name)
Returns the value of a property for a given name including any whitespace that may be at the beginning or end of the property value. A runtime exception is thrown if the property cannot be found.

Parameters:
name - the name of the requested property
Returns:
value the value of the property matching the requested name

getPropertyAsBoolean

public static boolean getPropertyAsBoolean(java.lang.String name)
Returns the value of a property for a given name. This method can be used if the property is boolean in nature and you want to make sure that true is returned if the property is set to "true", "yes", "y", or "on" (regardless of case), and false is returned in all other cases.

Parameters:
name - the name of the requested property
Returns:
value true if property is set to "true", "yes", "y", or "on" regardless of case, otherwise false

getPropertyAsByte

public static byte getPropertyAsByte(java.lang.String name)
Returns the value of a property for a given name as a byte

Parameters:
name - the name of the requested property
Returns:
value the property's value as a byte

getPropertyAsShort

public static short getPropertyAsShort(java.lang.String name)
Returns the value of a property for a given name as a short

Parameters:
name - the name of the requested property
Returns:
value the property's value as a short

getPropertyAsInt

public static int getPropertyAsInt(java.lang.String name)
Returns the value of a property for a given name as an int

Parameters:
name - the name of the requested property
Returns:
value the property's value as an int

getPropertyAsLong

public static long getPropertyAsLong(java.lang.String name)
Returns the value of a property for a given name as a long

Parameters:
name - the name of the requested property
Returns:
value the property's value as a long

getPropertyAsFloat

public static float getPropertyAsFloat(java.lang.String name)
Returns the value of a property for a given name as a float

Parameters:
name - the name of the requested property
Returns:
value the property's value as a float

getPropertyAsDouble

public static double getPropertyAsDouble(java.lang.String name)
Returns the value of a property for a given name as a long

Parameters:
name - the name of the requested property
Returns:
value the property's value as a long