jakarta-bsf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r591065 - in /jakarta/bsf/trunk/bsf3: bsf-api/src/main/java/javax/script/ScriptEngineManager.java testing/e4x-1.6R7-Axiom/src/test/java/org/apache/bsf/testing/e4x/HelloTestCase.java
Date Thu, 01 Nov 2007 16:06:18 GMT
Author: antelder
Date: Thu Nov  1 09:06:18 2007
New Revision: 591065

URL: http://svn.apache.org/viewvc?rev=591065&view=rev
Log:
Enhance so BSF Scriptmanager calls xmlhelper init if the bsfutils jar is available so clients
using bsf don't have to do that

Modified:
    jakarta/bsf/trunk/bsf3/bsf-api/src/main/java/javax/script/ScriptEngineManager.java
    jakarta/bsf/trunk/bsf3/testing/e4x-1.6R7-Axiom/src/test/java/org/apache/bsf/testing/e4x/HelloTestCase.java

Modified: jakarta/bsf/trunk/bsf3/bsf-api/src/main/java/javax/script/ScriptEngineManager.java
URL: http://svn.apache.org/viewvc/jakarta/bsf/trunk/bsf3/bsf-api/src/main/java/javax/script/ScriptEngineManager.java?rev=591065&r1=591064&r2=591065&view=diff
==============================================================================
--- jakarta/bsf/trunk/bsf3/bsf-api/src/main/java/javax/script/ScriptEngineManager.java (original)
+++ jakarta/bsf/trunk/bsf3/bsf-api/src/main/java/javax/script/ScriptEngineManager.java Thu
Nov  1 09:06:18 2007
@@ -19,6 +19,7 @@
 
 package javax.script;
 
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -93,9 +94,25 @@
                 mimeTypeAssociations.put(data.get(i), factory);
             }            
         }
+        
+        initXMLHelper(loader);
     }
-	
+
     /**
+     * Initialise the xml helper here so BSF clients don't have to.
+     * (Temporary approach for beta2 release)
+     */
+    private void initXMLHelper(ClassLoader loader) {
+    	try {
+			Class xmlHelperClass = Class.forName("org.apache.bsf.xml.XMLHelper", true, loader);
+			Method initMethod = xmlHelperClass.getMethod("init", new Class[]{});
+			initMethod.invoke(null, new Object[]{});
+		} catch (Throwable e) {
+			// ignore
+		}
+	}
+
+	/**
      * Retrieves the associated value for the spefied key in the 
      * GLOBAL_SCOPE
      *  

Modified: jakarta/bsf/trunk/bsf3/testing/e4x-1.6R7-Axiom/src/test/java/org/apache/bsf/testing/e4x/HelloTestCase.java
URL: http://svn.apache.org/viewvc/jakarta/bsf/trunk/bsf3/testing/e4x-1.6R7-Axiom/src/test/java/org/apache/bsf/testing/e4x/HelloTestCase.java?rev=591065&r1=591064&r2=591065&view=diff
==============================================================================
--- jakarta/bsf/trunk/bsf3/testing/e4x-1.6R7-Axiom/src/test/java/org/apache/bsf/testing/e4x/HelloTestCase.java
(original)
+++ jakarta/bsf/trunk/bsf3/testing/e4x-1.6R7-Axiom/src/test/java/org/apache/bsf/testing/e4x/HelloTestCase.java
Thu Nov  1 09:06:18 2007
@@ -44,10 +44,6 @@
 	private XMLHelper xmlHelper;
 	private ScriptEngine engine;
 	
-	static {
-        XMLHelper.init();
-	}
-
 	public void testInvokeFunctionInXML() throws ScriptException, XMLStreamException, FactoryConfigurationError,
NoSuchMethodException {
 		engine.eval("function isXML(xml) { return typeof xml == 'xml'; }" );
 		assertTrue(engine instanceof Invocable);



---------------------------------------------------------------------
To unsubscribe, e-mail: bsf-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bsf-dev-help@jakarta.apache.org


Mime
View raw message