You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by js...@apache.org on 2006/06/14 16:04:42 UTC
svn commit: r414260 - /incubator/servicemix/site/groovy.html
Author: jstrachan
Date: Wed Jun 14 07:04:42 2006
New Revision: 414260
URL: http://svn.apache.org/viewvc?rev=414260&view=rev
Log:
Latest export from confluence
Modified:
incubator/servicemix/site/groovy.html
Modified: incubator/servicemix/site/groovy.html
URL: http://svn.apache.org/viewvc/incubator/servicemix/site/groovy.html?rev=414260&r1=414259&r2=414260&view=diff
==============================================================================
--- incubator/servicemix/site/groovy.html (original)
+++ incubator/servicemix/site/groovy.html Wed Jun 14 07:04:42 2006
@@ -80,9 +80,10 @@
<H3><A name="Navigation-Community"></A>Community</H3>
<UL class="alternate" type="square">
- <LI><SPAN class="nobr"><A href="navigation.html" title="Visit page outside Confluence" rel="nofollow">Wiki<SUP><IMG class="rendericon" src="http://goopen.org/confluence/images/icons/linkext7.gif" height="0" width="0" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+ <LI><A href="support.html" title="Support">Support</A></LI>
<LI><A href="discussion-forums.html" title="Discussion Forums">Discussion Forums</A></LI>
<LI><A href="mailing-lists.html" title="Mailing Lists">Mailing Lists</A></LI>
+ <LI><SPAN class="nobr"><A href="navigation.html" title="Visit page outside Confluence" rel="nofollow">Wiki<SUP><IMG class="rendericon" src="http://goopen.org/confluence/images/icons/linkext7.gif" height="0" width="0" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
<LI><A href="contributing.html" title="Contributing">Contributing</A></LI>
<LI><A href="team.html" title="Team">Team</A></LI>
<LI><A href="users.html" title="Users">Users</A></LI>
@@ -180,7 +181,7 @@
<H3><A name="Navigation-RelatedProjects"></A>Related Projects</H3>
<UL class="alternate" type="square">
- <LI><SPAN class="nobr"><A href="http://activemq.codehaus.org/" title="High Performance Message Bus" rel="nofollow">Apache ActiveMQ<SUP><IMG class="rendericon" src="http://goopen.org/confluence/images/icons/linkext7.gif" height="0" width="0" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+ <LI><SPAN class="nobr"><A href="http://incubator.apache.org/activemq/" title="High Performance Message Bus" rel="nofollow">Apache ActiveMQ<SUP><IMG class="rendericon" src="http://goopen.org/confluence/images/icons/linkext7.gif" height="0" width="0" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
<LI><SPAN class="nobr"><A href="http://lingo.codehaus.org/" title="POJO Remoting using JMS" rel="nofollow">Lingo<SUP><IMG class="rendericon" src="http://goopen.org/confluence/images/icons/linkext7.gif" height="0" width="0" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
<LI><SPAN class="nobr"><A href="http://jencks.org/" title="Message Driven POJOs and pooling for JMS and JDBC" rel="nofollow">Jencks<SUP><IMG class="rendericon" src="http://goopen.org/confluence/images/icons/linkext7.gif" height="0" width="0" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
<LI><SPAN class="nobr"><A href="http://stomp.codehaus.org/" title="Simple cross language protocol for messaging" rel="nofollow">Stomp<SUP><IMG class="rendericon" src="http://goopen.org/confluence/images/icons/linkext7.gif" height="0" width="0" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
@@ -233,31 +234,7 @@
<H2><A name="Groovy-Example"></A>Example</H2>
<P>Before we go into detail of how you can work with JBI and Groovy in ServiceMix, lets show a simple hello world kinda example.</P>
-<DIV class="code"><DIV class="codeContent">
-<PRE class="code-xml"><sm:activationSpec componentName=<SPAN class="code-quote">"myServiceUsingXMLText"</SPAN>
- service=<SPAN class="code-quote">"foo:myServiceUsingXMLText"</SPAN>>
- <SPAN class="code-tag"><sm:component></SPAN>
- <SPAN class="code-tag"><bean class=<SPAN class="code-quote">"org.apache.servicemix.components.groovy.GroovyComponent"</SPAN>></SPAN>
- <SPAN class="code-tag"><property name=<SPAN class="code-quote">"scriptText"</SPAN>></SPAN>
- <SPAN class="code-tag"><value></SPAN>
- <![CDATA[
-
-// lets output some message properties
-outMessage.properties = [foo:<SPAN class="code-quote">"hello"</SPAN>, someList:[1, 2, 3]]
-
-// lets output some non-xml body
-outMessage.bodyText = """
-<SPAN class="code-tag"><hello></SPAN>
- <SPAN class="code-tag"><world person=<SPAN class="code-quote">"$inMessage.properties.name"</SPAN> location=<SPAN class="code-quote">"London"</SPAN>/></SPAN>
-<SPAN class="code-tag"></hello></SPAN>
-"""
- ]]>
- <SPAN class="code-tag"></value></SPAN>
- <SPAN class="code-tag"></property></SPAN>
- <SPAN class="code-tag"></bean></SPAN>
- <SPAN class="code-tag"></sm:component></SPAN>
- <SPAN class="code-tag"></sm:activationSpec></SPAN></PRE>
-</DIV></DIV>
+
<P>As you can see the component is configured with a piece of Groovy to execute when the service is invoked. (BTW if you wanna see this script in action try the <SPAN class="nobr"><A href="http://servicemix.codehaus.org/maven/xref-test/org/servicemix/client/ServiceMixClientTest.html" title="Visit page outside Confluence" rel="nofollow">test case<SUP><IMG class="rendericon" src="http://goopen.org/confluence/images/icons/linkext7.gif" height="0" width="0" align="absmiddle" alt="" border="0"></SUP></A></SPAN> and <SPAN class="nobr"><A href="http://svn.servicemix.codehaus.org/*checkout*/branches/servicemix-1.1/base/src/test/resources/org/servicemix/client/example.xml" title="Visit page outside Confluence" rel="nofollow">XML config file<SUP><IMG class="rendericon" src="http://goopen.org/confluence/images/icons/linkext7.gif" height="0" width="0" align="absmiddle" alt="" border="0"></SUP></A></SPAN>.</P>
<P>Now we'll go through the various options which are available when working with JBI and Groovy in ServiceMix</P>
@@ -265,28 +242,7 @@
<H2><A name="Groovy-Maintainingstateacrossrequests"></A>Maintaining state across requests</H2>
<P>Its often handy to keep track of state across requests. There is a variable called 'bindings' which you can use to maintain state...</P>
-<DIV class="code"><DIV class="codeContent">
-<PRE class="code-xml"><SPAN class="code-tag"><activationSpec componentName=<SPAN class="code-quote">"myServiceImpl"</SPAN> service=<SPAN class="code-quote">"foo:myServiceImpl"</SPAN>></SPAN>
- <SPAN class="code-tag"><component></SPAN>
- <SPAN class="code-tag"><bean xmlns=<SPAN class="code-quote">"" class="</SPAN>org.apache.servicemix.components.groovy.GroovyComponent"></SPAN>
- <SPAN class="code-tag"><property name=<SPAN class="code-quote">"scriptText"</SPAN>></SPAN>
- <SPAN class="code-tag"><value></SPAN>
- <![CDATA[
-if (bindings.counter == null) {
- bindings.counter = 1
-}
-else {
- ++bindings.counter
-}
-
-def date = new Date()
-
-outMessage.bodyText = <SPAN class="code-quote">"<SPAN class="code-tag"><response counter='$bindings.counter' date='$date'></SPAN><SPAN class="code-tag"></response></SPAN>"</SPAN>
- ]]>
- <SPAN class="code-tag"></value></SPAN>
- <SPAN class="code-tag"></property></SPAN>
- <SPAN class="code-tag"></bean></SPAN><SPAN class="code-tag"></component></SPAN><SPAN class="code-tag"></activationSpec></SPAN></PRE>
-</DIV></DIV>
+
<H2><A name="Groovy-WorkingwithJBIproperties"></A>Working with JBI properties</H2>