Add rootObjectFunctionName property that allows to define a function to get the app's root object.
This commit is contained in:
parent
4b2f195568
commit
ca1aa7f02c
1 changed files with 8 additions and 2 deletions
|
@ -73,6 +73,7 @@ public final class Application implements Runnable {
|
||||||
// if defined this will cause us to get the root object straight
|
// if defined this will cause us to get the root object straight
|
||||||
// from the scripting engine, circumventing all hopobject db fluff
|
// from the scripting engine, circumventing all hopobject db fluff
|
||||||
String rootObjectPropertyName;
|
String rootObjectPropertyName;
|
||||||
|
String rootObjectFunctionName;
|
||||||
|
|
||||||
// The session manager
|
// The session manager
|
||||||
SessionManager sessionMgr;
|
SessionManager sessionMgr;
|
||||||
|
@ -838,7 +839,7 @@ public final class Application implements Runnable {
|
||||||
/**
|
/**
|
||||||
* This method returns the root object of this application's object tree.
|
* This method returns the root object of this application's object tree.
|
||||||
*/
|
*/
|
||||||
public Object getDataRoot(ScriptingEngine scriptingEngine) {
|
public Object getDataRoot(ScriptingEngine scriptingEngine) throws Exception {
|
||||||
// check if we have a custom root object class
|
// check if we have a custom root object class
|
||||||
if (rootObjectClass != null) {
|
if (rootObjectClass != null) {
|
||||||
// create custom root element.
|
// create custom root element.
|
||||||
|
@ -868,9 +869,13 @@ public final class Application implements Runnable {
|
||||||
} else if (rootObjectPropertyName != null) {
|
} else if (rootObjectPropertyName != null) {
|
||||||
// get root object from a global scripting engine property
|
// get root object from a global scripting engine property
|
||||||
return scriptingEngine.getGlobalProperty(rootObjectPropertyName);
|
return scriptingEngine.getGlobalProperty(rootObjectPropertyName);
|
||||||
|
} else if (rootObjectFunctionName != null) {
|
||||||
|
// get root object from a global script engine function
|
||||||
|
return scriptingEngine.invoke(null, rootObjectFunctionName,
|
||||||
|
RequestEvaluator.EMPTY_ARGS, ScriptingEngine.ARGS_WRAP_DEFAULT, true);
|
||||||
} else {
|
} else {
|
||||||
// no custom root object is defined - use standard helma objectmodel
|
// no custom root object is defined - use standard helma objectmodel
|
||||||
return nmgr.safe.getRootNode();
|
return nmgr.getRootNode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1827,6 +1832,7 @@ public final class Application implements Runnable {
|
||||||
|
|
||||||
hrefRootPrototype = props.getProperty("hrefrootprototype");
|
hrefRootPrototype = props.getProperty("hrefrootprototype");
|
||||||
rootObjectPropertyName = props.getProperty("rootobjectpropertyname");
|
rootObjectPropertyName = props.getProperty("rootobjectpropertyname");
|
||||||
|
rootObjectFunctionName = props.getProperty("rootobjectfunctionname");
|
||||||
|
|
||||||
// update the XML-RPC access list, containting prototype.method
|
// update the XML-RPC access list, containting prototype.method
|
||||||
// entries of functions that may be called via XML-RPC
|
// entries of functions that may be called via XML-RPC
|
||||||
|
|
Loading…
Add table
Reference in a new issue