Oops, I didn't notice that it had been removed. My mistake. Service
definition was restored in rev 1298269.
-Adrian
On 3/8/2012 3:51 AM, Chatree Srichart wrote:
Hi Adrianc,
testBsh service still be used by some places which causes the
/webtools/control/ServiceList request does not work.
Regards,
Chatree Srichart
On Tue, Mar 6, 2012 at 9:06 PM,<[email protected]> wrote:
Author: adrianc
Date: Tue Mar 6 14:06:13 2012
New Revision: 1297478
URL: http://svn.apache.org/viewvc?rev=1297478&view=rev
Log:
More JSR-223 work - added a bsh engine so that bsh-specific code can be
eliminated. Bsh is now invoked using JSR-223.
The engine comes from http://java.net/projects/scripting. I had to modify
the code slightly because the BshScriptEngine implemented Compilable - but
the Compilable methods were not implemented. So I removed implements
Compilable. I renamed the jar to signify that the code has been modified.
Added:
ofbiz/trunk/framework/base/lib/bsh-engine-modified.jar (with props)
ofbiz/trunk/framework/base/src/META-INF/services/javax.script.ScriptEngineFactory
Modified:
ofbiz/trunk/LICENSE
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ScriptUtil.java
ofbiz/trunk/framework/common/servicedef/services_test.xml
Modified: ofbiz/trunk/LICENSE
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/LICENSE?rev=1297478&r1=1297477&r2=1297478&view=diff
==============================================================================
--- ofbiz/trunk/LICENSE (original)
+++ ofbiz/trunk/LICENSE Tue Mar 6 14:06:13 2012
@@ -505,6 +505,7 @@ The following libraries distributed with
BSD License:
ofbiz/trunk/applications/content/lib/dom4j-1.6.1.jar
ofbiz/trunk/framework/base/lib/antisamy-bin.1.2.jar
+ofbiz/trunk/framework/base/lib/bsh-engine-modified.jar
ofbiz/trunk/framework/base/lib/freemarker-2.3.10.jar
ofbiz/trunk/framework/base/lib/hamcrest-all-1.2.jar
ofbiz/trunk/framework/base/lib/httpunit.jar
Added: ofbiz/trunk/framework/base/lib/bsh-engine-modified.jar
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/lib/bsh-engine-modified.jar?rev=1297478&view=auto
==============================================================================
Binary file - no diff available.
Propchange: ofbiz/trunk/framework/base/lib/bsh-engine-modified.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
ofbiz/trunk/framework/base/src/META-INF/services/javax.script.ScriptEngineFactory
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/META-INF/services/javax.script.ScriptEngineFactory?rev=1297478&view=auto
==============================================================================
---
ofbiz/trunk/framework/base/src/META-INF/services/javax.script.ScriptEngineFactory
(added)
+++
ofbiz/trunk/framework/base/src/META-INF/services/javax.script.ScriptEngineFactory
Tue Mar 6 14:06:13 2012
@@ -0,0 +1 @@
+bsh.engine.BshScriptEngineFactory
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ScriptUtil.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ScriptUtil.java?rev=1297478&r1=1297477&r2=1297478&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ScriptUtil.java
(original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ScriptUtil.java Tue
Mar 6 14:06:13 2012
@@ -190,10 +190,6 @@ public final class ScriptUtil {
if (scriptClass != null) {
return InvokerHelper.createScript(scriptClass,
GroovyUtil.getBinding(inputMap)).run();
}
- // TODO: Remove beanshell check when all beanshell code has been
removed.
- if ("bsh".equals(language)) {
- return BshUtil.eval(script,
UtilMisc.makeMapWritable(inputMap));
- }
try {
CompiledScript compiledScript = compileScriptString(language,
script);
if (compiledScript != null) {
@@ -311,11 +307,6 @@ public final class ScriptUtil {
public static Object executeScript(String filePath, String
functionName, Map<String, ? extends Object> context, Object[] args) {
Assert.notNull("filePath", filePath, "context", context);
try {
- String fileExtension = getFileExtension(filePath);
- // TODO: Remove beanshell check when all beanshell code has
been removed.
- if ("bsh".equals(fileExtension)) {
- return BshUtil.runBshAtLocation(filePath, context);
- }
return executeScript(filePath, functionName,
createScriptContext(context), args);
} catch (Exception e) {
String errMsg = "Error running script at location [" +
filePath + "]: " + e.toString();
Modified: ofbiz/trunk/framework/common/servicedef/services_test.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/servicedef/services_test.xml?rev=1297478&r1=1297477&r2=1297478&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/servicedef/services_test.xml (original)
+++ ofbiz/trunk/framework/common/servicedef/services_test.xml Tue Mar 6
14:06:13 2012
@@ -160,12 +160,6 @@ under the License.
<attribute name="result" type="String" mode="OUT"/>
</service>
-<service name="testBsh" engine="bsh"
location="component://common/script/org/ofbiz/common/BshServiceTest.bsh"
invoke="">
-<description>Test BeanShell Script Service</description>
-<attribute name="message" type="String" mode="IN"
optional="true"/>
-<attribute name="result" type="String" mode="OUT"/>
-</service>
-
<service name="testGroovy" engine="groovy"
location="component://common/script/org/ofbiz/common/GroovyServiceTest.groovy"
invoke="">
<description>Test Groovy Script Service</description>
<attribute name="message" type="String" mode="IN" optional="true"/>
@@ -178,6 +172,12 @@ under the License.
<attribute name="result" type="String" mode="OUT"/>
</service>
+<service name="testScriptEngineBsh" engine="script"
location="component://common/script/org/ofbiz/common/BshServiceTest.bsh"
invoke="">
+<description>Test BeanShell Script Service</description>
+<attribute name="message" type="String" mode="IN"
optional="true"/>
+<attribute name="result" type="String" mode="OUT"/>
+</service>
+
<service name="testScriptEngineGroovy" engine="script"
location="component://common/script/org/ofbiz/common/GroovyServiceTest.groovy"
invoke="">
<description>Test Script Engine With Groovy Script</description>
<attribute name="message" type="String" mode="IN" optional="true"/>
@@ -196,13 +196,11 @@ under the License.
<attribute name="result" type="String" mode="OUT"/>
</service>
-<!-- JavaScript function invocations are not working, so commenting
this out for now
<service name="testScriptEngineJavaScriptFunction" engine="script"
location="component://common/script/org/ofbiz/common/JavaScriptTest.js"
invoke="testFunction">
<description>Test Script Engine With JavaScript Function
Invocation</description>
<attribute name="message" type="String" mode="IN" optional="true"/>
<attribute name="result" type="String" mode="OUT"/>
</service>
- -->
<service name="testJMSQueue" engine="jms" location="serviceMessenger"
invoke="testScv">
<description>Test JMS Queue service</description>