mass rename and rebranding from xwt to ibex - fixed to use ixt files
[org.ibex.core.git] / src / org / ibex / Ibex.java
similarity index 90%
rename from src/org/xwt/XWT.java
rename to src/org/ibex/Ibex.java
index e5c443f..9431f1f 100644 (file)
@@ -1,21 +1,17 @@
 // Copyright 2004 Adam Megacz, see the COPYING file for licensing [GPL]
-package org.xwt;
+package org.ibex;
 
 import java.io.*;
-import java.net.*;
-import java.text.*;
-import java.util.*;
-import org.xwt.js.*;
-import org.xwt.util.*;
-import org.xwt.translators.*;
+import org.ibex.js.*;
+import org.ibex.util.*;
 import org.bouncycastle.util.encoders.Base64;
 
-/** Singleton class that provides all functionality in the xwt.* namespace */
-public final class XWT extends JS.Cloneable {
+/** Singleton class that provides all functionality in the ibex.* namespace */
+public final class Ibex extends JS.Cloneable {
 
     // FIXME remove this
     private final JS rr;
-    public XWT(Stream rr) { this.rr = bless(rr); }
+    public Ibex(Stream rr) { this.rr = bless(rr); }
 
     public JS resolveString(String str, boolean permitAbsolute) throws JSExn {
         if (str.indexOf("://") != -1) {
@@ -39,13 +35,13 @@ public final class XWT extends JS.Cloneable {
     private class Sub extends JS {
         String key;
         Sub(String key) { this.key = key; }
-        public void put(Object key, Object val) throws JSExn { XWT.this.put(this.key + "." + key, val); }
-        public Object get(Object key) throws JSExn { return XWT.this.get(this.key + "." + key); }
+        public void put(Object key, Object val) throws JSExn { Ibex.this.put(this.key + "." + key, val); }
+        public Object get(Object key) throws JSExn { return Ibex.this.get(this.key + "." + key); }
         public Object call(Object a0, Object a1, Object a2, Object[] rest, int nargs) throws JSExn {
-            return XWT.this.callMethod(this.key, a0, a1, a2, rest, nargs);
+            return Ibex.this.callMethod(this.key, a0, a1, a2, rest, nargs);
         }
         public Object callMethod(Object method, Object a0, Object a1, Object a2, Object[] rest, int nargs) throws JSExn {
-            return XWT.this.callMethod(this.key + "." + method, a0, a1, a2, rest, nargs);
+            return Ibex.this.callMethod(this.key + "." + method, a0, a1, a2, rest, nargs);
         }
     }
     private Cache subCache = new Cache(20);
@@ -58,8 +54,8 @@ public final class XWT extends JS.Cloneable {
     public Object get(Object name) throws JSExn {
         if (name instanceof String && ((String)name).length() == 0) return rr;
         //#switch(name)
-        case "math": return xwtMath;
-        case "string": return xwtString;
+        case "math": return ibexMath;
+        case "string": return ibexString;
         case "date": return METHOD;
         case "box": return new Box();
         case "clone": return METHOD;
@@ -134,7 +130,7 @@ public final class XWT extends JS.Cloneable {
             HTTP.Proxy.Authorization.waitingForUser.release();
             return;
         //#end
-        throw new JSExn("attempted to put unknown property: xwt."+name);
+        throw new JSExn("attempted to put unknown property: ibex."+name);
     }
 
     public Object callMethod(Object name, Object a, Object b, Object c, Object[] rest, int nargs) throws JSExn {
@@ -198,11 +194,11 @@ public final class XWT extends JS.Cloneable {
             }
         } catch (RuntimeException e) {
             // FIXME: maybe JSExn should take a second argument, Exception
-            Log.warn(this, "xwt."+name+"() threw: " + e);
-            throw new JSExn("invalid argument for xwt object method "+name+"()");
+            Log.warn(this, "ibex."+name+"() threw: " + e);
+            throw new JSExn("invalid argument for ibex object method "+name+"()");
         }
 
-        throw new JSExn("invalid number of arguments for xwt object method "+name+"()");
+        throw new JSExn("invalid number of arguments for ibex object method "+name+"()");
     }
 
     public Stream url2res(String url) throws JSExn {
@@ -228,7 +224,7 @@ public final class XWT extends JS.Cloneable {
         }
     }
     
-    public static final JSMath xwtMath = new JSMath() {
+    public static final JSMath ibexMath = new JSMath() {
             private JS gs = new JSScope.Global();
             public Object get(Object key) throws JSExn {
                 //#switch(key)
@@ -241,7 +237,7 @@ public final class XWT extends JS.Cloneable {
             }
         };
 
-    public static final JS xwtString = new JS() {
+    public static final JS ibexString = new JS() {
             private JS gs = new JSScope.Global();
             public void put(Object key, Object val) { }
             public Object get(Object key) throws JSExn {
@@ -306,16 +302,16 @@ public final class XWT extends JS.Cloneable {
     }
 
     // FEATURE: move this into builtin.xwar
-    public Blessing bless(JS b) { return new XWT.Blessing((JS.Cloneable)b, this, null, null); }
+    public Blessing bless(JS b) { return new Ibex.Blessing((JS.Cloneable)b, this, null, null); }
     public static class Blessing extends JS.Clone {
-        private XWT xwt;
+        private Ibex ibex;
         private Template t = null;
         private Object parentkey = null;
         private Blessing parent = null;
-        public Blessing(JS.Cloneable clonee, XWT xwt, Blessing parent, Object parentkey) {
-            super(clonee); this.xwt = xwt; this.parentkey = parentkey; this.parent = parent; }
+        public Blessing(JS.Cloneable clonee, Ibex ibex, Blessing parent, Object parentkey) {
+            super(clonee); this.ibex = ibex; this.parentkey = parentkey; this.parent = parent; }
         public Object get(Object key) throws JSExn {
-            return key.equals("") ? ((Object)getStatic()) : (new Blessing((JS.Cloneable)clonee.get(key), xwt, this, key));
+            return key.equals("") ? ((Object)getStatic()) : (new Blessing((JS.Cloneable)clonee.get(key), ibex, this, key));
         }
         public static Blessing getBlessing(Object o) {
             if (!(o instanceof JS)) return null;
@@ -340,7 +336,7 @@ public final class XWT extends JS.Cloneable {
         public JSScope getStatic() {
             try {
                 // FIXME background?
-                if (t == null) t = Template.buildTemplate(Stream.getInputStream(parent.get(parentkey + ".xwt")), xwt);
+                if (t == null) t = Template.buildTemplate(Stream.getInputStream(parent.get(parentkey + ".ixt")), ibex);
                 return t.staticScope;
             } catch (Exception e) {
                 Log.error(this, e);