cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: Introducing IOC for Java classes created in flowscript
Date Mon, 24 Nov 2003 16:06:09 GMT
Stefano Mazzocchi wrote:

>
> On 21 Nov 2003, at 09:45, Sylvain Wallez wrote:
>
>> Vadim Gritsenko wrote:
>>
>>> Sylvain Wallez wrote:
>>> ......
>>>
>>>> So I added a new method to "cocoon" that sets up an object just as 
>>>> if it were an Avalon component by honoring the various lifecycle 
>>>> interfaces.
>>>>
>>>> Some useful lifecycle interfaces to implement are of course 
>>>> LogEnabled and Serviceable, but also Contextualizable, which gives 
>>>> access to the object model through the ContextHelper class.
>>>>
>>>> Example:
>>>>  var foo = new Foo();
>>>>  cocoon.setupObject(foo);
>>>>  foo.doIt("blah");
>>>>
>>>> This way of setting up object respects IOC, avoids using the very 
>>>> specific "FOM_Cocoon" class and gently educates people to the good 
>>>> things provided by Avalon.
>>>
>>>
>>>
>>>
>>> To make it even more avalonish, this method should instantiate 
>>> object as well. So it will become:
>>>
>>>    var foo = cocoon.summonObject("com.mycompany.Foo");
>>
>>
>>
>> Good idea. But I'm not sure "summon" is a so common word (I had to 
>> look in a dictionary). What about the more traditional "createObject" 
>> or "instanciateObject"?
>
>
> How about simply
>
>  var foo = cocoon.getComponent("com.mycompany.Foo");
>
> and trying to do "role to class lookup" transparently?


I'm not comfortable with this transparently which may fool the user in 
believing she's using "real" avalon components when these are just fake 
ones whose lifestyle (threadsafe,etc) should be handled by the flowscript.

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com



Mime
View raw message