cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r751312 - in /cxf/trunk: parent/ rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/ rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/ rt/javascript/src/test/java/org/apache/cxf/javascript/ rt/javascript/src/test/resources/
Date Sat, 07 Mar 2009 19:40:12 GMT
Author: bimargulies
Date: Sat Mar  7 19:40:11 2009
New Revision: 751312

URL: http://svn.apache.org/viewvc?rev=751312&view=rev
Log:
CXF-2094, plus update to Rhino 1.7R1, which I needed to debug this.

Modified:
    cxf/trunk/parent/pom.xml
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanTypeInfo.java
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanTypePropertyInfo.java
    cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/XMLBeanTypeInfo.java
    cxf/trunk/rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/AbstractDOMProvider.java
    cxf/trunk/rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/ProviderFactory.java
    cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AegisTest.java
    cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JavascriptTestUtilities.java
    cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsNamedNodeMap.java
    cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsSimpleDomNode.java
    cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsSimpleDomParser.java
    cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsXMLHttpRequest.java
    cxf/trunk/rt/javascript/src/test/resources/AegisBeans.xml

Modified: cxf/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/parent/pom.xml?rev=751312&r1=751311&r2=751312&view=diff
==============================================================================
--- cxf/trunk/parent/pom.xml (original)
+++ cxf/trunk/parent/pom.xml Sat Mar  7 19:40:11 2009
@@ -52,7 +52,7 @@
         <jaxb.xjc.version>2.1.9</jaxb.xjc.version>
         <jdom.version>1.0</jdom.version>
         <jetty.version>6.1.11</jetty.version>
-        <rhino.version>1.6R7</rhino.version>
+        <rhino.version>1.7R1</rhino.version>
         <saaj.version>1.3</saaj.version>
         <spring.version>2.5.5</spring.version>
         <spring.mock>spring-test</spring.mock>

Modified: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java?rev=751312&r1=751311&r2=751312&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanType.java
Sat Mar  7 19:40:11 2009
@@ -444,27 +444,21 @@
             XmlSchemaUtils.addImportIfNeeded(schemaRoot, type.getSchemaType().getNamespaceURI());
 
             /*
-             * This seems to bespeak some sort of confusion. The problem is that
-             * no one ever implemented getMinOccurs(name) to even look at the per-element
data.
+             * Here we have a semi-giant mess. If a parameter has a minOccurs > 1, it
ends
+             * up in the type info. However, it really got used in the array type.
+             * All we really want to do here is manage 'optional' elements. If we 
+             * ever implement flat arrays, this will change. For now, we ignore
+             * maxOccurs and we only look for 0's in the minOccurs. 
              */
-            long minOccurs = -1;
-            long maxOccurs = -1;
-            if (type instanceof ArrayType) {
-                ArrayType arrayType = (ArrayType) type;
-                minOccurs = arrayType.getMinOccurs();
-                maxOccurs = arrayType.getMaxOccurs();
-            } else {
-                minOccurs = getTypeInfo().getMinOccurs(name);
-            }
-            /*
-             * Old code had ridiculous '!=0' here, which cannot have been right.
+            long minOccurs = getTypeInfo().getMinOccurs(name);
+            /* If it is 1, that's the default, and if it's greater than one, it means
+             * that there is a real array at work here. So the only value we want to pay
+             * attention to is 0.
              */
-            if (minOccurs != -1) {
+            if (minOccurs == 0) {
                 element.setMinOccurs(minOccurs);
             }
-            if (maxOccurs != -1) {
-                element.setMaxOccurs(maxOccurs);
-            }
+
             
             element.setNillable(getTypeInfo().isNillable(name));
         } else {

Modified: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanTypeInfo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanTypeInfo.java?rev=751312&r1=751311&r2=751312&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanTypeInfo.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanTypeInfo.java
Sat Mar  7 19:40:11 2009
@@ -379,10 +379,28 @@
         return nillable;
     }
 
+    /**
+     * Return the minOccurs value. When there is no XML file or annotation (the situation
+     * if we are running from the base class here), there is no source for the 
+     * minOccurs parameter except the default, which is supplied from the overall Aegis options.
+     * @param name Element QName
+     * @return
+     */
     public int getMinOccurs(QName name) {
         return minOccurs;
     }
     
