You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by ant elder <an...@gmail.com> on 2007/03/13 13:38:50 UTC

Re: Proposal to combine the Inline script mediator with the Script mediator

How are you getting on with this, are you still planing on looking at it? Is
there anything I could do to help? Or take it one if you don't have time to
do it now? Be good to try to get it done in time for the 1.0 release.

   ...ant

On 2/22/07, Kasun Samarasinghe <ka...@wso2.com> wrote:
>
> Hi
>
> Currently Synapse supports two variants for script mediation, where the
> script could be specified through a property or inline.
>
> E.g.
> <set-property name="prop" src="scriptfile.LL"/>
>
> in mediation
> <script key="prop" function="mediation_function"/>
>
>
> In line mediators where we specify the script type in it self as LL
> E.g.
> <script.LL><![CDATA[
>           some script......
> ]]></script.LL>
>
> I think these could be combined into one single script mediator.  Also,
> I think its better to explicitly specify the script language, as
> guessing the language when the script is specified by a property may
> not
> always be reliable. So the suggestion is
>
> E.g
> <script type="LL" [key="prop"] [function="mediation_function"]>
>         <![CDATA[.. inline script ..]]>?
> </script>
>
> What do you think? I would be happy to raise a jira and submit a patch
> for this enhancement
>
> thanks
> kasun
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: synapse-dev-help@ws.apache.org
>
>

Re: Proposal to combine the Inline script mediator with the Script mediator

Posted by ant elder <an...@gmail.com>.
Yep, will give it a start over this weekend.

   ...ant

On 3/16/07, Asankha C. Perera <as...@wso2.com> wrote:
>
> Hi Ant
>
> Do you think you would have the time to see how we could migrate to BSF
> v3? As this will not affect the rest of Synapse, we could try this on a
> low priority thread when time permits..
>
> thanks
> asankha
>
> Sanjiva Weerawarana wrote:
> > +1 from me too! (And I'll hop over to the other side with my bsf hat
> > on too ..)
> >
> > Sanjiva.
> >
> > Asankha C. Perera wrote:
> >> Hi Ant
> >>> The best way to resolve this is to use JSR-223 instead of Apache BSF
> >>> v2 as JSR-223 script engines have an API to see if the engine is
> >>> threadsafe.
> >>>
> >>> BSF version 3 is implementing JSR-223 and there's a beta1-SNAPSHOT
> >>> available now but no proper release yet. I would have quite liked
> >>> Synapse 1.0 to use BSF v3 but didn't want to get in the way of the
> >>> release. We probably could get a BSF v3 beta1 release out quite
> >>> quickly if Synapse said it would use it. Is there an interested in
> >>> doing that?
> >> Since we are not tied too much into BSF v2 anyway, I think it would
> >> be good to move to V3. So if the BSF folks could get a beta1 release
> >> out in the next couple of weeks, we could move our code to the V3
> >> beta1 snapshot in the meantime and check how we could use it.
> >>
> >> asankha
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
> >> For additional commands, e-mail: synapse-dev-help@ws.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: synapse-dev-help@ws.apache.org
>
>

Re: Proposal to combine the Inline script mediator with the Script mediator

Posted by "Asankha C. Perera" <as...@wso2.com>.
Hi Ant

Do you think you would have the time to see how we could migrate to BSF 
v3? As this will not affect the rest of Synapse, we could try this on a 
low priority thread when time permits..

thanks
asankha

Sanjiva Weerawarana wrote:
> +1 from me too! (And I'll hop over to the other side with my bsf hat 
> on too ..)
>
> Sanjiva.
>
> Asankha C. Perera wrote:
>> Hi Ant
>>> The best way to resolve this is to use JSR-223 instead of Apache BSF 
>>> v2 as JSR-223 script engines have an API to see if the engine is 
>>> threadsafe.
>>>
>>> BSF version 3 is implementing JSR-223 and there's a beta1-SNAPSHOT 
>>> available now but no proper release yet. I would have quite liked 
>>> Synapse 1.0 to use BSF v3 but didn't want to get in the way of the 
>>> release. We probably could get a BSF v3 beta1 release out quite 
>>> quickly if Synapse said it would use it. Is there an interested in 
>>> doing that?
>> Since we are not tied too much into BSF v2 anyway, I think it would 
>> be good to move to V3. So if the BSF folks could get a beta1 release 
>> out in the next couple of weeks, we could move our code to the V3 
>> beta1 snapshot in the meantime and check how we could use it.
>>
>> asankha
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: synapse-dev-help@ws.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org


Re: Proposal to combine the Inline script mediator with the Script mediator

Posted by Sanjiva Weerawarana <sa...@opensource.lk>.
+1 from me too! (And I'll hop over to the other side with my bsf hat on 
too ..)

Sanjiva.

