synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Saliya Ekanayake <>
Subject Re: Setting the Required Function in Inlined Scripts
Date Tue, 26 Aug 2008 11:53:02 GMT
Ruwan Linton wrote:
> Saliya and Asankha,
> I disagree here, note that these two modes handle two different scopes 
> of the scripts. Yes, it is possible to add a script with functions in 
> the inline scripting case, but this mode is rather expected to be used 
> in very simple mediation. In that case you do not have functions 
> declared inside the script but it is just a set of statements to be 
> executed.
If the concept is to facilitate simple scripts (i.e. without methods) in 
the inlined case and support any sort of a script in the external case 
then that's fine. Anyway it's useless to have an Inlined script with 
several methods if you want to execute just one of them. However, if the 
user provides an Inlined script where the outside code invokes a 
function in the same script then it will work, won't it?

Anyway I think it'll be great if we can put a line into the 
documentation saying that Inlined scripts are ought to be simple where 
as external ones may be complex and can be reused.

> In contrast, if you look at the referred external script then it is 
> more or less a set of functions and the main function that you need to 
> invoke has to be specified and this defaults to "mediate" if not 
> specified. In order to understand this in detail, you may have a look 
> at the invokeScript method of the ScriptMediator class in which you 
> call mediateWithExternalScript if the script is external and if the 
> script is inline it just executes the statements in the specified 
> order which is evaluated in the method mediateForInlineScript.
> I suppose this separation is good an provides a simple mediation 
> approach as well as a complex mediation approach if required.
> Thanks,
> Ruwan
> On Tue, Aug 26, 2008 at 2:12 PM, Asankha C. Perera < 
> <>> wrote:
>     Saliya
>     If I remember correctly, if you do not specify the name of the
>     function, we look for a function named "mediate".. However, I
>     agree with your view that we should execute anything outside the
>     functions.. we also need someone to take the Script mediator to
>     support JDK 1.6 :-) !
>     asankha
>     Saliya Ekanayake wrote:
>>     Hi all,
>>     I am bit new to the script mediator. The synapse configuration
>>     language mentions that we can define the which function to be
>>     executed in the script if the script already exists (i.e.
>>     referred by a key). The script can also be inlined according to
>>     the document, but in this case it doesn't mention how can we
>>     specify which function to be executed. If the script doesn't
>>     contain any functions then executing the inlined script makes
>>     sense, but if there are functions and the script is inlined then
>>     executing the script means to execute anything outside the
>>     functions isn't it? This is the same behavior in Rhino [1] when
>>     you try to execute a JavaScript containing functions.
>>     If my argument is wrong please correct me and let me know how to
>>     specify the function to be executed when the script is inlined.
>>     Thanks in advance,
>>     Saliya
>>     ---------------------------------------------------------------------
>>     To unsubscribe, e-mail:
>>     <>
>>     For additional commands, e-mail:
>>     <>
>     -- 
>     Asankha C. Perera
>     WSO2 -
> -- 
> Ruwan Linton
> - "Oxygenating the Web Services Platform"

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message