You should take a look at servicemix-script.

Anyway, for the lightweight component, you need a groovy binding
for the javax scripting.  You will find one at
 
http://servicemix.org/m2-repo/com/sun/script/groovy-engine/20070112/groovy-engine-20070112.jar

This one comes from the https://scripting.dev.java.net/ project.

On 2/12/07, Bompart Cedric <[EMAIL PROTECTED]> wrote:
For the SU dependencies, I've used the following libraries:
 - groovy 1.0
 - livetribe-jsr223 2.0.0 - for javax.script.*

Are the dependencies correct? I'm not sure about the livetribe... I've looked 
in the javax.script.ScriptEngineManager class and it cache a list of script 
engine factory with the file in 
META-INF/services/javax.script.ScriptEngineFactory
Where this file should be defined? Is not in the livetribe jar file.

Regards,
Cedric.

-----Message d'origine-----
De: Bompart Cedric
Envoyé: 08 February 2007 14:43
À: [email protected]; [EMAIL PROTECTED]
Objet: RE: RE : groovy example

Like in the tutorial, I'm using like this:

<sm:activationSpec componentName="scriptTrans" service="test:scriptTrans" 
destinationService="test:mailSender">
            <sm:component>
               <bean 
class="org.apache.servicemix.components.groovy.GroovyComponent">
                  <property name="scriptText">
                     <value>
                        <![CDATA[
                        if (bindings.counter == null) {
                            bindings.counter = 1
                        }
                        else {
                            ++bindings.counter
                        }

                        def date = new Date()

                        outMessage.bodyText = "<response counter='$bindings.counter' 
date='$date'></response>"
                                    ]]>
                     </value>
                  </property>
               </bean>
            </sm:component>
         </sm:activationSpec>

-----Message d'origine-----
De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Envoyé: 08 February 2007 14:39
À: [email protected]
Objet: RE : groovy example


hello,

Did you use
org.apache.servicemix.components.script.ScriptComponent
or
org.apache.servicemix.components.groovy.GroovyComponent

with the last you don't need to specify the 'engine',
the groovyComponent loads groovy Engine by "groovy"
value @ attribut "scriptEngineName".

Cordialement,

Grégoire A.

--- Bompart Cedric <[EMAIL PROTECTED]> a
écrit :

