Author: hannes
Date: 2008-12-18 14:57:31 +0100 (Thu, 18 Dec 2008)
New Revision: 9445
Modified:
helma/helma/trunk/src/helma/framework/core/Application.java
Log:
Add rootObjectFunctionName property that allows to define a function to get the app's root object.
Details at http://dev.helma.org/trac/helma/changeset/9445
Modified: helma/helma/trunk/src/helma/framework/core/Application.java
===================================================================
--- helma/helma/trunk/src/helma/framework/core/Application.java 2008-12-18 11:55:39 UTC (rev 9444)
+++ helma/helma/trunk/src/helma/framework/core/Application.java 2008-12-18 13:57:31 UTC (rev 9445)
@@ -73,6 +73,7 @@
// if defined this will cause us to get the root object straight
// from the scripting engine, circumventing all hopobject db fluff
String rootObjectPropertyName;
+ String rootObjectFunctionName;
// The session manager
SessionManager sessionMgr;
@@ -838,7 +839,7 @@
/**
* 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
if (rootObjectClass != null) {
// create custom root element.
@@ -868,9 +869,13 @@
} else if (rootObjectPropertyName != null) {
// get root object from a global scripting engine property
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 {
// no custom root object is defined - use standard helma objectmodel
- return nmgr.safe.getRootNode();
+ return nmgr.getRootNode();
}
}
@@ -1827,6 +1832,7 @@
hrefRootPrototype = props.getProperty("hrefrootprototype");
rootObjectPropertyName = props.getProperty("rootobjectpropertyname");
+ rootObjectFunctionName = props.getProperty("rootobjectfunctionname");
// update the XML-RPC access list, containting prototype.method
// entries of functions that may be called via XML-RPC
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.