Asankha C. Perera wrote:
> Hi Ant
>> The best way to resolve this is to use JSR-223 instead of Apache BSF 
>> v2 as JSR-223 script engines have an API to see if the engine is 
>> threadsafe.
>>
>> BSF version 3 is implementing JSR-223 and there's a beta1-SNAPSHOT 
>> available now but no proper release yet. I would have quite liked 
>> Synapse 1.0 to use BSF v3 but didn't want to get in the way of the 
>> release. We probably could get a BSF v3 beta1 release out quite 
>> quickly if Synapse said it would use it. Is there an interested in 
>> doing that?
> Since we are not tied too much into BSF v2 anyway, I think it would be 
> good to move to V3. So if the BSF folks could get a beta1 release out in 
> the next couple of weeks, we could move our code to the V3 beta1 
> snapshot in the meantime and check how we could use it.
> 
> asankha
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: synapse-dev-help@ws.apache.org
> 
> 

-- 
Sanjiva Weerawarana, Ph.D.
Founder & Director; Lanka Software Foundation; http://www.opensource.lk/
Founder, Chairman & CEO; WSO2, Inc.; http://www.wso2.com/
Director; Open Source Initiative; http://www.opensource.org/
Member; Apache Software Foundation; http://www.apache.org/
Visiting Lecturer; University of Moratuwa; http://www.cse.mrt.ac.lk/

---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org


Re: Proposal to combine the Inline script mediator with the Script mediator

Posted by "Asankha C. Perera" <as...@wso2.com>.
Hi Ant
> The best way to resolve this is to use JSR-223 instead of Apache BSF 
> v2 as JSR-223 script engines have an API to see if the engine is 
> threadsafe.
>
> BSF version 3 is implementing JSR-223 and there's a beta1-SNAPSHOT 
> available now but no proper release yet. I would have quite liked 
> Synapse 1.0 to use BSF v3 but didn't want to get in the way of the 
> release. We probably could get a BSF v3 beta1 release out quite 
> quickly if Synapse said it would use it. Is there an interested in 
> doing that?
Since we are not tied too much into BSF v2 anyway, I think it would be 
good to move to V3. So if the BSF folks could get a beta1 release out in 
the next couple of weeks, we could move our code to the V3 beta1 
snapshot in the meantime and check how we could use it.

asankha

---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org


Re: Proposal to combine the Inline script mediator with the Script mediator

Posted by ant elder <an...@gmail.com>.
On 3/15/07, Asankha C. Perera <as...@wso2.com> wrote:
>
> Hi Ant
>
> > No it doesn't apply correctly for me either sorry, can't see exactly
> > why yet, so if you have a zip then attaching that to the jira would be
> > helpful. The changes look fine to me though so if you already have it
> > applied locally feel free to just commit it.
> I committed this change, as I spent quite a bit of time trying to
> troubleshoot it myself.. I have reviewed the code, but would be great if
> you could go through as well. The main concern I have is whether
> BSFEngines are threadsafe. Check ScriptMediator.loadBSFEngine() and the
> comment I have made. If the engine is not thread safe we should
> synchronize access to it..


The best way to resolve this is to use JSR-223 instead of Apache BSF v2 as
JSR-223 script engines have an API to see if the engine is threadsafe.

BSF version 3 is implementing JSR-223 and there's a beta1-SNAPSHOT available
now but no proper release yet. I would have quite liked Synapse 1.0 to use
BSF v3 but didn't want to get in the way of the release. We probably could
get a BSF v3 beta1 release out quite quickly if Synapse said it would use
it. Is there an interested in doing that?

    ...ant

Re: Proposal to combine the Inline script mediator with the Script mediator

Posted by "Asankha C. Perera" <as...@wso2.com>.
Hi Ant

> No it doesn't apply correctly for me either sorry, can't see exactly 
> why yet, so if you have a zip then attaching that to the jira would be 
> helpful. The changes look fine to me though so if you already have it 
> applied locally feel free to just commit it.
I committed this change, as I spent quite a bit of time trying to 
troubleshoot it myself.. I have reviewed the code, but would be great if 
you could go through as well. The main concern I have is whether 
BSFEngines are threadsafe. Check ScriptMediator.loadBSFEngine() and the 
comment I have made. If the engine is not thread safe we should 
synchronize access to it..
> I see there's code in there for the wso2 axiom e4x impl, is there any 
> chance of getting a release of that made so the Synapse 1.0 could use it?
Yes, I was troubleshooting this last evening/night with Sameera who was 
working on this, and the Axiom/E4X code works correctly with Synapse as 
expected. However, they do not have a release (only snapshots) yet, and 
also in the unit test context - our test was failing. It was quite 
difficult to go through the rhino code as it lacked Javadocs/comments 
and had some weired code where member variables of one class were 
directly modified by another etc..  So now the Synapse code will work 
with either implementations according to whats available at runtime. If 
you check the pom.xml modifications - you will notice what needs to be 
changed to use it.

thanks
asankha

---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org


Re: Proposal to combine the Inline script mediator with the Script mediator

Posted by ant elder <an...@gmail.com>.
No it doesn't apply correctly for me either sorry, can't see exactly why
yet, so if you have a zip then attaching that to the jira would be helpful.
The changes look fine to me though so if you already have it applied locally
feel free to just commit it.

I see there's code in there for the wso2 axiom e4x impl, is there any chance
of getting a release of that made so the Synapse 1.0 could use it?

   ...ant