+    /**
+     * Return the maxOccurs value. When there is no XML file or annotation (the situation
+     * if we are in the base class here), there is no per-element source for this item,
+     * and the value is always 1.
+     * @param name Element QName
+     * @return 1
+     */
+    public int getMaxOccurs(QName name) {
+        return 1;
+    }
+    
     public long getMinOccurs() {
         return minOccurs;
     }

Modified: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanTypePropertyInfo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanTypePropertyInfo.java?rev=751312&r1=751311&r2=751312&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanTypePropertyInfo.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/BeanTypePropertyInfo.java
Sat Mar  7 19:40:11 2009
@@ -22,6 +22,7 @@
     private boolean nillable;
 
     private int minOccurs = 1;
+    private int maxOccurs = 1;
 
     public int getMinOccurs() {
         return minOccurs;
@@ -38,4 +39,12 @@
     public void setNillable(boolean nillable) {
         this.nillable = nillable;
     }
+
+    public int getMaxOccurs() {
+        return maxOccurs;
+    }
+
+    public void setMaxOccurs(int maxOccurs) {
+        this.maxOccurs = maxOccurs;
+    }
 }

Modified: cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/XMLBeanTypeInfo.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/XMLBeanTypeInfo.java?rev=751312&r1=751311&r2=751312&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/XMLBeanTypeInfo.java
(original)
+++ cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/basic/XMLBeanTypeInfo.java
Sat Mar  7 19:40:11 2009
@@ -152,6 +152,10 @@
             if (minOccurs != null && minOccurs.length() > 0) {
                 ensurePropertyInfo(mappedName).setMinOccurs(Integer.parseInt(minOccurs));
             }
