|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jcorporate.expresso.core.misc.ConfigManager
ConfigManager is a static class that utilizes the Struts Digester utility to read an XML file of configuration parameters when Expresso starts up. These parameters are then available during the execution of the application.
| Field Summary | |
static String |
EXPRESSO_DTD_COPY_LOCATION
constant path for DTD file; we expect DTD to be placed here, probably by a ANT copy before running servlet engine searched relative to class dir |
static String |
LOG_DIR_PARAM_NAME
name of servlet param which controls logging directory |
| Constructor Summary | |
ConfigManager()
Default Constructer |
|
| Method Summary | |
static void |
addSession(CurrentLogin newLogin)
Adds to the 'we have X many logins' hashtable. |
static void |
checkInitialized(HttpServletRequest req,
ServletConfig c)
Check if the configuration info needs to be read, and read it if so. |
static void |
config(ServletConfig c)
Called by the initial load servlet to initialize the entire system |
static void |
dbInitialize()
Initialize our database pool(s) |
static void |
dbUninitialize()
Remove our database pool(s) Closes all connections so that Hypersonic can handle multiple test suites from multiple VM's thrown at it as long as each test suite calls dbUninitialize in the teardown method. |
static void |
destroy()
Call this to destroy all items that ConfigManager uses. |
static String |
expandValue(String propValue)
Method to "expand" some simple "macro" codes allowed in property file and Setup values. |
static org.apache.struts.config.ForwardConfig |
findForwardConfig(org.apache.struts.config.ActionConfig oneConfig,
String stateName)
Find a forward config given an action config and a state name Does not return higher level forwards, just the one for the given state IF it exists |
static org.apache.struts.config.ActionConfig |
getActionConfig(String controllerName,
String stateName)
Gets the action mapping associated with the controller and default root module. |
static org.apache.struts.config.ActionConfig |
getActionConfig(String moduleName,
String controllerName,
String stateName)
Gets the action mapping associated with the controller and the module name. |
static List |
getActionConfigList(String controllerName)
Gets all the action mappings associated with the controller and the default module. |
static List |
getActionConfigList(String moduleName,
String controllerName)
Gets all the action mappings associated with the controller and the module name. |
static Enumeration |
getAllConfigKeys()
Return an enumeration of all of the valid configuration keys. |
static Hashtable |
getAllJobHandlers()
Gets all job handlers in the system |
static String |
getClassHandler(String handlerName)
Return the Class dealing with the named ClassHandler |
static String |
getClassHandlerParameter(String handlerName,
String parameter)
Returns the given parameter for a class handler. |
static ConfigExpresso |
getConfig()
Return the top-level configuration object, an instance of the ConfigExpresso class. |
static String |
getConfigDir()
Return the pathname of the configuration directory (specified as "configDir" |
static HashMap |
getConfigInputSources(String filterDocType)
Returns a hashmap keyed by filename, and data ='s a series of input streams corresponding to xml files of the desired doctype. |
static Throwable |
getConfigurationFailureException()
|
static ConfigContext |
getContext(String contextName)
Return the context configuration object for the named context. |
static String |
getContextPath()
Get the web-app context path for this web application |
static ControllerFactory |
getControllerFactory()
Returns the controller factory object. |
static Hashtable |
getCurrentLogins()
Returns a hashtable of the current login objects |
static ConfigManager |
getInstance()
Return the reference instance of the config manager Use this in preference to the singleton APIs. |
static ConfigJdbc |
getJdbc(String contextName)
Get the Jdbc configuration (if any) for the named context |
static ConfigJdbc |
getJdbcRequired(String contextName)
Get a Jdbc configuration object, throwing an exception if there is not one for the specified context |
static JobHandler |
getJobHandler(String contextName)
Returns a specific job handler. |
static org.apache.struts.action.ActionMapping |
getMapping(String controllerName,
String stateName)
Deprecated. this method is now deprecated and does no anything since Struts 1.1 getActionConfig(String moduleName, String controllerName, String stateName ) |
static String |
getOtherDbLocation(String dbName,
String objectName)
Get the cached "other db" location for a specific object Creation date: (1/5/01 6:57:06 PM) author: Adam Rossi, PlatinumSolutions |
static Hashtable |
getOtherDBLocations()
Return a cloned Hashtable containing all of the DBOtherMap entries author Adam Rossi, PlatinumSolutions |
static String |
getServletAPIVersion()
Queries the current servletAPI defined in the configuration system |
static String |
getWebAppDir()
Get the actual filesystem directory that is the root of this web-app |
static void |
initializeAllDBObjects()
Iterate through all schemas and instantiate a DBObject. |
protected static void |
initializeOneSchema(String className)
|
static boolean |
isInitialized()
Is the ConfigManager initialized yet? |
static boolean |
isParameterReservedWord(String testWord)
Checks to see if a controller parameter may be a reserved word. |
static boolean |
isReservedWord(String testWord)
Checks to see if any given field or tablename fed to this qualifies as a known reserved word for various databases. |
static void |
load(String theConfigDir)
"Second stage" configuration. |
static void |
mapOtherDBs()
Map otherdb locations into a hashtable stored in memory. |
static void |
reInitialize(HttpServletRequest req,
ServletConfig c)
Re-read all properties and other values, re-initialize everything |
static void |
removeSession(String sessionId)
Removes a stored session. |
static void |
setConfigurationFailureException(Throwable ee)
|
static void |
setContextPath(String newContextPath)
Set the "context path" - this is used for translating the %context% 'macro' that can be used in property and setup values |
static void |
setControllerFactory(ControllerFactory cf)
set the controller factory to use. |
protected void |
setDigesterRules(ConfigExpresso myConfig,
org.apache.commons.digester.Digester digester)
Set up the rules for the digester |
static void |
setRequest(HttpServletRequest req)
This function is used by webservers to set global variables such as server prefix, or context path. |
protected void |
setSAXParser()
|
static void |
setWebAppDir(String newDir)
Set the "Web application directory" - this is used for translating the %web-app% 'macro' that can be used in property and setup values |
static void |
startJobHandler()
Start job handlers The job handler for each DB context is started if the appropriate configuration entry is found for that context |
protected void |
stopJobHandler()
Stops all job handlers |
static void |
storeModuleActionConfig(org.apache.struts.config.ModuleConfig moduleConfig)
Store the action mappings per module to allow fast reverse based lookup based on the controller name. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String EXPRESSO_DTD_COPY_LOCATION
public static final String LOG_DIR_PARAM_NAME
| Constructor Detail |
public ConfigManager()
| Method Detail |
public static void addSession(CurrentLogin newLogin)
newLogin - the new loginpublic static void setConfigurationFailureException(Throwable ee)
public static Throwable getConfigurationFailureException()
public static void removeSession(String sessionId)
sessionId - the session id that we are receiving the signal forpublic static Hashtable getCurrentLogins()
public static JobHandler getJobHandler(String contextName)
contextName - The dbcontext to get the jobhandler from. ex:
default
public static Hashtable getAllJobHandlers()
public static String getServletAPIVersion()
public static void dbUninitialize()
throws DBException
DBExceptionpublic static void destroy()
public static void dbInitialize()
throws ConfigurationException
ConfigurationException - if there is an error getting the config
values from the config beans.public static void initializeAllDBObjects()
protected static void initializeOneSchema(String className)
public static Enumeration getAllConfigKeys()
public static ConfigManager getInstance()
ConfigManager.getInstace().getLogDirectory()
for instance. instead of ConfigManager.getLogDirectory();
- Returns:
- an instance of ConfigManager
public static boolean isInitialized()
public static ConfigExpresso getConfig()
public static HashMap getConfigInputSources(String filterDocType)
throws ConfigurationException
filterDocType - - The doctype that you need for configuration files
ConfigurationException - if an error occurs while checking xml file
types
public static ConfigContext getContext(String contextName)
throws ConfigurationException
contextName - the data context to retrieve the configuration information
for
ConfigurationException - if there's an error retrieving the ConfigContext
bean for the specified contextpublic static String getClassHandler(String handlerName)
handlerName - the 'service name' of the classhandler to retrieve
public static String getClassHandlerParameter(String handlerName,
String parameter)
handlerName - the 'service name' of the classhandler to retrieveparameter - The name of the parameter to get
public static ConfigJdbc getJdbc(String contextName)
throws ConfigurationException
contextName - the data context to get the JDBC configuration bean for
ConfigurationException - if there is an error retrieving the context
public static ConfigJdbc getJdbcRequired(String contextName)
throws ConfigurationException
contextName - the data context to get the JDBC configuration bean for
ConfigurationException - if there is an error retrieving the contextpublic static String getWebAppDir()
public static boolean isReservedWord(String testWord)
testWord - The word to check against the list of known reserved
words.
public static boolean isParameterReservedWord(String testWord)
testWord - The word to check against the list of known reserved
words.
public static void startJobHandler()
throws ConfigurationException
ConfigurationException - if there's a config error reading job values or
getting job values for a particular context.
protected void stopJobHandler()
throws ConfigurationException
ConfigurationException - if there's an error getting the config
information beans.public static void setWebAppDir(String newDir)
newDir - the new directory for the webAppDirectory 'environment
variable'public static void setContextPath(String newContextPath)
newContextPath - the new contextPath value to usepublic static void setControllerFactory(ControllerFactory cf)
cf - the new Controller Factory to use for the running system.for
an example use of this.public static String getContextPath()
public static void config(ServletConfig c)
throws ServletException
c - The servlet engine configuration
ServletException - Servlet exception if an error occurs initializing
the configuration system.
public static void load(String theConfigDir)
throws DBException,
ConfigurationException
theConfigDir - The directory to load all config files from.
DBException
ConfigurationExceptionpublic static String expandValue(String propValue)
propValue - The 'property value' to expand.
public static String getConfigDir()
public static ControllerFactory getControllerFactory()
public static String getOtherDbLocation(String dbName,
String objectName)
dbName - java.lang.StringobjectName - the name to located
public static Hashtable getOtherDBLocations()
public static void mapOtherDBs()
throws ConfigurationException
ConfigurationException - if there is an error mapping these other
databases.
public static void reInitialize(HttpServletRequest req,
ServletConfig c)
throws ServletException
req - The servlet request to usec - The servlet config handed to us in the init() method.
ServletException
public static void checkInitialized(HttpServletRequest req,
ServletConfig c)
throws ServletException
req - The servlet request given by the servlet containerc - The servlet configuration
ServletExceptionpublic static void setRequest(HttpServletRequest req)
req - a HttpServletRequestpublic static void storeModuleActionConfig(org.apache.struts.config.ModuleConfig moduleConfig)
org.apache.struts.action.ActionMapping is deprecated
and has been replaced with org.apache.struts.config.ActionConfig
which is part of org.apache.struts.config.ModuleConfig
public static org.apache.struts.config.ActionConfig getActionConfig(String controllerName,
String stateName)
controllerName - the classname of the controller to look up.stateName - the name of the state to lookup within that controller
getActionConfig( String,String,String )
public static org.apache.struts.config.ActionConfig getActionConfig(String moduleName,
String controllerName,
String stateName)
null this method will attempt to
dynamically load the controller class, instantiate an object instance
and retrieve the controller class's initial state.
The action mapping is determined by looking at
ActionConfig records in Struts configuration,
retrieving all the local action forward and comparing
its name to the state forward. This means that in your Struts
XML configuration you must define a local action forward with
the same name as the state Method.
If no action mapping can be determined by�looking for a
particular matching local action forward, then the first action
mapping is returned if exists. Please note the first action
mapping is not necessarily the first action mapping declared in
the XML configuration. This cannot be guaranteed, because the
implementation may changed in the future.
<action path="/Register"
type="com.jcorporate.expresso.services.controller.SimpleRegistration"
name="default" scope="request" validate="false" >
<forward name="showDBMenu"
path="/expresso/jsp/register/dbmenu.jsp" />
<forward name="promptAddRecord"
path="/expresso/jsp/register/regAdd.jsp" />
<forward name="promptUpdateRecord"
path="/expresso/jsp/register/regAdd.jsp" />
...
</action>
In order for the above action mapping "/Register" to be returned then
you need to declare a unique local action forward name, if you
use the same controller class for multiple actions. For example "showDBMenu"
could be the unique local forward.
moduleName - the Struts module namecontrollerName - the classname of the controller to look up.stateName - the name of the state to lookup within that controller
storeModuleActionConfig( ModuleConfig moduleConfig)
public static final org.apache.struts.config.ForwardConfig findForwardConfig(org.apache.struts.config.ActionConfig oneConfig,
String stateName)
oneConfig - the ActionConfig for the controllerstateName - the state name for the controller
public static List getActionConfigList(String controllerName)
controllerName - the classname of the controller to look up.
getActionConfigList( String,String )
public static List getActionConfigList(String moduleName,
String controllerName)
moduleName - the Struts module namecontrollerName - the classname of the controller to look up.
storeModuleActionConfig( ModuleConfig moduleConfig)
public static org.apache.struts.action.ActionMapping getMapping(String controllerName,
String stateName)
getActionConfig(String moduleName, String controllerName, String stateName )
controllerName - the classname of the controller to look up.stateName - the name of the state to lookup within that controller
protected void setDigesterRules(ConfigExpresso myConfig,
org.apache.commons.digester.Digester digester)
myConfig - The root of the bean accepting the digester inputdigester - an instantiated Digester ready to accept the rules.protected void setSAXParser()
|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||