[esb-issues] [JBoss JIRA] Commented: (JBESB-1683) ScriptingAction donation to support more languages

David Ward (JIRA) jira-events at lists.jboss.org
Thu Jul 31 00:37:26 EDT 2008


    [ https://jira.jboss.org/jira/browse/JBESB-1683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12423136#action_12423136 ] 

David Ward commented on JBESB-1683:
-----------------------------------

Okay, so it took me a *lot* longer to get around to this.  Blame it on my day (which is also a night) job.  ANYwho, I've uploaded a newer zip file that is tested against the following environment:
1) jbossesb trunk as of July 30, 2008 (subversion revision 21302)
2) Fedora 8 (Linux 2.6.25.11-60.fc8)
3) Sun JDK 1.5.0_16
4) Ant 1.6.5

The jbossesb-scripting.zip file now contains the following:
jbossesb/trunk/product/build-distr.xml
jbossesb/trunk/product/.classpath
jbossesb/trunk/product/ivy.xml
jbossesb/trunk/product/lib/ext/bsf-2.4.0.jar
jbossesb/trunk/product/lib/ext/bsh-2.0b4.jar
jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/scripting/ScriptingAction.java
jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/scripting/ScriptingActionUnitTest.java
jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/scripting/test.bsh
jbossesb/trunk/product/samples/quickstarts/conf/base-build.xml
jbossesb/trunk/product/samples/quickstarts/scripting/build.xml
jbossesb/trunk/product/samples/quickstarts/scripting/deployment.xml
jbossesb/trunk/product/samples/quickstarts/scripting/jbmq-queue-service.xml
jbossesb/trunk/product/samples/quickstarts/scripting/jbm-queue-service.xml
jbossesb/trunk/product/samples/quickstarts/scripting/jbossesb-gateway.xml
jbossesb/trunk/product/samples/quickstarts/scripting/jbossesb-listener.xml
jbossesb/trunk/product/samples/quickstarts/scripting/jbossesb-properties.xml
jbossesb/trunk/product/samples/quickstarts/scripting/jboss-esb.xml
jbossesb/trunk/product/samples/quickstarts/scripting/jndi.properties
jbossesb/trunk/product/samples/quickstarts/scripting/juddi.properties
jbossesb/trunk/product/samples/quickstarts/scripting/lib/js.jar
jbossesb/trunk/product/samples/quickstarts/scripting/lib/jython.jar
jbossesb/trunk/product/samples/quickstarts/scripting/log4j.xml
jbossesb/trunk/product/samples/quickstarts/scripting/readme.txt
jbossesb/trunk/product/samples/quickstarts/scripting/scripts/helloworld.beanshell
jbossesb/trunk/product/samples/quickstarts/scripting/scripts/helloworld.gy
jbossesb/trunk/product/samples/quickstarts/scripting/scripts/helloworld.js
jbossesb/trunk/product/samples/quickstarts/scripting/scripts/helloworld.py
jbossesb/trunk/product/samples/quickstarts/scripting/src/org/jboss/soa/esb/samples/quickstart/scripting/test/SendJMSMessage.java

I noticed that the build changed to using ivy since the last time I used it.  I couldn't "ant dist" the project until I first called "ant dependencies.get".  Weird that this now caused libraries to be dropped into product/lib/ vs. where they used to live, which was product/lib/ext/ before.  This also meant that the eclipse product/.classpath file was messed up, and I fixed it... mostly.  I had to add bsf-2.4.0.jar to the file, and fixed a lot of lib/ext/foo.jar to lib/foo-1.2.3.jar.  The project now looks good in Eclipse except for a missing jar file containing javax.xml.ws.handler.Handler.  Not sure if I should be the one to add that to the ivy config or lib/ext/ dir...  Someone else (who "owns" it) can fix that considering that's not really anything to do with this JIRA item anyway.

One last thing I noticed is that the current state of trunk is that the tests don't all pass.  Many errors regarding communication as well as a fatal error that kills the build while running the tests:
     [java] BUILD FAILED
     [java] /home/dward/repos/jbossesb/trunk/product/build.xml:173: The following error occurred while executing this line:
     [java] /home/dward/repos/jbossesb/trunk/product/services/build.xml:31: The following error occurred while executing this line:
     [java] /home/dward/repos/jbossesb/trunk/product/services/base-project-build.xml:114: Test org.jboss.soa.esb.smooks.ProfilingUnitTest failed

