org.jaffa.util
Class SettingsBase

java.lang.Object
  extended byorg.jaffa.util.SettingsBase

public abstract class SettingsBase
extends Object

Settings refers to configuration 'values' that need to be made available in the application. This class which should be extended, provided access to setting values that are defined in web.xml as environment parameters.

An example of an entry in web.xml

   <env-entry>
    <env-entry-name>myapp.email.smtpHost</env-entry-name>
    <env-entry-value>mail.yahoo.com</env-entry-value>
    <env-entry-type>java.lang.String</env-entry-type>
  </env-entry>
 

An example of a method in a sub-class that access this setting

 public static String getEmailHost() {
     return (String) getProperty("myapp.email.smtpHost", String.class, null);
 }
 

Since:
1.3
Version:
1.0
Author:
PaulE

Field Summary
protected static String JNDIBase
           
 
Constructor Summary
SettingsBase()
           
 
Method Summary
protected static Object getProperty(String name)
          Return the value of the property from the JNDI resource
protected static Object getProperty(String name, Class type)
          Return the value of the property from the JNDI resource.
protected static Object getProperty(String name, Class type, Object defValue)
          Return the value of the property from the JNDI resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JNDIBase

protected static String JNDIBase
Constructor Detail

SettingsBase

public SettingsBase()
Method Detail

getProperty

protected static Object getProperty(String name)
Return the value of the property from the JNDI resource

Parameters:
name - Name of the property

getProperty

protected static Object getProperty(String name,
                                    Class type)
Return the value of the property from the JNDI resource.

Parameters:
name - Name of the property

getProperty

protected static Object getProperty(String name,
                                    Class type,
                                    Object defValue)
Return the value of the property from the JNDI resource.

Parameters:
name - Name of the property
defValue - Specify the default laue to be returned if the property is not found or is Null specified type a runtime error is raised!


Copyright © 2002-2004 JAFFA Project.