cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Hartle <mhar...@hartle-klug.com>
Subject Re: Introducing IOC for Java classes created in flowscript
Date Fri, 21 Nov 2003 10:11:21 GMT
Sylvain Wallez wrote:

> Michael Hartle wrote:
>
>> Sylvain Wallez wrote:
>>
>>> Bertrand Delacretaz wrote:
>>>
>>>> Le Jeudi, 20 nov 2003, à 18:12 Europe/Zurich, Sylvain Wallez a écrit :
>>>>
>>>>> ...Rhino also provides some very easy solutions to this:
>>>>> - http://www.mozilla.org/rhino/tutorial.html#ImplementingInterfaces
>>>>> - paragraph "JavaAdapter constructor" at 
>>>>> http://www.mozilla.org/rhino/scriptjava.html
>>>>
>>>>
>>>>
>>>> ok, cool, I wasn't aware of this, looks similar to what BeanShell 
>>>> does.
>>>>
>>>> The advantage with BeanShell is that the syntax *is* java - one can 
>>>> prototype in script and later move the code to compilable classes 
>>>> (just FYI - I don't mean we should switch now ;-)
>>>
>>> Sounds interesting. But you know the initial requirement for any 
>>> flowscript language: continuations...
>>
>> If I understood Bertrands hint towards BeanShell right, it would 
>> allow the people who are affraid of writing "real" Java code to 
>> script an object which is then used in the flowscript we have today - 
>> not replacing the current continuation language, but easing the 
>> transition for scripters towards Java for objects to be called from 
>> the flowscript.
>
> And also the other way around: BeanShell would allow people who are 
> reluctant to using server-side JS to use the familiar Java syntax. But 
> once again, the first requirement is to have continuation support.

I think there still some misunderstanding; BeanShell does not provide 
continuations and is not suited for running as a flowscript language 
like the Rhino JS (with its continuation support) does - here we agree. 
But thats not the point of Bertrand, as beanShell can turn a script into 
a Java object which in turn can be used in a typical, today JS flowscript.

Instead of an object of a Java class Foo being hardcoded (and supposedly 
feared by hardcore scripters due to compilation/packaging requirements), 
it would result into something along the lines of

>  var foo = BeanShell.newObjectFromScript("myScriptedBusinessLogic.bs");
>  cocoon.setupObject(foo);
>  foo.doIt("blah"); 

showing the example in conjunction with your proposed extension to 
honour lifecycle interfaces. Or putting it the other way around, the 
previously shown

>  var foo = new Foo();
>  cocoon.setupObject(foo);
>  foo.doIt("blah"); 

Foo class written in Java certainly does not have any 
continuation-related extension - nor would the BeanShell-resulting 
object need it, or ?

Best regards,

Michael Hartle,
Hartle & Klug Consulting GmbH


Mime
View raw message