import org.ibex.crypto.*;
/** Singleton class that provides all functionality in the ibex.* namespace */
-public final class Ibex extends JS.Cloneable {
+public final class Ibex extends JS implements JS.Cloneable {
// FIXME remove this
private final JS rr;
- public Ibex(Stream rr) { this.rr = bless(rr); }
+ public Ibex(Stream rr) { try { this.rr = bless(rr);} catch(JSExn e) { throw new Error("should never happen"); } }
public JS resolveString(String str, boolean permitAbsolute) throws JSExn {
if (str.indexOf("://") != -1) {
case 1:
//#switch(name)
case "clone":
- if (!(a instanceof JS.Cloneable)) throw new JSExn("cannot clone a " + a.getClass().getName());
- return ((JS.Cloneable)a).jsclone();
+ if(a == null) throw new JSExn("can't clone the null value");
+ return ((JS)a).jsclone();
case "bless": return bless((JS)a);
case "ui.browser": Platform.newBrowserWindow((String)a); return null;
case "stream.unzip": return new Stream.Zip((Stream)a);
}
// FEATURE: move this into builtin.xwar
- public Blessing bless(JS b) { return new Ibex.Blessing((JS.Cloneable)b, this, null, null); }
+ public Blessing bless(JS b) throws JSExn { return new Ibex.Blessing(b, this, null, null); }
+ // FIXME: Does this really need to extends JS.Clone?
public static class Blessing extends JS.Clone {
private Ibex ibex;
private Template t = null;
public Object parentkey = null;
public Blessing parent = null;
private Hash cache = new Hash();
- public Blessing(JS.Cloneable clonee, Ibex ibex, Blessing parent, Object parentkey) {
+ public Blessing(JS clonee, Ibex ibex, Blessing parent, Object parentkey) throws JSExn {
super(clonee); this.ibex = ibex; this.parentkey = parentkey; this.parent = parent; }
public Object get(Object key) throws JSExn {
if (key.equals("")) return ((Object)getStatic());
if (cache.get(key) != null) return cache.get(key);
- Object ret = new Blessing((JS.Cloneable)clonee.get(key), ibex, this, key);
+ Object ret = new Blessing((JS)clonee.get(key), ibex, this, key);
cache.put(key, ret);
return ret;
}