Check if Server singleton exists before trying to get the list of extensions from it.

(backport from main trunk (helma 1.3))
This commit is contained in:
hns 2003-08-19 14:19:36 +00:00
parent 1e609f3ec6
commit 90439a58d9
2 changed files with 36 additions and 28 deletions

View file

@ -259,6 +259,7 @@ public final class Application implements IPathElement, Runnable {
*/ */
public void init() public void init()
throws DatabaseException, ScriptingException, MalformedURLException { throws DatabaseException, ScriptingException, MalformedURLException {
if (Server.getServer() != null) {
Vector extensions = Server.getServer().getExtensions(); Vector extensions = Server.getServer().getExtensions();
for (int i = 0; i < extensions.size(); i++) { for (int i = 0; i < extensions.size(); i++) {
@ -271,6 +272,7 @@ public final class Application implements IPathElement, Runnable {
e.toString()); e.toString());
} }
} }
}
// read the sessions if wanted // read the sessions if wanted
if ("true".equalsIgnoreCase(getProperty("persistentSessions"))) { if ("true".equalsIgnoreCase(getProperty("persistentSessions"))) {
@ -377,6 +379,7 @@ public final class Application implements IPathElement, Runnable {
typemgr = null; typemgr = null;
// tell the extensions that we're stopped. // tell the extensions that we're stopped.
if (Server.getServer() != null) {
Vector extensions = Server.getServer().getExtensions(); Vector extensions = Server.getServer().getExtensions();
for (int i = 0; i < extensions.size(); i++) { for (int i = 0; i < extensions.size(); i++) {
@ -384,6 +387,7 @@ public final class Application implements IPathElement, Runnable {
ext.applicationStopped(this); ext.applicationStopped(this);
} }
}
// store the sessions if wanted // store the sessions if wanted
if ("true".equalsIgnoreCase(getProperty("persistentSessions"))) { if ("true".equalsIgnoreCase(getProperty("persistentSessions"))) {
@ -1590,6 +1594,7 @@ public final class Application implements IPathElement, Runnable {
} }
// update extensions // update extensions
if (Server.getServer() != null) {
Vector extensions = Server.getServer().getExtensions(); Vector extensions = Server.getServer().getExtensions();
for (int i = 0; i < extensions.size(); i++) { for (int i = 0; i < extensions.size(); i++) {
@ -1600,6 +1605,7 @@ public final class Application implements IPathElement, Runnable {
} catch (ConfigurationException e) { } catch (ConfigurationException e) {
} }
} }
}
// set prop read timestamp // set prop read timestamp
lastPropertyRead = props.lastModified(); lastPropertyRead = props.lastModified();

View file

@ -116,6 +116,7 @@ public class FesiEngine implements ScriptingEngine {
// load extensions defined in server.properties: // load extensions defined in server.properties:
extensionGlobals = new HashMap(); extensionGlobals = new HashMap();
if (Server.getServer() != null) {
Vector extVec = Server.getServer().getExtensions(); Vector extVec = Server.getServer().getExtensions();
for (int i = 0; i < extVec.size(); i++) { for (int i = 0; i < extVec.size(); i++) {
@ -132,6 +133,7 @@ public class FesiEngine implements ScriptingEngine {
e.getMessage()); e.getMessage());
} }
} }
}
// fake a cache member like the one found in ESNodes // fake a cache member like the one found in ESNodes
global.putHiddenProperty("cache", new ESNode(new TransientNode("cache"), this)); global.putHiddenProperty("cache", new ESNode(new TransientNode("cache"), this));