From d8b1f178ad48f9d8decc6c6585f412198920934d Mon Sep 17 00:00:00 2001 From: hns Date: Fri, 28 Nov 2003 18:27:35 +0000 Subject: [PATCH] Various minor enhancements and cleanups: * Implemented rootId property to set the id of the app's root object * Do not call invokeFunction with a null argument array * Implement toString() method * Plus some more minor stuff --- src/helma/framework/core/Application.java | 30 ++++++++++++++--------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/helma/framework/core/Application.java b/src/helma/framework/core/Application.java index 27cfbbcc..8450c3c7 100644 --- a/src/helma/framework/core/Application.java +++ b/src/helma/framework/core/Application.java @@ -345,8 +345,6 @@ public final class Application implements IPathElement, Runnable { worker = new Thread(this, "Worker-" + name); worker.setPriority(Thread.NORM_PRIORITY + 1); worker.start(); - - // logEvent ("session cleanup and scheduler thread started"); } /** @@ -668,10 +666,8 @@ public final class Application implements IPathElement, Runnable { } // no custom root object is defined - use standard helma objectmodel else { - // INode root = nmgr.safe.getNode ("0", rootMapping); - // root.setDbMapping (rootMapping); - // rootObject = root; - rootObject = nmgr.safe.getNode("0", rootMapping); + String rootId = props.getProperty("rootid", "0"); + rootObject = nmgr.safe.getNode(rootId, rootMapping); return rootObject; } @@ -1126,13 +1122,17 @@ public final class Application implements IPathElement, Runnable { private Object invokeFunction(Object obj, String func, Object[] args) { RequestEvaluator reval = getCurrentRequestEvaluator(); + if (args == null) { + args = new Object[0]; + } + if (reval != null) { try { return reval.invokeDirectFunction(obj, func, args); } catch (Exception x) { if (debug) { - System.err.println("Error in Application.invokeFunction (" + func + - "): " + x); + System.err.println("Error in Application.invokeFunction (" + + func + "): " + x); } } } @@ -1163,7 +1163,7 @@ public final class Application implements IPathElement, Runnable { return ((IPathElement) obj).getElementName(); } - Object retval = invokeFunction(obj, "getElementName", null); + Object retval = invokeFunction(obj, "getElementName", new Object[0]); if (retval != null) { return retval.toString(); @@ -1195,7 +1195,7 @@ public final class Application implements IPathElement, Runnable { return ((IPathElement) obj).getParentElement(); } - return invokeFunction(obj, "getParentElement", null); + return invokeFunction(obj, "getParentElement", new Object[0]); } /** @@ -1263,7 +1263,7 @@ public final class Application implements IPathElement, Runnable { return "application"; } - ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////// /** * Get the logger object for logging generic events @@ -1465,7 +1465,6 @@ public final class Application implements IPathElement, Runnable { try { Thread.sleep(sleepInterval); } catch (InterruptedException x) { - logEvent("Scheduler for " + name + " interrupted"); worker = null; break; } @@ -1695,6 +1694,13 @@ public final class Application implements IPathElement, Runnable { return xmlrpcHandlerName; } + /** + * Return a string representation for this app. + */ + public String toString() { + return "[Application "+name+"]"; + } + /** * */