+            String maxOccurs = DOMUtils.getAttributeValueEmptyNull(e, "maxOccurs");
+            if (maxOccurs != null && maxOccurs.length() > 0) {
+                ensurePropertyInfo(mappedName).setMinOccurs(Integer.parseInt(maxOccurs));
+            }
         }
 
         try {
@@ -202,8 +206,8 @@
     }
 
     /**
-     * Grab Min Occurs by looking in PropertyInfo map if no entry found, revert
-     * to parent class
+     * Return minOccurs if specified in the XML, otherwise from the defaults
+     * in the base class.
      */
     @Override
     public int getMinOccurs(QName name) {
@@ -215,6 +219,19 @@
     }
 
     /**
+     * Return maxOccurs if specified in the XML, otherwise from the
+     * default in the base class.
+     */
+    @Override
+    public int getMaxOccurs(QName name) {
+        BeanTypePropertyInfo info = getPropertyInfo(name);
+        if (info != null) {
+            return info.getMaxOccurs();
+        }
+        return super.getMaxOccurs(name);
+    }
+
+    /**
      * Grab the Property Info for the given property
      * 
      * @param name

Modified: cxf/trunk/rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/AbstractDOMProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/AbstractDOMProvider.java?rev=751312&r1=751311&r2=751312&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/AbstractDOMProvider.java
(original)
+++ cxf/trunk/rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/AbstractDOMProvider.java
Sat Mar  7 19:40:11 2009
@@ -36,6 +36,7 @@
 import org.apache.xmlbeans.XmlObject;
 
 import org.mozilla.javascript.Context;
+import org.mozilla.javascript.ContextFactory;
 import org.mozilla.javascript.Function;
 import org.mozilla.javascript.Scriptable;
 import org.mozilla.javascript.ScriptableObject;
@@ -152,7 +153,7 @@
 
     public DOMSource invoke(DOMSource request) {
         DOMSource response = new DOMSource();
-        Context cx = Context.enter();
+        Context cx = ContextFactory.getGlobal().enterContext();
         try {
             Scriptable scope = cx.newObject(scriptScope);
             scope.setPrototype(scriptScope);

Modified: cxf/trunk/rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/ProviderFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/ProviderFactory.java?rev=751312&r1=751311&r2=751312&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/ProviderFactory.java (original)
+++ cxf/trunk/rt/frontend/js/src/main/java/org/apache/cxf/js/rhino/ProviderFactory.java Sat
Mar  7 19:40:11 2009
@@ -83,7 +83,7 @@
         }
         String scriptStr = sb.toString();
 
-        Context cx = Context.enter();
+        Context cx = ContextFactory.getGlobal().enterContext();
         boolean providerFound = false;
         try {
             Scriptable scriptScope = cx.initStandardObjects(null, true);

Modified: cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AegisTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AegisTest.java?rev=751312&r1=751311&r2=751312&view=diff
==============================================================================
--- cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AegisTest.java (original)
+++ cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/AegisTest.java Sat Mar
 7 19:40:11 2009
@@ -135,7 +135,6 @@
         return null;
     }
 
-    @org.junit.Ignore
     @Test
     public void callReturnBeanWithAnyTypeArray() {
         testUtilities.runInsideContext(Void.class, new JSRunnable<Void>() {

Modified: cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JavascriptTestUtilities.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JavascriptTestUtilities.java?rev=751312&r1=751311&r2=751312&view=diff
==============================================================================
--- cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JavascriptTestUtilities.java
(original)
+++ cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JavascriptTestUtilities.java
Sat Mar  7 19:40:11 2009
@@ -22,11 +22,14 @@
 import java.io.IOException;
 import java.io.Reader;
 import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
 import java.util.Collection;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.javascript.service.ServiceJavascriptBuilder;
 import org.apache.cxf.javascript.types.SchemaJavascriptBuilder;
@@ -41,7 +44,6 @@
 import org.mozilla.javascript.RhinoException;
 import org.mozilla.javascript.Scriptable;
 import org.mozilla.javascript.ScriptableObject;
-import org.mozilla.javascript.tools.debugger.Main;
 
 /**
  * Test utilities class with some Javascript capability included.
@@ -170,11 +172,22 @@
 
         rhinoContextFactory = new ContextFactory();
         if (System.getProperty("cxf.jsdebug") != null && !rhinoDebuggerUp) {
-            Main.mainEmbedded(rhinoContextFactory, rhinoScope, "Debug embedded JavaScript.");
-            rhinoDebuggerUp = true;
+            try {
+                Class<?> debuggerMain = 
+                            ClassLoaderUtils.loadClass("org.mozilla.javascript.tools.debugger.Main",
+                                                                   getClass());
+                if (debuggerMain != null) {
+                    Method mainMethod = debuggerMain.getMethod("mainEmbedded", ContextFactory.class,
+                                                               Scriptable.class, String.class);
+                    mainMethod.invoke(null, rhinoContextFactory, rhinoScope, "Debug embedded
JavaScript.");
+                    rhinoDebuggerUp = true;
+                }
+            } catch (Exception e) {
+                LOG.log(Level.WARNING, "Failed to launch Rhino debugger", e);
+            }
         }
 
-        rhinoContext = rhinoContextFactory.enter();
+        rhinoContext = rhinoContextFactory.enterContext();
         rhinoScope = rhinoContext.initStandardObjects();
 
         try {
@@ -192,7 +205,7 @@
         } catch (InvocationTargetException e) {
             throw new RuntimeException(e);
         } finally {
-            rhinoContextFactory.exit();
+            Context.exit();
         }
         JsSimpleDomNode.register(rhinoScope);
         JsSimpleDomParser.register(rhinoScope);
@@ -202,21 +215,21 @@
 
     public void readResourceIntoRhino(String resourceClasspath) throws IOException {
         Reader js = getResourceAsReader(resourceClasspath);
-        rhinoContextFactory.enter(rhinoContext);
+        rhinoContextFactory.enterContext(rhinoContext);
         try {
             rhinoContext.evaluateReader(rhinoScope, js, resourceClasspath, 1, null);
         } finally {
-            rhinoContextFactory.exit();
+            Context.exit();
         }
     }
 
     public void readStringIntoRhino(String js, String sourceName) {
         LOG.fine(sourceName + ":\n" + js);
-        rhinoContextFactory.enter(rhinoContext);
+        rhinoContextFactory.enterContext(rhinoContext);
         try {
             rhinoContext.evaluateString(rhinoScope, js, sourceName, 1, null);
         } finally {
-            rhinoContextFactory.exit();
+            Context.exit();
         }
     }
 
@@ -233,11 +246,11 @@
     }
 
     public <T> T runInsideContext(Class<T> clazz, JSRunnable<?> runnable)
{
-        rhinoContextFactory.enter(rhinoContext);
+        rhinoContextFactory.enterContext(rhinoContext);
         try {
             return clazz.cast(runnable.run(rhinoContext));
         } finally {
-            rhinoContextFactory.exit();
+            Context.exit();
         }
     }
 

Modified: cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsNamedNodeMap.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsNamedNodeMap.java?rev=751312&r1=751311&r2=751312&view=diff
==============================================================================
--- cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsNamedNodeMap.java (original)
+++ cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsNamedNodeMap.java Sat
Mar  7 19:40:11 2009
@@ -24,6 +24,7 @@
 import org.w3c.dom.NamedNodeMap;
 
 import org.mozilla.javascript.Context;
+import org.mozilla.javascript.ContextFactory;
 import org.mozilla.javascript.Scriptable;
 import org.mozilla.javascript.ScriptableObject;
 
@@ -74,7 +75,7 @@
     }
     
     public static JsNamedNodeMap wrapMap(Scriptable scope, NamedNodeMap map) {
-        Context cx = Context.enter();
+        Context cx = ContextFactory.getGlobal().enterContext();
         JsNamedNodeMap newObject = (JsNamedNodeMap)cx.newObject(scope, "NamedNodeMap");
         newObject.initialize(map);
         return newObject;

Modified: cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsSimpleDomNode.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsSimpleDomNode.java?rev=751312&r1=751311&r2=751312&view=diff
==============================================================================
--- cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsSimpleDomNode.java (original)
+++ cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsSimpleDomNode.java Sat
Mar  7 19:40:11 2009
@@ -28,11 +28,12 @@
 import org.w3c.dom.Node;
 
 import org.mozilla.javascript.Context;
+import org.mozilla.javascript.ContextFactory;
 import org.mozilla.javascript.Scriptable;
 import org.mozilla.javascript.ScriptableObject;
 
 /**
- * A Rhino wrapper around org.w3c.dom.Node. Not comprehensive, but enough to test CXF JavaScript.

+ * A Rhino wrapper around org.w3c.dom.Node. Not comprehensive, but enough to test CXF JavaScript.
  */
 public class JsSimpleDomNode extends ScriptableObject {
     private Node wrappedNode;
@@ -48,7 +49,7 @@
      */
     public JsSimpleDomNode() {
     }
-    
+
     public static void register(ScriptableObject scope) {
         try {
             ScriptableObject.defineClass(scope, JsSimpleDomNode.class);
@@ -60,85 +61,85 @@
             throw new RuntimeException(e);
         }
     }
-    
+
     @Override
     public String getClassName() {
         return "Node";
     }
-    
+
     public Node getWrappedNode() {
         return wrappedNode;
     }
-    
-    //CHECKSTYLE:OFF
+
+    // CHECKSTYLE:OFF
     public String jsGet_localName() {
-        return wrappedNode.getLocalName();       
+        return wrappedNode.getLocalName();
     }
-    
+
     public String jsGet_namespaceURI() {
         return wrappedNode.getNamespaceURI();
     }
-    
+
     public Object jsGet_firstChild() {
         establishChildren();
         if (children.size() > 0)
             return children.get(0);
-        else 
+        else
             return null;
     }
 
     public Object jsGet_nextSibling() {
-        return nextSibling; 
+        return nextSibling;
     }
 
     public Object jsGet_previousSibling() {
-        return previousSibling; 
+        return previousSibling;
     }
-    
+
     public Object jsGet_parentNode() {
         // risk errors in object equality ...
         return wrapNode(this, wrappedNode.getParentNode());
     }
-    
+
     public int jsGet_nodeType() {
         return wrappedNode.getNodeType();
     }
-    
+
     public String jsGet_nodeValue() {
         return wrappedNode.getNodeValue();
     }
-    
+
     public String jsGet_nodeName() {
         return wrappedNode.getNodeName();
     }
-    
+
     // in a more complete version of this, we'd use a different object type to wrap documents.
     public Object jsGet_documentElement() {
-        if(9 /* Document */ != wrappedNode.getNodeType()) {
+        if (9 /* Document */!= wrappedNode.getNodeType()) {
             return null;
         } else {
             establishChildren();
             return children.get(0); // it is, after all, just a convenience feature.
         }
     }
-    
+
     public Object[] jsGet_childNodes() {
         establishChildren();
         return children.toArray();
     }
-    
+
     public Object jsGet_attributes() {
         establishAttributes();
         return attributes;
     }
-    
+
     public String jsFunction_getAttributeNS(String namespaceURI, String localName) {
         NamedNodeMap attributes = wrappedNode.getAttributes();
         Node attrNode = attributes.getNamedItemNS(namespaceURI, localName);
-        if(attrNode == null) {
+        if (attrNode == null) {
             return null;
         } else {
-            Attr attribute = (Attr) attrNode;
+            Attr attribute = (Attr)attrNode;
             return attribute.getValue();
         }
     }
@@ -146,32 +147,40 @@
     public String jsFunction_getAttribute(String localName) {
         NamedNodeMap attributes = wrappedNode.getAttributes();
         Node attrNode = attributes.getNamedItem(localName);
-        if(attrNode == null) {
+        if (attrNode == null) {
             return null;
         } else {
-            Attr attribute = (Attr) attrNode;
+            Attr attribute = (Attr)attrNode;
             return attribute.getValue();
         }
     }
 
-    //CHECKSTYLE:ON
-    
+    // CHECKSTYLE:ON
+
     public static JsSimpleDomNode wrapNode(Scriptable scope, Node node) {
         if (node == null) {
             return null;
         }
-        
-        Context cx = Context.enter();
-        JsSimpleDomNode newObject = (JsSimpleDomNode)cx.newObject(scope, "Node");
-        newObject.initialize(node, null);
-        return newObject;
+
+        Context cx = ContextFactory.getGlobal().enterContext();
+        try {
+            JsSimpleDomNode newObject = (JsSimpleDomNode)cx.newObject(scope, "Node");
+            newObject.initialize(node, null);
+            return newObject;
+        } finally {
+            Context.exit();
+        }
     }
-    
+
     private JsSimpleDomNode newObject(Node node, JsSimpleDomNode prev) {
-        Context cx = Context.enter();
-        JsSimpleDomNode newObject = (JsSimpleDomNode)cx.newObject(getParentScope(), "Node");
-        newObject.initialize(node, prev);
-        return newObject;
+        Context cx = ContextFactory.getGlobal().enterContext();
+        try {
+            JsSimpleDomNode newObject = (JsSimpleDomNode)cx.newObject(getParentScope(), "Node");
+            newObject.initialize(node, prev);
+            return newObject;
+        } finally {
+            Context.exit();
+        }
     }
 
     private void establishChildren() {
@@ -183,12 +192,12 @@
                 while (node != null) {
                     JsSimpleDomNode prev = null;
                     if (x > 0) {
-                        prev = (JsSimpleDomNode)children.get(x - 1); 
+                        prev = (JsSimpleDomNode)children.get(x - 1);
                     }
                     children.add(x, newObject(node, prev));
                     if (x > 0) {
                         children.get(x - 1).setNext(children.get(x));
-                    }                    
+                    }
                     node = node.getNextSibling();
                     x++;
                 }
@@ -198,7 +207,7 @@
             childrenWrapped = true;
         }
     }
-    
+
     private void establishAttributes() {
         if (!attributesWrapped) {
             NamedNodeMap nodeAttributes = wrappedNode.getAttributes();
@@ -207,16 +216,15 @@
         }
     }
 
-    //rhino won't let us use a constructor.
+    // rhino won't let us use a constructor.
     void initialize(Node node, JsSimpleDomNode prev) {
         wrappedNode = node;
         childrenWrapped = false;
         previousSibling = prev;
     }
-    
-    void setNext(JsSimpleDomNode next)  {
+
+    void setNext(JsSimpleDomNode next) {
         nextSibling = next;
     }
 
-
 }

Modified: cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsSimpleDomParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsSimpleDomParser.java?rev=751312&r1=751311&r2=751312&view=diff
==============================================================================
--- cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsSimpleDomParser.java
(original)
+++ cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsSimpleDomParser.java
Sat Mar  7 19:40:11 2009
@@ -33,15 +33,16 @@
 import org.xml.sax.SAXException;
 
 import org.mozilla.javascript.Context;
+import org.mozilla.javascript.ContextFactory;
 import org.mozilla.javascript.ScriptableObject;
 
 /**
  * A Rhino wrapper to define DOMParser.
  */
 public class JsSimpleDomParser extends ScriptableObject {
-    
+
     private DocumentBuilder documentBuilder;
-    
+
     public JsSimpleDomParser() {
         try {
             DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
@@ -52,7 +53,7 @@
             throw new RuntimeException(e);
         }
     }
-    
+
     public static void register(ScriptableObject scope) {
         try {
             ScriptableObject.defineClass(scope, JsSimpleDomParser.class);
@@ -69,9 +70,9 @@
     public String getClassName() {
         return "DOMParser";
     }
-    
-    //CHECKSTYLE:OFF
-    
+
+    // CHECKSTYLE:OFF
+
     public Object jsFunction_parseFromString(String xml, String mimeType) {
         StringReader reader = new StringReader(xml);
         InputSource inputSource = new InputSource(reader);
@@ -83,13 +84,17 @@
         } catch (IOException e) {
             throw new RuntimeException(e);
         }
-        
-        Context context = Context.enter();
-        JsSimpleDomNode domNode = (JsSimpleDomNode)context.newObject(getParentScope(), "Node");
-        domNode.initialize(document, null);
-        return domNode;
+
+        Context context = ContextFactory.getGlobal().enterContext();
+        try {
+            JsSimpleDomNode domNode = (JsSimpleDomNode)context.newObject(getParentScope(),
"Node");
+            domNode.initialize(document, null);
+            return domNode;
+        } finally {
+            Context.exit();
+        }
     }
 
-    //CHECKSTYLE:ON
+    // CHECKSTYLE:ON
 
 }

Modified: cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsXMLHttpRequest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsXMLHttpRequest.java?rev=751312&r1=751311&r2=751312&view=diff
==============================================================================
--- cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsXMLHttpRequest.java
(original)
+++ cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsXMLHttpRequest.java
Sat Mar  7 19:40:11 2009
@@ -57,6 +57,7 @@
 import org.jdom.input.DOMBuilder;
 import org.jdom.output.XMLOutputter;
 import org.mozilla.javascript.Context;
+import org.mozilla.javascript.ContextFactory;
 import org.mozilla.javascript.Function;
 import org.mozilla.javascript.JavaScriptException;
 import org.mozilla.javascript.ScriptableObject;
@@ -325,7 +326,7 @@
             new Thread() {
                 public void run() {
                     try {
-                        Context cx = Context.enter();
+                        Context cx = ContextFactory.getGlobal().enterContext();
                         communicate(cx);
                     } finally {
                         Context.exit();

Modified: cxf/trunk/rt/javascript/src/test/resources/AegisBeans.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/javascript/src/test/resources/AegisBeans.xml?rev=751312&r1=751311&r2=751312&view=diff
==============================================================================
--- cxf/trunk/rt/javascript/src/test/resources/AegisBeans.xml (original)
+++ cxf/trunk/rt/javascript/src/test/resources/AegisBeans.xml Sat Mar  7 19:40:11 2009
@@ -33,6 +33,29 @@
 	<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
 	<import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
 	<import resource="classpath:META-INF/cxf/cxf-extension-javascript-client.xml" />
+	<!-- 
+	 <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
+     <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
+	
+    <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
+        <property name="inInterceptors">
+            <list>
+                <ref bean="logInbound"/>
+            </list>
+        </property>
+        <property name="outInterceptors">
+            <list>
+                <ref bean="logOutbound"/>
+            </list>
+        </property>
+        <property name="outFaultInterceptors">
+            <list>
+                <ref bean="logOutbound"/>
+            </list>
+        </property>
+    </bean>
+    --> 
+	
 
 	<simple:server id="aegis-service"
 		serviceClass="org.apache.cxf.javascript.fortest.AegisService"



Mime
View raw message