I should note that this has *nothing* to do with my addition of this ScriptingAction.  In fact, the ScriptingActionUnitTest ran fine, as did my human regression testing of both esb and standalone modes of the scripting quickstart (product/samples/quickstarts/scripting).  I think the test cycle failing is just the current state of trunk, again: not the fault of adding this ScriptingAction capability.

Best regards,
David 

> ScriptingAction donation to support more languages
> --------------------------------------------------
>
>                 Key: JBESB-1683
>                 URL: https://jira.jboss.org/jira/browse/JBESB-1683
>             Project: JBoss ESB
>          Issue Type: Feature Request
>      Security Level: Public(Everyone can see) 
>          Components: Build and Release, Examples, Rosetta, Testing
>    Affects Versions: 4.2.1
>         Environment: agnostic
>            Reporter: David Ward
>             Fix For: 4.4
>
>         Attachments: jbossesb-scripting.zip
>
>   Original Estimate: 2 hours
>  Remaining Estimate: 2 hours
>
> This is a donation to add a greater scripting capability to JBoss ESB.  Currently, only Groovy is supported via the GroovyActionProcessor.  This new donation, the ScriptingAction, uses the Apache Jakarta Bean Scripting Framework (BSF) to support any of the 23 scripting languages it supports, Groovy being one of them.  Yes, I thought of the Java 6 javax.script package, but everything in JBoss ESB 4.2 needs to work with JDK 5, thus my choice.
> Everything has been built against http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk as of 2008-04-19 03:45:28 -0400 (Sat, 19 Apr 2008).
> Please see the attached jbossesb-scripting.zip file, with the following contents:
> jbossesb/trunk/product/build-distr.xml
> jbossesb/trunk/product/.classpath
> jbossesb/trunk/product/lib/ext/bsf-2.4.0.jar
> jbossesb/trunk/product/lib/ext/bsh-2.0b4.jar
> jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/scripting/ScriptingAction.java
> jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/scripting/ScriptingActionUnitTest.java
> jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/scripting/test.bsh
> jbossesb/trunk/product/samples/quickstarts/conf/base-build.xml
> jbossesb/trunk/product/samples/quickstarts/conf/quickstarts.properties-example
> jbossesb/trunk/product/samples/quickstarts/scripting/build.xml
> jbossesb/trunk/product/samples/quickstarts/scripting/deployment.xml
> jbossesb/trunk/product/samples/quickstarts/scripting/jbmq-queue-service.xml
> jbossesb/trunk/product/samples/quickstarts/scripting/jbm-queue-service.xml
> jbossesb/trunk/product/samples/quickstarts/scripting/jbossesb-properties.xml
> jbossesb/trunk/product/samples/quickstarts/scripting/jboss-esb.xml
> jbossesb/trunk/product/samples/quickstarts/scripting/jndi.properties
> jbossesb/trunk/product/samples/quickstarts/scripting/juddi.properties
> jbossesb/trunk/product/samples/quickstarts/scripting/lib/js-14.jar
> jbossesb/trunk/product/samples/quickstarts/scripting/lib/js.jar
> jbossesb/trunk/product/samples/quickstarts/scripting/lib/jython.jar
> jbossesb/trunk/product/samples/quickstarts/scripting/log4j.xml
> jbossesb/trunk/product/samples/quickstarts/scripting/readme.txt
> jbossesb/trunk/product/samples/quickstarts/scripting/scripts/helloworld.bsh
> jbossesb/trunk/product/samples/quickstarts/scripting/scripts/helloworld.gy
> jbossesb/trunk/product/samples/quickstarts/scripting/scripts/helloworld.js
> jbossesb/trunk/product/samples/quickstarts/scripting/scripts/helloworld.py
> jbossesb/trunk/product/samples/quickstarts/scripting/src/org/jboss/soa/esb/samples/quickstart/scripting/test/SendJMSMessage.java
> First off, I made some config/build fixes.  Here is a diff:
> Index: product/build-distr.xml
> ===================================================================
> --- product/build-distr.xml	(revision 19660)
> +++ product/build-distr.xml	(working copy)
> @@ -63,6 +63,10 @@
>          <delete dir="${esbserver.dist.dir}"/>
>          <unzip src="${installation.files.dir}/standalone/jbossesb-server-base.zip" dest="${build.dir}"/>
>  		<chmod dir="${build.dir}/jbossesb-server/bin" perm="ugo+rx" includes="*.sh"/>
> +		 <!-- upgrade BeanShell from 1.3.0 to 2.0b4 -->
> +		 <copy file="${lib.ext.dir}/bsh-2.0b4.jar" tofile="${build.dir}/jbossesb-server/server/default/lib/bsh.jar" overwrite="true"/>
> +		 <!-- introduce Apache Bean Scripting Framework -->
> +		 <copy file="${lib.ext.dir}/bsf-2.4.0.jar" tofile="${build.dir}/jbossesb-server/server/default/lib/bsf.jar"/>
>          <move file="${build.dir}/jbossesb-server" tofile="${esbserver.dist.dir}"/>
>      </target>
>  
> Index: product/.classpath
> ===================================================================
> --- product/.classpath	(revision 19660)
> +++ product/.classpath	(working copy)
> @@ -12,14 +12,16 @@
>  	<classpathentry kind="lib" path="lib/ext/commons-lang-2.1.jar"/>
>  	<classpathentry kind="lib" path="lib/ext/emma_ant.jar"/>
>  	<classpathentry kind="lib" path="lib/ext/emma.jar"/>
> +	<classpathentry kind="lib" path="lib/ext/bsf-2.4.0.jar"/>
> +	<classpathentry kind="lib" path="lib/ext/bsh-2.0b4.jar"/>
>  	<classpathentry kind="lib" path="lib/ext/groovy-all-1.0.jar"/>
>  	<classpathentry kind="lib" path="lib/ext/hsqldb.jar"/>
>  	<classpathentry kind="lib" path="lib/ext/jbossall-client.jar"/>
>  	<classpathentry kind="lib" path="lib/ext/jboss-system.jar"/>
>  	<classpathentry kind="lib" path="lib/ext/jbossts-common.jar"/>
>  	<classpathentry kind="lib" path="lib/ext/jsch-0.1.jar"/>
> -	<classpathentry kind="lib" path="lib/ext/juddi-1.0-SNAPSHOT.jar"/>
> -	<classpathentry kind="lib" path="lib/ext/juddi-client-1.0-SNAPSHOT.jar"/>
> +	<classpathentry kind="lib" path="lib/ext/juddi-2.0rc5.jar"/>
> +	<classpathentry kind="lib" path="lib/ext/juddi-client-2.0rc5.jar"/>
>  	<classpathentry kind="lib" path="lib/ext/junit-4.1.jar"/>
>  	<classpathentry kind="lib" path="lib/ext/log4j.jar"/>
>  	<classpathentry kind="lib" path="lib/ext/mail.jar"/>
> @@ -33,9 +35,10 @@
>  	<classpathentry kind="lib" path="lib/ext/xercesImpl-2.7.1.jar"/>
>  	<classpathentry kind="lib" path="lib/ext/xml-apis-1.3.02.jar"/>
>  	<classpathentry kind="lib" path="lib/ext/xmlpublic.jar"/>
> -	<classpathentry kind="lib" path="lib/ext/xstream-1.1.3.jar"/>
> +	<classpathentry kind="lib" path="lib/ext/xstream-1.2.2.jar"/>
>  	<classpathentry kind="lib" path="lib/ext/jboss.jar"/>
>  	<classpathentry kind="lib" path="lib/ext/commons-io-1.3.jar"/>
> +	<classpathentry kind="lib" path="lib/ext/commons-codec-1.3.jar"/>
>  	<classpathentry kind="lib" path="lib/ext/edtftpj-1.5.4.jar"/>
>  	<classpathentry kind="lib" path="ftp/lib/backport-util-concurrent-2.2.jar"/>
>  	<classpathentry kind="lib" path="ftp/lib/ftplet-api-1.0-incubator-SNAPSHOT.jar"/>
> Index: product/samples/quickstarts/conf/quickstarts.properties-example
> ===================================================================
> --- product/samples/quickstarts/conf/quickstarts.properties-example	(revision 19660)
> +++ product/samples/quickstarts/conf/quickstarts.properties-example	(working copy)
> @@ -5,7 +5,7 @@
>  ##############################################################################################
>  # Location of your JBoss Application Server installation.
>  # Will override the same property name from install/deployment.properties
> -#org.jboss.esb.server.home=${product.dir}/build/jbossesb-server-4.2GA
> +#org.jboss.esb.server.home=${product.dir}/build/jbossesb-server-4.2.1GA
>  
>  # JBossAS server name. If not set defaults to 'default'
>  # Will override the same property name from install/deployment.properties
> Index: product/samples/quickstarts/conf/base-build.xml
> ===================================================================
> --- product/samples/quickstarts/conf/base-build.xml	(revision 19660)
> +++ product/samples/quickstarts/conf/base-build.xml	(working copy)
> @@ -271,6 +271,7 @@
>  			<pathelement location="${basedir}/src" />
>  			<fileset dir="${org.jboss.esb.server.server}/lib" includes="jboss-remoting.jar jboss-j2ee.jar jboss-messaging-client.jar" /> <!-- Required for JMS Client Code. -->
>  			<fileset dir="${org.jboss.esb.server.server}/lib" includes="hibernate3.jar commons-collections.jar hsqldb.jar" /> <!-- Required for jbpm Client Code. -->
> +			<fileset dir="${org.jboss.esb.server.server}/lib" includes="bsf.jar" /> <!-- Required for scripting Client Code. -->
>  			<fileset dir="${org.jboss.esb.server.server}/lib" includes="bsh.jar" /> <!-- Required for scripting Client Code. -->
>  			<fileset dir="${org.jboss.esb.server.home}/lib/endorsed" includes="*.jar" /> <!-- Required for JMS Client Code. -->
>  			<fileset dir="${org.jboss.esb.server.server}/deploy/jboss-aop-jdk50.deployer" includes="jboss-aop-jdk50.jar" /> <!-- Required for JMS Client Code. -->
> Please note in .classpath I had to fix the juddi, xstream and commons-codec jars because someone else busted them.  'twasn't me!   ;)   You will also notice the addition of BSF 2.4.0, and the upgrade of BeanShell from 1.3.0 to 2.0b4 in AS (something I've wanted for a long time).  Last, I fixed the quickstarts.properties-example file to reflect the change to jbossesb-server-4.2.1GA.
> Now, for the meat.  The relatively simple code lives in ScriptingAction.java, which was modeled after GroovyActionProcessor.java.
> There is also a test case, ScriptingActionUnitTest, which exercises both BeanShell and Groovy scripts:
>      [java]     [junit] Running org.jboss.soa.esb.actions.scripting.ScriptingActionUnitTest
>      [java]     [junit] Testsuite: org.jboss.soa.esb.actions.scripting.ScriptingActionUnitTest
>      [java]     [junit] Tests run: 5, Failures: 0, Errors: 0, Time elapsed: 1.392 sec
>      [java]     [junit] Tests run: 5, Failures: 0, Errors: 0, Time elapsed: 1.392 sec
>      [java]     [junit] ------------- Standard Output ---------------
>      [java]     [junit] EMMA: collecting runtime coverage data ...
>      [java]     [junit] ------------- ---------------- ---------------
>      [java]     [junit] 
>      [java]     [junit] Testcase: test_groovy_file took 0.932 sec
>      [java]     [junit] Testcase: test_bsh_file took 0.1 sec
>      [java]     [junit] Testcase: test_groovy_inlined took 0.05 sec
>      [java]     [junit] Testcase: test_bsh_inlined took 0.012 sec
>      [java]     [junit] Testcase: test_beanshell_inlined took 0.012 sec
> I also created a quickstart, called "scripting".  It has an action pipeline which calls out to BeanShell, Groovy, Python, and JavaScript.  (Note: bsf.jar and bsh.jar are in the server's lib directory because older versions were already there.  Python uses the jython library, and JavaScript uses the Mozilla Rhino library - both of which have different licenses.  Thus, I did not included them in the server's lib directory.  I only put them in just the quickstart's lib directory.)
> ANYwho, it runs fine in both '.esb' archive mode:
> 01:13:11,865 INFO  [STDOUT] Hello World from BeanShell!
> 01:13:11,926 INFO  [STDOUT] Hello World from Groovy!
> 01:13:11,960 INFO  [STDOUT] Hello World from Python!
> 01:13:11,968 INFO  [STDOUT] Hello World from JavaScript!
> as well as in standalone mode:
>    [qsjava] Hello World from BeanShell!
>    [qsjava] Hello World from Groovy!
>    [qsjava] Hello World from Python!
>    [qsjava] Hello World from JavaScript!
> Hopefully this can make it into an upcoming version of the ESB.  Any questions, feel free to ask.  Comments welcome.  Enjoy!
> David

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the esb-issues mailing list