> Hi,
>
> I'm trying to test Groovy based on this tutorial -->
> http://incubator.apache.org/servicemix/groovy.html
>
> I've added these dependencies to my lwcontainer
> project:
>   - groovy 1.0
>   - livetribe-jsr223 2.0.0
>
> I'm getting the following exception when I'm trying
> to deploy to SM 3.1:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <jbi-task
>
xmlns="http://java.sun.com/xml/ns/jbi/management-message";
> version="1.0
> ">
> <jbi-task-result>
> <frmwk-task-result>
> <frmwk-task-result-details>
> <task-result-details>
> <task-id>start</task-id>
> <task-result>FAILED</task-result>
> <message-type>ERROR</message-type>
> </task-result-details>
> </frmwk-task-result-details>
> </frmwk-task-result>
> <component-task-result
>
xmlns="http://java.sun.com/xml/ns/jbi/management-message";
> >
>
>
<component-name>servicemix-lwcontainer</component-name>
>         <component-task-result-details>
>                 <task-result-details>
>                         <task-id>start</task-id>
>
> <task-result>FAILED</task-result>
>
> <message-type>ERROR</message-type>
>                         <task-status-msg>
> <msg-loc-info>
> <loc-token/>
> <loc-message>Unable to start service
> unit</loc-message>
> </msg-loc-info>
> </task-status-msg>
>                         <exception-info>
>
> <nesting-level>1</nesting-level>
>                                 <msg-loc-info>
>                                         <loc-token/>
>
> <loc-message>Must be configured
> with eit
> her the 'compiledScript' or 'engine'
> property</loc-message>
>
> <stack-trace><![CDATA[javax.jbi.JBIExcep
> tion: Must be configured with either the
> 'compiledScript' or 'engine'
> property
>         at
>
org.apache.servicemix.components.script.ScriptComponent.start(ScriptC
> omponent.java:83)
>         at
>
org.apache.servicemix.jbi.framework.ComponentMBeanImpl.doStart(Compon
> entMBeanImpl.java:293)
>         at
>
org.apache.servicemix.jbi.framework.ComponentMBeanImpl.start(Componen
> tMBeanImpl.java:216)
>         at
>
org.apache.servicemix.jbi.container.JBIContainer.activateComponent(JB
> IContainer.java:1122)
>         at
>
org.apache.servicemix.jbi.container.JBIContainer.activateComponent(JB
> IContainer.java:1074)
>         at
>
org.apache.servicemix.jbi.container.JBIContainer.activateComponent(JB
> IContainer.java:1031)
>         at
>
org.apache.servicemix.jbi.container.JBIContainer.activateComponent(JB
> IContainer.java:979)
>         at
>
org.apache.servicemix.lwcontainer.LwContainerEndpoint.activate(LwCont
> ainerEndpoint.java:53)
>         at
>
org.apache.servicemix.common.ServiceUnit.start(ServiceUnit.java:55)
>         at
>
org.apache.servicemix.common.BaseServiceUnitManager.start(BaseService
> UnitManager.java:151)
>         at
>
org.apache.servicemix.jbi.framework.ServiceUnitLifeCycle.start(Servic
> eUnitLifeCycle.java:103)
>         at
>
org.apache.servicemix.jbi.framework.ServiceAssemblyLifeCycle.start(Se
> rviceAssemblyLifeCycle.java:130)
>         at
>
org.apache.servicemix.jbi.framework.DeploymentService.start(Deploymen
> tService.java:374)
>         at
>
org.apache.servicemix.jbi.framework.AutoDeploymentService.updateArchi
> ve(AutoDeploymentService.java:336)
>         at
>
org.apache.servicemix.jbi.framework.AutoDeploymentService.updateExter
> nalArchive(AutoDeploymentService.java:201)
>         at
>
org.apache.servicemix.jbi.container.JBIContainer.updateExternalArchiv
> e(JBIContainer.java:473)
>         at
>
org.apache.servicemix.jbi.container.JBIContainer.updateExternalArchiv
> e(JBIContainer.java:483)
>         at
>
org.apache.servicemix.jbi.framework.AdminCommandsService.deployServic
> eAssembly(AdminCommandsService.java:229)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
>         at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
>         at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>         at
> java.lang.reflect.Method.invoke(Method.java:585)
>         at
>
org.apache.commons.beanutils.MethodUtils.invokeMethod(MethodUtils.jav
> a:216)
>         at
>
org.apache.servicemix.jbi.management.BaseStandardMBean.invoke(BaseSta
> ndardMBean.java:318)
>         at
>
com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImp
> l.java:213)
>         at
>
com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)
>         at
>
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultM
> BeanServerInterceptor.java:815)
>         at
>
com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784
> )
>         at
>
javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnecti
> onImpl.java:1408)
>         at
>
javax.management.remote.rmi.RMIConnectionImpl.access$100(RMIConnectio
> nImpl.java:81)
>         at
>
javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run
> (RMIConnectionImpl.java:1245)
>         at
> java.security.AccessController.doPrivileged(Native
> Method)
>         at
>
javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(R
> MIConnectionImpl.java:1348)
>         at
>
javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImp
> l.java:782)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
>         at
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
>         at
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>         at
> java.lang.reflect.Method.invoke(Method.java:585)
>         at
>
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
>         at
>
sun.rmi.transport.Transport$1.run(Transport.java:153)
>         at
> java.security.AccessController.doPrivileged(Native
> Method)
>         at
>
sun.rmi.transport.Transport.serviceCall(Transport.java:149)
>         at
>
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
> 66)
>         at
>
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
> .java:707)
>         at java.lang.Thread.run(Thread.java:595)
> ]]></stack-trace>
>                                 </msg-loc-info>
>                         </exception-info>
>                 </task-result-details>
>         </component-task-result-details>
> </component-task-result>
> </jbi-task-result>
> </jbi-task>
>
>
> I've changed my lwcontainer servicemix.xml file to
> include the example
> of "Maintaining state across requests".
>
> I've looked the GroovyComponent source and there is
> a set to the script
> engine name, which is "groovy". I've neved used
> Groovy so I can't really
> comment...
>
> Any idea?
>
>
> Another thing is the groovy component going to
> re-submit the modified
> input message to the NMR? (so I can re-send the
> message to another
> provider).
> I'm just discovering SM, so just wondering if there
> is a concept like
> the pipeline pattern (for example in Apache Cocoon).
> In summary, I would like to do the following:
>  FilePooler --> GroovyComponent --> MimeMailSender
>
> Do I need anything else?
>
>
> How do I manage one consumer with multiple providers
> in parallel? So
> every provider does something independently with the
> consumer message.
>
> Regards,
> Cedric.
>
>







___________________________________________________________________________
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !
Profitez des connaissances, des opinions et des expériences des internautes sur 
Yahoo! Questions/Réponses
http://fr.answers.yahoo.com







--
Cheers,
Guillaume Nodet
------------------------
Architect, LogicBlaze (http://www.logicblaze.com/)
Blog: http://gnodet.blogspot.com/

Reply via email to