Allow some of our configuration info to come from more convenient sources.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1441 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: Application.java,v 1.8 2002/01/24 06:32:38 mdb Exp $
|
// $Id: Application.java,v 1.9 2004/06/01 08:34:24 mdb Exp $
|
||||||
//
|
//
|
||||||
// samskivert library - useful routines for java programs
|
// samskivert library - useful routines for java programs
|
||||||
// Copyright (C) 2001 Michael Bayne
|
// Copyright (C) 2001 Michael Bayne
|
||||||
@@ -92,13 +92,13 @@ public class Application
|
|||||||
|
|
||||||
// create a site resource loader if the user set up the
|
// create a site resource loader if the user set up the
|
||||||
// site-specific jar file path
|
// site-specific jar file path
|
||||||
String siteJarPath = config.getInitParameter(SITE_JAR_PATH_KEY);
|
String siteJarPath = getInitParameter(config, SITE_JAR_PATH_KEY);
|
||||||
if (!StringUtil.blank(siteJarPath)) {
|
if (!StringUtil.blank(siteJarPath)) {
|
||||||
_siteLoader = new SiteResourceLoader(_siteIdent, siteJarPath);
|
_siteLoader = new SiteResourceLoader(_siteIdent, siteJarPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// instantiate our message manager if the application wants one
|
// instantiate our message manager if the application wants one
|
||||||
String bundlePath = config.getInitParameter(MESSAGE_BUNDLE_PATH_KEY);
|
String bundlePath = getInitParameter(config, MESSAGE_BUNDLE_PATH_KEY);
|
||||||
if (!StringUtil.blank(bundlePath)) {
|
if (!StringUtil.blank(bundlePath)) {
|
||||||
_msgmgr = new MessageManager(bundlePath);
|
_msgmgr = new MessageManager(bundlePath);
|
||||||
}
|
}
|
||||||
@@ -107,8 +107,8 @@ public class Application
|
|||||||
// message manager with it, so that it can load site-specific
|
// message manager with it, so that it can load site-specific
|
||||||
// message resources
|
// message resources
|
||||||
if (_msgmgr != null && _siteLoader != null) {
|
if (_msgmgr != null && _siteLoader != null) {
|
||||||
String siteBundlePath =
|
String siteBundlePath = getInitParameter(
|
||||||
config.getInitParameter(SITE_MESSAGE_BUNDLE_PATH_KEY);
|
config, SITE_MESSAGE_BUNDLE_PATH_KEY);
|
||||||
if (!StringUtil.blank(siteBundlePath)) {
|
if (!StringUtil.blank(siteBundlePath)) {
|
||||||
_msgmgr.activateSiteSpecificMessages(
|
_msgmgr.activateSiteSpecificMessages(
|
||||||
siteBundlePath, _siteLoader, _siteIdent);
|
siteBundlePath, _siteLoader, _siteIdent);
|
||||||
@@ -125,6 +125,17 @@ public class Application
|
|||||||
didInit(config);
|
didInit(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Looks up an initialization parameter for this application. The
|
||||||
|
* default implementation retrieves the value from the servlet config,
|
||||||
|
* but derived classes may wish to get certain parameters from some
|
||||||
|
* other configuration source.
|
||||||
|
*/
|
||||||
|
protected String getInitParameter (ServletConfig config, String key)
|
||||||
|
{
|
||||||
|
return config.getInitParameter(key);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This should be overridden by the application implementation to
|
* This should be overridden by the application implementation to
|
||||||
* invoke any necessary pre-initialization code. They should be sure
|
* invoke any necessary pre-initialization code. They should be sure
|
||||||
|
|||||||
Reference in New Issue
Block a user