added extension mechanism: read comma-separated extension-list from
server.properties, try to get classes (subclasses of helma.extensions.HelmaExtension) and call their init()-method.
This commit is contained in:
parent
f68ed83394
commit
8eabb419d5
1 changed files with 24 additions and 0 deletions
|
@ -9,6 +9,7 @@ import java.rmi.server.*;
|
||||||
import java.rmi.registry.*;
|
import java.rmi.registry.*;
|
||||||
import java.net.*;
|
import java.net.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import helma.extensions.HelmaExtension;
|
||||||
// import helma.objectmodel.*;
|
// import helma.objectmodel.*;
|
||||||
import helma.objectmodel.db.DbSource;
|
import helma.objectmodel.db.DbSource;
|
||||||
import helma.framework.*;
|
import helma.framework.*;
|
||||||
|
@ -32,6 +33,8 @@ import helma.util.*;
|
||||||
|
|
||||||
private ApplicationManager appManager;
|
private ApplicationManager appManager;
|
||||||
|
|
||||||
|
private Vector extensions;
|
||||||
|
|
||||||
private Thread mainThread;
|
private Thread mainThread;
|
||||||
|
|
||||||
static String propfile;
|
static String propfile;
|
||||||
|
@ -181,6 +184,23 @@ import helma.util.*;
|
||||||
}
|
}
|
||||||
|
|
||||||
// nmgr = new NodeManager (this, sysProps);
|
// nmgr = new NodeManager (this, sysProps);
|
||||||
|
// try to load the extensions
|
||||||
|
extensions = new Vector ();
|
||||||
|
if (sysProps.getProperty ("extensions")!=null) {
|
||||||
|
StringTokenizer tok=new StringTokenizer (sysProps.getProperty ("extensions"),",");
|
||||||
|
while(tok.hasMoreTokens ()) {
|
||||||
|
String extClassName = tok.nextToken ().trim ();
|
||||||
|
try {
|
||||||
|
Class extClass = Class.forName (extClassName);
|
||||||
|
HelmaExtension ext = (HelmaExtension) extClass.newInstance ();
|
||||||
|
ext.init (this);
|
||||||
|
extensions.add (ext);
|
||||||
|
getLogger ().log ("loaded: " + extClassName);
|
||||||
|
} catch (Exception e) {
|
||||||
|
getLogger ().log ("error: " + extClassName + " (" + e.toString () + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Start running, finishing setup and then entering a loop to check changes
|
// Start running, finishing setup and then entering a loop to check changes
|
||||||
// in the apps.properties file.
|
// in the apps.properties file.
|
||||||
|
@ -354,6 +374,10 @@ import helma.util.*;
|
||||||
return new File (hopHome, "apps");
|
return new File (hopHome, "apps");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Vector getExtensions () {
|
||||||
|
return extensions;
|
||||||
|
}
|
||||||
|
|
||||||
public void startApplication(String name) {
|
public void startApplication(String name) {
|
||||||
appManager.start (name);
|
appManager.start (name);
|
||||||
appManager.register (name);
|
appManager.register (name);
|
||||||
|
|
Loading…
Add table
Reference in a new issue