On 3/14/07, Asankha C. Perera < asankha@wso2.com> wrote:
>
>  Hi Ant
>
> Kasun has attached the patch to a JIRA here
> https://issues.apache.org/jira/browse/SYNAPSE-67 for review
>
> If you are unable to apply the patch, let me know and I will send you a
> tar of the changed classes. I had a lot of problems myself with the patch
> being incompatible between Kasuns system and mine (some hunk errors) -
> possibly due to some crazy line ending issues - even though both systems are
> Ubuntu and uses the same version of SVN.. Here is a list of the changes -
> note the deleted files.
>
> M
> modules/extensions/src/test/java/org/apache/synapse/mediators/AbstractTestCase.java
> M
> modules/extensions/src/test/java/org/apache/synapse/mediators/bsf/GroovyScriptMediatorTest.java
> M
> modules/extensions/src/test/java/org/apache/synapse/mediators/bsf/ScriptMediatorFactoryTest.java
> M
> modules/extensions/src/test/java/org/apache/synapse/mediators/bsf/convertors/JSOMElementConvertorTest.java
> M
> modules/extensions/src/test/java/org/apache/synapse/mediators/bsf/ScriptMediatorSerializationTest.java
> D
> modules/extensions/src/test/java/org/apache/synapse/mediators/bsf/InlineScriptMediatorTest.java
> M
> modules/extensions/src/test/java/org/apache/synapse/mediators/bsf/ScriptMediatorTest.java
> D
> modules/extensions/src/test/java/org/apache/synapse/mediators/bsf/ScriptMessageContextTest.java
> M
> modules/extensions/src/main/java/org/apache/synapse/mediators/bsf/ScriptMediatorFactory.java
> D
> modules/extensions/src/main/java/org/apache/synapse/mediators/bsf/InlineScriptMediatorSerializer.java
> M
> modules/extensions/src/main/java/org/apache/synapse/mediators/bsf/ScriptMediatorSerializer.java
> M
> modules/extensions/src/main/java/org/apache/synapse/mediators/bsf/convertors/JSOMElementConvertor.java
> M
> modules/extensions/src/main/java/org/apache/synapse/mediators/bsf/convertors/OMElementConvertor.java
> M
> modules/extensions/src/main/java/org/apache/synapse/mediators/bsf/convertors/RBOMElementConvertor.java
> M
> modules/extensions/src/main/java/org/apache/synapse/mediators/bsf/convertors/DefaultOMElementConvertor.java
> M
> modules/extensions/src/main/java/org/apache/synapse/mediators/bsf/convertors/GROOVYOMElementConvertor.java
> D
> modules/extensions/src/main/java/org/apache/synapse/mediators/bsf/InlineScriptMediator.java
> M
> modules/extensions/src/main/java/org/apache/synapse/mediators/bsf/ScriptMediator.java
> D
> modules/extensions/src/main/java/org/apache/synapse/mediators/bsf/ThreadLocalMessageContext.java
> M
> modules/extensions/src/main/java/org/apache/synapse/mediators/bsf/ScriptMessageContext.java
> M
> modules/extensions/src/main/resources/META-INF/services/org.apache.synapse.config.xml.MediatorSerializer
> M      modules/extensions/pom.xml
> M      pom.xml
>
> thanks
> asankha
>
>
> Asankha C. Perera wrote:
>
> Hi Ant
>
> Yes this will go into 1.0 RC1 and is complete, and I was just helping out
> Kasun with a code review today. This would be attached to the JIRA tomorrow
> and you could verify and commit after review.
>
> thanks
> asankha
>
> ant elder wrote:
>
> How are you getting on with this, are you still planing on looking at it?
> Is there anything I could do to help? Or take it one if you don't have time
> to do it now? Be good to try to get it done in time for the 1.0 release.
>
>    ...ant
>
> On 2/22/07, Kasun Samarasinghe <kasun@wso2.com > wrote:
> >
> > Hi
> >
> > Currently Synapse supports two variants for script mediation, where the
> > script could be specified through a property or inline.
> >
> > E.g.
> > <set-property name="prop" src="scriptfile.LL"/>
> >
> > in mediation
> > <script key="prop" function="mediation_function"/>
> >
> >
> > In line mediators where we specify the script type in it self as LL
> > E.g.
> > <script.LL><![CDATA[
> >           some script......
> > ]]></script.LL>
> >
> > I think these could be combined into one single script mediator.  Also,
> > I think its better to explicitly specify the script language, as
> > guessing the language when the script is specified by a property may
> > not
> > always be reliable. So the suggestion is
> >
> > E.g
> > <script type="LL" [key="prop"] [function="mediation_function"]>
> >         <![CDATA[.. inline script ..]]>?
> > </script>
> >
> > What do you think? I would be happy to raise a jira and submit a patch
> > for this enhancement
> >
> > thanks
> > kasun
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
> > For additional commands, e-mail: synapse-dev-help@ws.apache.org
> >
> >
>  --------------------------------------------------------------------- To
> unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org For additional
> commands, e-mail: synapse-dev-help@ws.apache.org
>
>  --------------------------------------------------------------------- To
> unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org For additional
> commands, e-mail: synapse-dev-help@ws.apache.org