com.taggercat
Class Environment

java.lang.Object
  extended by com.taggercat.Environment

public class Environment
extends java.lang.Object

This class provides basic environment information as read from the taggercat.properties file as well as from the application's deployment descriptor.

 

Constructor Summary
Environment(javax.servlet.ServletContext servletContext)
          Creates an application environment instance.
 
Method Summary
 void destroy()
          Release all plug-ins.
 java.lang.String getControllerClassName()
          Reads requestprocessor.classname from the taggercat configuration file.
static RequestController getRequestControllerInstance(java.lang.String classname)
          Creates a new RequestController for the application.
 javax.servlet.ServletContext getServletContext()
           
 java.lang.String getString(java.lang.String key)
          Gets value of specified key, searching first in initial parameters (web.xml) and then in ResourceBundle.
 java.lang.String getString(java.lang.String key, java.lang.String defaultValue)
          Gets value of specified key, searching first in Servlet's initial parameters (web.xml) and then in ResourceBundle.
 java.lang.String getStringFromInitialParameters(java.lang.String key)
          Gets value of specified key from context init parameters (web.xml).
 java.lang.String getStringFromResourceBundle(java.lang.String key)
          Gets value of specified key from locale-specific ResourceBundle (by default, taggercat.properties).
 void init(javax.servlet.ServletContext servletContext)
          Sets ServletConfig instance.
 void initDateFormaters()
          Initializes the date and datetime formatters used to parse user entered dates.
 void initNumberFormaters()
          Initializes the number formatters used to parse user entered numeric values.
 void initPlugIns()
          Deprecated. 
 void registerUserDefinedFunctions()
          Registers any user defined functions with expression evaluator.
 java.util.Date toDate(java.lang.String dateStr, java.util.TimeZone timezone)
          Parses a date string using the formatters initialized in the taggercat.properties file.
 java.util.Date toDateTime(java.lang.String dateStr, java.util.TimeZone timezone)
          Parses a date string using the formatters initialized in the taggercat.properties file.
 java.lang.Number toNumber(java.lang.String numberStr)
          Parses a number string using the formatters initialized in initNumberFormaters().
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Environment

public Environment(javax.servlet.ServletContext servletContext)
Creates an application environment instance.

Parameters:
servletContext - this applications servletContext object
Method Detail

getStringFromResourceBundle

public java.lang.String getStringFromResourceBundle(java.lang.String key)
Gets value of specified key from locale-specific ResourceBundle (by default, taggercat.properties).

Parameters:
key - Name of property to retrieve value for.
Returns:
Value of property with specified key name if bundle and property found, else null.

getString

public java.lang.String getString(java.lang.String key)
Gets value of specified key, searching first in initial parameters (web.xml) and then in ResourceBundle.

Parameters:
key - Name of property to retrieve value for.
Returns:
Value of property with specified key name if property found, else null.

getStringFromInitialParameters

public java.lang.String getStringFromInitialParameters(java.lang.String key)
Gets value of specified key from context init parameters (web.xml).

Parameters:
key - Name of property to retrieve value for.
Returns:
Value of property with specified key name if found, null otherwise.

getString

public java.lang.String getString(java.lang.String key,
                                  java.lang.String defaultValue)
Gets value of specified key, searching first in Servlet's initial parameters (web.xml) and then in ResourceBundle.

Parameters:
key - Name of property to retrieve value for.
defaultValue - use this value if not found.
Returns:
Value of property with specified key name if property found, else null.

destroy

public void destroy()
Release all plug-ins.


getControllerClassName

public java.lang.String getControllerClassName()
Reads requestprocessor.classname from the taggercat configuration file.

Returns:
Value of requestprocessor.classname property if found, otherwise the value of DEFUALT_REQUESTCONTROLLER_CLASSNAME.

init

public void init(javax.servlet.ServletContext servletContext)
Sets ServletConfig instance.

Parameters:
servletContext - ServletContext instance.

initDateFormaters

public void initDateFormaters()
Initializes the date and datetime formatters used to parse user entered dates.
The date formatters are used in the Datasource class when setting a dataField value. The date formatters are created using the current locale, and additionally any specified in the taggercat.properties file; for example:
 

;---[ Date Formats for Save ]--- date.format1=MMM/dd/yyyy date.format2=MM/dd/yyyy date.format3=yyyy/MMM/dd

;---[ Datetime Formats for Save ]--- datetime.format1=MMM/dd/yyyy HH:mm datetime.format2=MM/dd/yyyy HH:mm datetime.format3=yyyy/MMM/dd HH:mm


initNumberFormaters

public void initNumberFormaters()
Initializes the number formatters used to parse user entered numeric values.
The number formatters are used in the Datasource class when setting a dataField value. The number formatters are created using the current locale, and additionally any specified in the taggercat.properties file or the application's deployment descriptor.
for example:
 

;---[ Number Formats for Save ]--- number.format1=$###,###.### number.format2=###,###.### number.format3=### ###,### number.format4=Z###,###.###


registerUserDefinedFunctions

public void registerUserDefinedFunctions()
Registers any user defined functions with expression evaluator.


initPlugIns

@Deprecated
public void initPlugIns()
Deprecated. 

Initializes any user defined plug-in classes. Similar functionality is now provided by the container with Context listeners.


toDate

public java.util.Date toDate(java.lang.String dateStr,
                             java.util.TimeZone timezone)
Parses a date string using the formatters initialized in the taggercat.properties file. These formatters always use the default locale.

Parameters:
dateStr - the date string
Returns:
the Date value, null if the date string cannot be parsed by one of the formatters

toDateTime

public java.util.Date toDateTime(java.lang.String dateStr,
                                 java.util.TimeZone timezone)
Parses a date string using the formatters initialized in the taggercat.properties file. These formatters always use the default locale.

Parameters:
dateStr - the date string
Returns:
the Date value, null if the date string cannot be parsed by one of the formatters

toNumber

public java.lang.Number toNumber(java.lang.String numberStr)
Parses a number string using the formatters initialized in initNumberFormaters(). These formatters always use the default locale.

Parameters:
numberStr - the number string
Returns:
the Number value, null if the number string cannot be parsed by one of the formatters

getServletContext

public javax.servlet.ServletContext getServletContext()

getRequestControllerInstance

public static RequestController getRequestControllerInstance(java.lang.String classname)
                                                      throws javax.servlet.ServletException
Creates a new RequestController for the application.

Throws:
javax.servlet.ServletException - if the creation failed, with the root cause exception included
Parameters:
classname - the class name of the request map
Returns:
the new request map instance