[jboss-svn-commits] JBL Code SVN: r21803 - in labs/jbossesb/trunk/product: rosetta/src/org/jboss/soa/esb/actions/scripting and 15 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Aug 22 18:03:19 EDT 2008
Author: mark.little at jboss.com
Date: 2008-08-22 18:03:19 -0400 (Fri, 22 Aug 2008)
New Revision: 21803
Added:
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/build.xml
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/deployment.xml
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/jbm-queue-service.xml
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/jbmq-queue-service.xml
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/jboss-esb.xml
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/jbossesb-properties.xml
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/jndi.properties
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/juddi.properties
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/lib/
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/lib/jruby.jar
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/lib/js.jar
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/lib/jython.jar
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/log4j.xml
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/readme.txt
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/scripts/
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/scripts/link.beanshell
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/scripts/link.gy
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/scripts/link.js
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/scripts/link.py
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/scripts/link.rb
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/src/
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/src/org/
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/src/org/jboss/
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/src/org/jboss/soa/
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/src/org/jboss/soa/esb/
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/src/org/jboss/soa/esb/samples/
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/src/org/jboss/soa/esb/samples/quickstart/
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/src/org/jboss/soa/esb/samples/quickstart/scriptingchain/
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/src/org/jboss/soa/esb/samples/quickstart/scriptingchain/test/
labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/src/org/jboss/soa/esb/samples/quickstart/scriptingchain/test/SendJMSMessage.java
Modified:
labs/jbossesb/trunk/product/docs/ProgrammersGuide.odt
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/scripting/GroovyActionProcessor.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/scripting/ScriptingAction.java
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageAwareListener.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/scripting/ScriptingActionUnitTest.java
labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/scripting/test.bsh
Log:
https://jira.jboss.org/jira/browse/JBESB-1918
Modified: labs/jbossesb/trunk/product/docs/ProgrammersGuide.odt
===================================================================
(Binary files differ)
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/scripting/GroovyActionProcessor.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/scripting/GroovyActionProcessor.java 2008-08-22 21:16:44 UTC (rev 21802)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/scripting/GroovyActionProcessor.java 2008-08-22 22:03:19 UTC (rev 21803)
@@ -49,8 +49,10 @@
* </action>
* </pre>
* <p/>
- * The {@link Message message} is bound on the script under the name "message" and the
- * {@link ConfigTree configuration} is bound under the name "config".
+ * The {@link Message} is bound into the script with the name "message".
+ * The {@link ConfigTree} is bound into the script with the name "config".
+ * The {@link MessagePayloadProxy} is bound into the script with the name "payloadProxy".
+ * The {@link Logger} is bound into the script with the name "logger".
* <p/>
* The script can also be supplied to this action as the message payload, allowing you to
* dynamically supply the action script. For message based scripts to be executable,
@@ -140,6 +142,7 @@
binding.setVariable("message", message);
binding.setVariable("config", configTree);
binding.setVariable("payloadProxy", payloadProxy);
+ binding.setVariable("logger", logger);
Script execScript = getScript(message);
Object returnVal;
@@ -203,4 +206,5 @@
public void processSuccess(final Message message) {
}
-}
\ No newline at end of file
+}
+
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/scripting/ScriptingAction.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/scripting/ScriptingAction.java 2008-08-22 21:16:44 UTC (rev 21802)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/actions/scripting/ScriptingAction.java 2008-08-22 22:03:19 UTC (rev 21803)
@@ -1,20 +1,20 @@
/*
* JBoss, Home of Professional Open Source
- * Copyright 2007, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
+ * Copyright 2007, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
* See the copyright.txt in the distribution for a
- * full listing of individual contributors.
+ * full listing of individual contributors.
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public License,
* v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
- *
+ *
* (C) 2005-2007,
*/
@@ -49,23 +49,27 @@
* <p>
* <pre>
* <action name="helloWorld" class="org.jboss.soa.esb.actions.scripting.ScriptingAction">
- * <property name="script" value="/scripts/helloWorld.bsh"/>
+ * <property name="script" value="/scripts/helloWorld.ext"/>
* <-- The language property is not required; it is deduced via the script extension but can be overridden -->
- * <property name="language" value="beanshell"/>
+ * <property name="language" value="languageDescriptor"/>
* </action>
* </pre>
* </p>
- * The {@link Message} is bound on the script under the name "message".
- * The {@link ConfigTree} is bound under the name "config".
- * The {@link MessagePayloadProxy} is bound under the name "payloadProxy".
+ * The {@link Message} is bound into the script with the name "message".
+ * The {@link ConfigTree} is bound into the script with the name "config".
+ * The {@link MessagePayloadProxy} is bound into the script with the name "payloadProxy".
+ * The {@link Logger} is bound into the script with the name "logger".
* <p/>
- * The script can also be supplied to this action as the message payload,
- * allowing you to dynamically supply the action with a script.
+ * The script can also be supplied to this action as the message payload, allowing you to
+ * dynamically supply the action script. For message based scripts to be executable,
+ * the "script" action property must be omitted and the "supportMessageBasedScripting" property must
+ * be set to "true". There are obvious security issues around executing message based scripts,
+ * so use this feature controlled manner.
* <p/>
* The following are the supported scripting languages, although the developer
* is responsible for including the appropriate 3rd party libraries (from bsf.jar's
* org/apache/bsf/Languages.properties):
- *
+ *
* <pre>
* # List of script types and their associated scripting engines
* #
@@ -101,11 +105,12 @@
*/
public class ScriptingAction extends AbstractActionPipelineProcessor
{
-
+
private static Logger logger = Logger.getLogger(ScriptingAction.class);
-
- private static final Map<String,String> LANGUAGES = new HashMap<String,String>();
-
+
+ // this is a map of extension(s) -> language
+ private static final Map<String,String> EXTN2LANG = new HashMap<String,String>();
+
static
{
InputStream is = null;
@@ -122,7 +127,7 @@
st.nextToken(); // throw out the engine class name
st = new StringTokenizer(st.nextToken(), "|");
while ( st.hasMoreTokens() ) // now get each extension
- LANGUAGES.put(st.nextToken().trim(), lang);
+ EXTN2LANG.put(st.nextToken().trim(), lang);
}
}
catch (IOException ioe) {}
@@ -131,28 +136,28 @@
try { if (is != null) is.close(); } catch (Throwable t) {}
}
}
-
+
private ConfigTree config;
private MessagePayloadProxy payloadProxy;
private String script = null;
private String language = null;
-
+
public ScriptingAction(ConfigTree config)
{
this.config = config;
payloadProxy = new MessagePayloadProxy(config);
}
-
+
public void initialise() throws ActionLifecycleException
{
// attempt to get the script
String scriptPath = getAttribute("script");
if (scriptPath == null)
{
- final boolean supportMessageBasedScripting = config.getBooleanAttribute("supportMessageBasedScripting", false);
+ boolean supportMessageBasedScripting = config.getBooleanAttribute("supportMessageBasedScripting", false);
if(supportMessageBasedScripting)
{
- if (logger.isDebugEnabled())
+ if ( logger.isDebugEnabled() )
{
logger.debug("No script specified on action config " + config.getAttribute("name")
+ ". Expecting script to be in message.");
@@ -176,9 +181,7 @@
}
else
{
- // TODO: i18n
- throw new ActionLifecycleException(
- "script '" + scriptPath + "' not found on classpath" );
+ throw new ActionLifecycleException("script '" + scriptPath + "' not found on classpath");
}
}
catch (Throwable t)
@@ -194,20 +197,32 @@
language = getAttribute("language");
if (language == null && script != null)
{
- // try again via extension
+ // the language attribute was not set but we found the script from the scriptPath,
+ // so deduce the extension from the scriptPath
int pos = scriptPath.lastIndexOf('.');
if (pos > -1 && pos < scriptPath.length()-1)
- language = scriptPath.substring( pos+1, scriptPath.length() );
+ language = scriptPath.substring( pos+1, scriptPath.length() ).toLowerCase();
}
if (language != null)
{
- // substitute extension for language if we can
- if ( LANGUAGES.containsKey(language) )
- language = LANGUAGES.get(language);
+ if ( EXTN2LANG.containsKey(language) )
+ {
+ // either the user set the language property to the extension OR
+ // the language property was not set and we deduced the extension...
+ // either way, we now know two things:
+ // 1) we need to swap out the extension for the language
+ // 2) the language is already registered with BSF
+ language = EXTN2LANG.get(language);
+ }
+ else
+ {
+ // here we still need to make sure the language is registered with BSF
+ if ( !BSFManager.isLanguageRegistered(language) )
+ throw new ActionLifecycleException("language '" + language + "' not registered");
+ }
}
else
{
- // TODO: i18n
throw new ActionLifecycleException("language not specified");
}
}
@@ -220,6 +235,7 @@
bsf.declareBean( "message", message, message.getClass() );
bsf.declareBean( "config", config, config.getClass() );
bsf.declareBean( "payloadProxy", payloadProxy, payloadProxy.getClass() );
+ bsf.declareBean( "logger", logger, logger.getClass() );
// NOTE: cannot use eval here since it does not work for all engines (jython in particular)
bsf.exec( language, null, 0, 0, getScript(message) );
}
@@ -227,9 +243,13 @@
{
throw new ActionProcessingException(bsfe);
}
+ finally
+ {
+ bsf.terminate();
+ }
return message;
}
-
+
private String getScript(Message message) throws ActionProcessingException
{
if (script != null)
@@ -251,12 +271,11 @@
return new String( (byte[])messageScript );
else
{
- // TODO: i18n
throw new ActionProcessingException("script not specified in message");
}
}
}
-
+
private String getAttribute(String name)
{
String value = config.getAttribute(name);
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageAwareListener.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageAwareListener.java 2008-08-22 21:16:44 UTC (rev 21802)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/listeners/message/MessageAwareListener.java 2008-08-22 22:03:19 UTC (rev 21803)
@@ -121,6 +121,14 @@
final String maxThreadVal = _config.getAttribute(ListenerTagNames.MAX_THREADS_TAG) ;
+ /*
+ * TODO augment this so that per service filters can be
+ * registered in the configuration (and removed by the ESB when
+ * the service is undeployed).
+ *
+ * Do the same for gateways.
+ */
+
if (!Util.isNullString(maxThreadVal))
{
try
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/scripting/ScriptingActionUnitTest.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/scripting/ScriptingActionUnitTest.java 2008-08-22 21:16:44 UTC (rev 21802)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/scripting/ScriptingActionUnitTest.java 2008-08-22 22:03:19 UTC (rev 21803)
@@ -1,20 +1,20 @@
/*
* JBoss, Home of Professional Open Source
- * Copyright 2007, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
+ * Copyright 2007, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
* See the copyright.txt in the distribution for a
- * full listing of individual contributors.
+ * full listing of individual contributors.
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public License,
* v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
- *
+ *
* (C) 2005-2007,
*/
@@ -38,6 +38,7 @@
*/
public class ScriptingActionUnitTest extends TestCase
{
+
public void test_bsh_file()
throws ConfigurationException, ActionLifecycleException, ActionProcessingException
{
@@ -55,7 +56,7 @@
Message message = MessageFactory.getInstance().getMessage();
assertProcessingOK(action, message, messageContents);
}
-
+
public void test_bsh_inlined()
throws ConfigurationException, ActionLifecycleException, ActionProcessingException
{
@@ -63,7 +64,7 @@
"message.getBody().add(config.getAttribute(\"messageContents\").getBytes());",
"bsh" );
}
-
+
public void test_beanshell_inlined()
throws ConfigurationException, ActionLifecycleException, ActionProcessingException
{
@@ -77,7 +78,7 @@
{
ConfigTree config = new ConfigTree("<config/>");
config.setAttribute("language", language);
- config.setAttribute("supportMessageBasedScripting", "true") ;
+ config.setAttribute("supportMessageBasedScripting", "true");
String messageContents = "Hello World - Inlined!";
config.setAttribute("messageContents", messageContents);
ScriptingAction action = new ScriptingAction(config);
@@ -96,4 +97,22 @@
assertEquals( messageContents, new String(bodyContents) );
}
+ public void test_unregistered_language()
+ throws ConfigurationException
+ {
+ ConfigTree config = new ConfigTree("<config/>");
+ config.setAttribute("language", "unregistered");
+ config.setAttribute("script", "/org/jboss/soa/esb/actions/scripting/test.bsh"); // doesn't matter
+ ScriptingAction action = new ScriptingAction(config);
+ try
+ {
+ action.initialise();
+ fail("ScriptingAction with unregistered language should throw an ActionLifecycleException.");
+ }
+ catch (ActionLifecycleException ale)
+ {
+ assertEquals( "language 'unregistered' not registered", ale.getMessage() );
+ }
+ }
+
}
Modified: labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/scripting/test.bsh
===================================================================
--- labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/scripting/test.bsh 2008-08-22 21:16:44 UTC (rev 21802)
+++ labs/jbossesb/trunk/product/rosetta/tests/src/org/jboss/soa/esb/actions/scripting/test.bsh 2008-08-22 22:03:19 UTC (rev 21803)
@@ -1 +1,2 @@
-message.getBody().add(config.getAttribute("messageContents").getBytes());
\ No newline at end of file
+logger.info("logger is available and usable");
+message.getBody().add(config.getAttribute("messageContents").getBytes());
Added: labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/build.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/build.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/build.xml 2008-08-22 22:03:19 UTC (rev 21803)
@@ -0,0 +1,32 @@
+<project name="scripting-chain-quickstart" default="deploy" basedir=".">
+
+ <description>
+ ${ant.project.name}
+ ${line.separator}
+ </description>
+
+ <property name="additional.deploys" value="scripts/**" />
+
+ <!-- Import the base Ant build script... -->
+ <import file="../conf/base-build.xml"/>
+
+ <target name="quickstart-specific-deploys">
+ <copy todir="${org.jboss.esb.server.server}/lib">
+ <fileset dir="${basedir}/lib">
+ <include name="jruby.jar"/>
+ <include name="js.jar"/>
+ <include name="jython.jar"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <!-- Target for injecting the sample order message for transformation... -->
+ <target name="runtest" description="sends a JMS message to the ESB" depends="compile">
+ <echo>Runs Test JMS Sender</echo>
+ <java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.scriptingchain.test.SendJMSMessage" failonerror="true">
+ <arg value="(chain)"/>
+ <classpath refid="exec-classpath" />
+ </java>
+ </target>
+
+</project>
Added: labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/deployment.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/deployment.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/deployment.xml 2008-08-22 22:03:19 UTC (rev 21803)
@@ -0,0 +1,4 @@
+<jbossesb-deployment>
+ <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_scripting_chain_gw</depends>
+ <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_scripting_chain_esb</depends>
+</jbossesb-deployment>
Added: labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/jbm-queue-service.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/jbm-queue-service.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/jbm-queue-service.xml 2008-08-22 22:03:19 UTC (rev 21803)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_scripting_chain_gw"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+ <mbean code="org.jboss.jms.server.destination.QueueService"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_scripting_chain_esb"
+ xmbean-dd="xmdesc/Queue-xmbean.xml">
+ <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
+ <depends>jboss.messaging:service=PostOffice</depends>
+ </mbean>
+</server>
Added: labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/jbmq-queue-service.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/jbmq-queue-service.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/jbmq-queue-service.xml 2008-08-22 22:03:19 UTC (rev 21803)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<server>
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_scripting_chain_gw">
+ <depends optional-attribute-name="DestinationManager">
+ jboss.mq:service=DestinationManager
+ </depends>
+ </mbean>
+ <mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_scripting_chain_esb">
+ <depends optional-attribute-name="DestinationManager">
+ jboss.mq:service=DestinationManager
+ </depends>
+ </mbean>
+</server>
Added: labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/jboss-esb.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/jboss-esb.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/jboss-esb.xml 2008-08-22 22:03:19 UTC (rev 21803)
@@ -0,0 +1,71 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.0.1.xsd" parameterReloadSecs="5">
+
+ <providers>
+ <jms-provider name="JBossMQ" connection-factory="ConnectionFactory">
+ <jms-bus busid="quickstartGwChannel">
+ <jms-message-filter
+ dest-type="QUEUE"
+ dest-name="queue/quickstart_scripting_chain_gw"
+ />
+ </jms-bus>
+ <jms-bus busid="quickstartEsbChannel">
+ <jms-message-filter
+ dest-type="QUEUE"
+ dest-name="queue/quickstart_scripting_chain_esb"
+ />
+ </jms-bus>
+
+ </jms-provider>
+ </providers>
+
+ <services>
+
+ <service category="ActionServices"
+ name="MoreActionService"
+ description="More Action EPR description" >
+ <listeners>
+ <jms-listener name="JMS-Gateway"
+ busidref="quickstartGwChannel"
+ is-gateway="true"
+ />
+ <jms-listener name="JMS-ESBListener"
+ busidref="quickstartEsbChannel"
+ />
+ </listeners>
+ <actions mep="OneWay">
+ <action name="add_beanshell_link" class="org.jboss.soa.esb.actions.scripting.ScriptingAction">
+ <!-- use a .beanshell extension vs. bsh or the BeanShellDeployer will pick it up inadvertanty -->
+ <property name="script" value="/scripts/link.beanshell" />
+ </action>
+
+ <!-- JavaScript is not supported by ScriptingAction until BSF is upgraded from 2.3.0 to 2.4.0 -->
+ <!--
+ <action name="add_rhino_link" class="org.jboss.soa.esb.actions.scripting.ScriptingAction">
+ <property name="script" value="/scripts/link.js" />
+ </action>
+ -->
+
+ <action name="add_jython_link" class="org.jboss.soa.esb.actions.scripting.ScriptingAction">
+ <property name="script" value="/scripts/link.py" />
+ </action>
+
+ <action name="add_jruby_link" class="org.jboss.soa.esb.actions.scripting.ScriptingAction">
+ <property name="script" value="/scripts/link.rb" />
+ </action>
+
+ <!-- Groovy is not supported by ScriptingAction until BSF is upgraded from 2.3.0 to 2.4.0 -->
+ <!--
+ <action name="add_groovy_link" class="org.jboss.soa.esb.actions.scripting.ScriptingAction">
+ -->
+ <action name="add_groovy_link" class="org.jboss.soa.esb.actions.scripting.GroovyActionProcessor">
+ <property name="script" value="/scripts/link.gy" />
+ </action>
+
+ <!-- The next action is for Continuous Integration testing -->
+ <action name="testStore" class="org.jboss.soa.esb.actions.TestMessageStore"/>
+ </actions>
+ </service>
+ </services>
+
+</jbossesb>
Added: labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/jbossesb-properties.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/jbossesb-properties.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/jbossesb-properties.xml 2008-08-22 22:03:19 UTC (rev 21803)
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ JBoss, Home of Professional Open Source
+ Copyright 2006, JBoss Inc., and others contributors as indicated
+ by the @authors tag. All rights reserved.
+ See the copyright.txt in the distribution for a
+ full listing of individual contributors.
+ This copyrighted material is made available to anyone wishing to use,
+ modify, copy, or redistribute it subject to the terms and conditions
+ of the GNU Lesser General Public License, v. 2.1.
+ This program is distributed in the hope that it will be useful, but WITHOUT A
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ You should have received a copy of the GNU Lesser General Public License,
+ v.2.1 along with this distribution; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ (C) 2005-2006,
+ @author JBoss Inc.
+-->
+<!-- $Id: jbossesb-unittest-properties.xml $ -->
+<!--
+ These options are described in the JBossESB manual.
+ Defaults are provided here for convenience only.
+
+ Please read through this file prior to using the system, and consider
+ updating the specified entries.
+-->
+<esb
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="jbossesb-1_0.xsd">
+ <properties name="core">
+ <property name="org.jboss.soa.esb.jndi.server.type" value="jboss"/>
+ <property name="org.jboss.soa.esb.jndi.server.url" value="localhost"/>
+ <property name="org.jboss.soa.esb.persistence.connection.factory" value="org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl"/>
+ <property name="jboss.esb.invm.scope.default" value="NONE"/>
+ </properties>
+ <properties name="registry">
+ <property name="org.jboss.soa.esb.registry.queryManagerURI"
+ value="jnp://localhost:1099/InquiryService?org.apache.juddi.registry.rmi.Inquiry#inquire"/>
+ <property name="org.jboss.soa.esb.registry.lifeCycleManagerURI"
+ value="jnp://localhost:1099/PublishService?org.apache.juddi.registry.rmi.Publish#publish" />
+ <property name="org.jboss.soa.esb.registry.implementationClass"
+ value="org.jboss.internal.soa.esb.services.registry.JAXRRegistryImpl"/>
+ <property name="org.jboss.soa.esb.registry.factoryClass"
+ value="org.apache.ws.scout.registry.ConnectionFactoryImpl"/>
+ <property name="org.jboss.soa.esb.registry.user"
+ value="jbossesb"/>
+ <property name="org.jboss.soa.esb.registry.password"
+ value="password"/>
+ <!-- the following parameter is scout specific to set the type of communication between scout and the UDDI (embedded, rmi, soap) -->
+ <property name="org.jboss.soa.esb.scout.proxy.transportClass"
+ value="org.apache.ws.scout.transport.RMITransport"/>
+ </properties>
+ <properties name="transports" depends="core">
+ <property name="org.jboss.soa.esb.mail.smtp.host" value="localhost"/>
+ <property name="org.jboss.soa.esb.mail.smtp.user" value="jbossesb"/>
+ <property name="org.jboss.soa.esb.mail.smtp.password" value=""/>
+ <property name="org.jboss.soa.esb.mail.smtp.port" value="25"/>
+ </properties>
+ <properties name="connection">
+ <property name="min-pool-size" value="5"/>
+ <property name="max-pool=size" value="10"/>
+ <property name="blocking-timeout-millis" value="5000"/>
+ <property name="abandoned-connection-timeout" value="10000"/>
+ <property name="abandoned-connection-time-interval" value="30000"/>
+ </properties>
+ <properties name="dbstore">
+ <property name="org.jboss.soa.esb.persistence.db.connection.url" value="jdbc:hsqldb:hsql://localhost:9001/"/>
+ <property name="org.jboss.soa.esb.persistence.db.jdbc.driver" value="org.hsqldb.jdbcDriver"/>
+ <property name="org.jboss.soa.esb.persistence.db.user" value="sa"/>
+ <property name="org.jboss.soa.esb.persistence.db.pwd" value=""/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.initial.size" value="2"/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.min.size" value="2"/>
+ <property name="org.jboss.soa.esb.persistence.db.pool.max.size" value="5"/>
+ <!--table managed by pool to test for valid connections - created by pool automatically -->
+ <property name="org.jboss.soa.esb.persistence.db.pool.test.table" value="pooltest"/>
+ <!-- # of milliseconds to timeout waiting for a connection from pool -->
+ <property name="org.jboss.soa.esb.persistence.db.pool.timeout.millis" value="5000"/>
+ <property name="org.jboss.soa.esb.persistence.db.conn.manager" value="org.jboss.internal.soa.esb.persistence.manager.StandaloneConnectionManager"/>
+ </properties>
+ <properties name="messagerouting">
+ <property name="org.jboss.soa.esb.routing.cbrClass" value="org.jboss.internal.soa.esb.services.routing.cbr.JBossRulesRouter"/>
+ </properties>
+ <properties name="transformation">
+ <property name="java.naming.provider.url" value="localhost"/>
+ </properties>
+</esb>
Added: labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/jndi.properties
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/jndi.properties (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/jndi.properties 2008-08-22 22:03:19 UTC (rev 21803)
@@ -0,0 +1,5 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming
+java.naming.factory.url.pkgs=org.jnp.interfaces
+
Added: labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/juddi.properties
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/juddi.properties (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/juddi.properties 2008-08-22 22:03:19 UTC (rev 21803)
@@ -0,0 +1,69 @@
+# jUDDI Registry Properties (used by RegistryServer)
+# see http://www.juddi.org for more information
+
+# The UDDI Operator Name
+juddi.operatorName = jUDDI.org
+
+# The i18n locale default codes
+juddi.i18n.languageCode = en
+juddi.i18n.countryCode = US
+
+# The UDDI DiscoveryURL Prefix
+juddi.discoveryURL = http://localhost:8080/juddi/uddiget.jsp?
+
+# The UDDI Operator Contact Email Address
+juddi.operatorEmailAddress = admin at juddi.org
+
+# The maximum name size and maximum number
+# of name elements allows in several of the
+# FindXxxx and SaveXxxx UDDI functions.
+juddi.maxNameLength=255
+juddi.maxNameElementsAllowed=5
+
+# The maximum number of UDDI artifacts allowed
+# per publisher. A value of '-1' indicates any
+# number of artifacts is valid (These values can be
+# overridden at the individual publisher level).
+juddi.maxBusinessesPerPublisher=25
+juddi.maxServicesPerBusiness=20
+juddi.maxBindingsPerService=10
+juddi.maxTModelsPerPublisher=100
+
+# jUDDI Authentication module to use
+juddi.auth = org.apache.juddi.auth.DefaultAuthenticator
+
+# jUDDI DataStore module currently to use
+juddi.dataStore = org.apache.juddi.datastore.jdbc.JDBCDataStore
+
+# use a dataSource (if set to false a direct
+# jdbc connection will be used.
+juddi.isUseDataSource=false
+juddi.jdbcDriver=com.mysql.jdbc.Driver
+juddi.jdbcUrl=jdbc:mysql://localhost:3306/juddi
+juddi.jdbcUsername=root
+juddi.jdbcPassword=admin
+# jUDDI DataSource to use
+# juddi.dataSource=java:comp/env/jdbc/MySqlDS
+
+# jUDDI UUIDGen implementation to use
+juddi.uuidgen = org.apache.juddi.uuidgen.DefaultUUIDGen
+
+# jUDDI Cryptor implementation to use
+juddi.cryptor = org.apache.juddi.cryptor.DefaultCryptor
+
+# jUDDI Validator to use
+juddi.validator=org.apache.juddi.validator.DefaultValidator
+
+# jUDDI Proxy Properties (used by RegistryProxy)
+juddi.proxy.adminURL = http://localhost:8080/juddi/admin
+juddi.proxy.inquiryURL = http://localhost:8080/juddi/inquiry
+juddi.proxy.publishURL = http://localhost:8080/juddi/publish
+juddi.proxy.transportClass = org.apache.juddi.proxy.AxisTransport
+juddi.proxy.securityProvider = com.sun.net.ssl.internal.ssl.Provider
+juddi.proxy.protocolHandler = com.sun.net.ssl.internal.www.protocol
+
+# JNDI settings (used by RMITransport)
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming
+
Added: labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/lib/jruby.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/lib/jruby.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/lib/js.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/lib/js.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/lib/jython.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/lib/jython.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/log4j.xml
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/log4j.xml (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/log4j.xml 2008-08-22 22:03:19 UTC (rev 21803)
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml,v 1.26.2.5 2005/09/15 09:31:02 dimitris Exp $ -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <param name="Target" value="System.out"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%t][%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <category name="org.jboss">
+ <priority value="WARN"/>
+ </category>
+ <category name="org.jboss.soa.esb">
+ <priority value="ERROR"/>
+ </category>
+ <category name="org.milyn">
+ <priority value="INFO"/>
+ </category>
+ <category name="org.jboss.internal.soa.esb">
+ <priority value="ERROR"/>
+ </category>
+ <category name="org.apache">
+ <priority value="ERROR"/>
+ </category>
+ <category name="quickstart">
+ <priority value="INFO"/>
+ </category>
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Added: labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/readme.txt
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/readme.txt (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/readme.txt 2008-08-22 22:03:19 UTC (rev 21803)
@@ -0,0 +1,32 @@
+Overview:
+=========
+ A simple quickstart demonstrating execution of BeanShell, Jython and JRuby
+ scripts using the ScriptingAction, and Groovy using the GroovyActionProcessor.
+ When BSF (the Apache Bean Scripting Framework) is upgraded from 2.3.0 to
+ 2.4.0, the ScriptingAction will then automatically support JavaScript (via
+ Mozilla Rhino) as well as Groovy directly. This upgrade will also require BSF
+ (BeanShell) to be upgraded from 1.3.0 to 2.0b4.
+
+Running this quickstart:
+========================
+ Please refer to 'ant help-quickstarts' for prerequisites about the quickstarts
+ and a more detailed descripton of the different ways to run the quickstarts.
+
+To Run standalone mode:
+=======================
+ 1. In a command terminal window in the quickstart folder type
+ 'ant deploy-jms-dests'.
+ 2. In a command terminal window in this folder ("Window1"), type 'ant run'.
+ 3. Open another command terminal window in this folder ("Window2"), type
+ 'ant runtest'.
+ 4. Switch back to "Window1" to see the output from the ESB
+ 5. When finished, interrupt the ESB using Ctrl-C and, in this folder
+ ("Window1"), type 'ant undeploy-jms-dests'.
+
+To Run '.esb' archive mode:
+===========================
+ 1. In a command terminal window in this folder ("Window1"), type 'ant deploy'.
+ 2. Open another command terminal window in this folder ("Window2"), type
+ 'ant runtest'.
+ 3. Switch back to Application Server console to see the output from the ESB
+ 4. In this folder ("Window1"), type 'ant undeploy'.
Added: labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/scripts/link.beanshell
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/scripts/link.beanshell (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/scripts/link.beanshell 2008-08-22 22:03:19 UTC (rev 21803)
@@ -0,0 +1,4 @@
+// BeanShell script: link.beanshell
+chain = payloadProxy.getPayload(message) + "~(beanshell)";
+logger.info(config.getAttribute("action") + ": " + chain);
+payloadProxy.setPayload(message, chain);
Added: labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/scripts/link.gy
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/scripts/link.gy (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/scripts/link.gy 2008-08-22 22:03:19 UTC (rev 21803)
@@ -0,0 +1,4 @@
+// Groovy script: link.gy
+def chain = payloadProxy.getPayload(message) + "~(groovy)"
+logger.info(config.getAttribute("action") + ": " + chain)
+payloadProxy.setPayload(message, chain)
Added: labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/scripts/link.js
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/scripts/link.js (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/scripts/link.js 2008-08-22 22:03:19 UTC (rev 21803)
@@ -0,0 +1,4 @@
+// Rhino script: link.js
+var chain = payloadProxy.getPayload(message) + "~(rhino)";
+logger.info(config.getAttribute("action") + ": " + chain);
+payloadProxy.setPayload(message, chain);
Added: labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/scripts/link.py
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/scripts/link.py (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/scripts/link.py 2008-08-22 22:03:19 UTC (rev 21803)
@@ -0,0 +1,4 @@
+# Jython script: link.py
+chain = payloadProxy.getPayload(message) + "~(jython)"
+logger.info(config.getAttribute("action") + ": " + chain)
+payloadProxy.setPayload(message, chain)
Added: labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/scripts/link.rb
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/scripts/link.rb (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/scripts/link.rb 2008-08-22 22:03:19 UTC (rev 21803)
@@ -0,0 +1,5 @@
+# JRuby script: link.rb
+require "java"
+chain = $payloadProxy.get_payload($message) + "~(jruby)"
+$logger.info($config.get_attribute("action") + ": " + chain)
+$payloadProxy.set_payload($message, chain)
Added: labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/src/org/jboss/soa/esb/samples/quickstart/scriptingchain/test/SendJMSMessage.java
===================================================================
--- labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/src/org/jboss/soa/esb/samples/quickstart/scriptingchain/test/SendJMSMessage.java (rev 0)
+++ labs/jbossesb/trunk/product/samples/quickstarts/scripting_chain/src/org/jboss/soa/esb/samples/quickstart/scriptingchain/test/SendJMSMessage.java 2008-08-22 22:03:19 UTC (rev 21803)
@@ -0,0 +1,56 @@
+package org.jboss.soa.esb.samples.quickstart.scriptingchain.test;
+
+import javax.jms.JMSException;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+public class SendJMSMessage {
+ QueueConnection conn;
+ QueueSession session;
+ Queue que;
+
+
+ public void setupConnection() throws JMSException, NamingException
+ {
+ InitialContext iniCtx = new InitialContext();
+ Object tmp = iniCtx.lookup("ConnectionFactory");
+ QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
+ conn = qcf.createQueueConnection();
+ que = (Queue) iniCtx.lookup("queue/quickstart_scripting_chain_gw");
+ session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+ conn.start();
+ System.out.println("Connection Started");
+ }
+
+ public void stop() throws JMSException
+ {
+ conn.stop();
+ session.close();
+ conn.close();
+ }
+
+ public void sendAMessage(String msg) throws JMSException {
+
+ QueueSender send = session.createSender(que);
+ ObjectMessage tm = session.createObjectMessage(msg);
+ send.send(tm);
+ send.close();
+ }
+
+
+ public static void main(String args[]) throws Exception
+ {
+ SendJMSMessage sm = new SendJMSMessage();
+ sm.setupConnection();
+ sm.sendAMessage(args[0]);
+ sm.stop();
+
+ }
+
+}
More information about the jboss-svn-commits
mailing list