expanded extension-interface with applicationUpdated(app) to tell

extensions when app.properties have changed.
This commit is contained in:
stefanp 2003-02-14 16:07:52 +00:00
parent ac0c47adc1
commit b77e5da24b
3 changed files with 18 additions and 0 deletions

View file

@ -32,6 +32,12 @@ public abstract class HelmaExtension {
*/ */
public abstract void applicationStopped (Application app); public abstract void applicationStopped (Application app);
/**
* called when an Application's properties are have been updated.
* note that this will be called at startup once *before* applicationStarted().
*/
public abstract void applicationUpdated (Application app);
/** /**
* called by the ScriptingEngine when it is initizalized. Throws a ConfigurationException * called by the ScriptingEngine when it is initizalized. Throws a ConfigurationException
* when this type of ScriptingEngine is not supported. New methods and prototypes can be * when this type of ScriptingEngine is not supported. New methods and prototypes can be

View file

@ -43,6 +43,10 @@ public class DemoExtension extends HelmaExtension {
app.logEvent ("DemoExtension stopped on app " + app.getName () ); app.logEvent ("DemoExtension stopped on app " + app.getName () );
} }
public void applicationUpdated (Application app) {
app.logEvent ("DemoExtension updated on app " + app.getName () );
}
public HashMap initScripting (Application app, ScriptingEngine engine) throws ConfigurationException { public HashMap initScripting (Application app, ScriptingEngine engine) throws ConfigurationException {
if (!(engine instanceof FesiEngine)) if (!(engine instanceof FesiEngine))
throw new ConfigurationException ("scripting engine " + engine.toString () + " not supported in DemoExtension"); throw new ConfigurationException ("scripting engine " + engine.toString () + " not supported in DemoExtension");

View file

@ -1252,6 +1252,14 @@ public final class Application implements IPathElement, Runnable {
// if node manager exists, update it // if node manager exists, update it
if (nmgr != null) if (nmgr != null)
nmgr.updateProperties (props); nmgr.updateProperties (props);
// update extensions
Vector extensions = Server.getServer ().getExtensions ();
for (int i=0; i<extensions.size(); i++) {
HelmaExtension ext = (HelmaExtension)extensions.get(i);
try {
ext.applicationUpdated (this);
} catch (ConfigurationException e) { }
}
// set prop read timestamp // set prop read timestamp
lastPropertyRead = props.lastModified (); lastPropertyRead = props.lastModified ();
} }