INode n = new helma.objectmodel.db.Node(prototype, prototype,
if (c.app.isJavaPrototype(prototype)) { String classname = c.app.getJavaClassForPrototype(prototype); try { Class clazz = Class.forName(classname); Constructor[] cnst = clazz.getConstructors();   for (int i=0; i<cnst.length; i++) try { FunctionObject fo = new FunctionObject("ctor", cnst[i], engine.global); Object obj = fo.call(cx, engine.global, null, args); return cx.toObject(obj, engine.global); } catch (JavaScriptException x) { Object value = x.getValue(); if (value instanceof Throwable) { ((Throwable) value).printStackTrace(); } throw new JavaScriptException("Error in Java constructor: "+value); } catch (Exception ignore) {  } throw new ScriptingException("No matching Java Constructor found in "+clazz); } catch (Exception x) { System.err.println("Error in Java constructor: "+x); throw new JavaScriptException(x); } } else { INode n = new helma.objectmodel.db.Node(prototype, prototype,
    public static Object hopObjectConstructor(Context cx, Object[] args,                                              Function ctorObj, boolean inNewExpr)                         throws ScriptingException {        RhinoEngine engine = (RhinoEngine) cx.getThreadLocal("engine");        RhinoCore c = engine.core;        String prototype = ((FunctionObject) ctorObj).getFunctionName();        INode n = new helma.objectmodel.db.Node(prototype, prototype,                                                c.app.getWrappedNodeManager());        HopObject hobj = new HopObject(prototype);        hobj.init(c, n);        Scriptable p = c.getPrototype(prototype);        if (p != null) {            hobj.setPrototype(p);            engine.invoke(hobj, "constructor", args, false);        }        return hobj;    }