avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen McConnell <mcconn...@apache.org>
Subject Re: Avalon 5 Core Interfaces
Date Thu, 30 Jan 2003 11:19:43 GMT


Antti Koivunen wrote:

> Sorry for the delayed reply.
>
> Stephen McConnell wrote:
>
>>
>>
>> Antti Koivunen wrote:
>>
> <snip/>
>
>>>
>>>   Object logger = context.get(LOGGER);
>>>   if (logger instanceof avalon.Logger) {
>>>       m_logger = (avalon.Logger) logger;
>>>   } else if (logger instanceof commons.Log) {
>>>       m_logger = new Commons2AvalonLogger((commons.Log) logger);
>>>   }
>>>
>>> This would of course also work the other way round, i.e. you could 
>>> put an instance of VeryNiceLogger2AvalonLogger to the context of 
>>> VeryNiceService. However, if VeryNiceCompany had never heard of 
>>> Avalon (or IoC), and used static factories for accessing the 
>>> loggers, there'd be little we could do without changing the code.
>>
>>
>>
>>
>> Burrrrk!
>> (i.e. I don;t like the approach)
>>
>> :-)
>
>
> (figured as much ;)
>
> I suppose it does rather look like a hack :) And actually it would be 
> possible to also hack around the static factory thing by using custom 
> classloaders.
>
>
>> Component declares a logging strategy to the container:
>>
>>  <type>
>>    <loggers>
>>      <attributes>
>>        <attribute key="urn:assembly:lifecycle.logging.strategy"
>>          value="org.somwhere.MyPreferredLoggingInterface"/>
>>      </attributes>
>>    </loggers>
>>  </type>
>>
>> Cantainer reolves a logging handler and uses this during the logging 
>> stage of the deployment lifecycle.
>
>
> Yes, this is a nice feature.


(it will be a nice feature - it exists for context and I want to 
propergate the notion into the other lifecycle stage handlers)

>
>
>> Take a look in 
>> avalon-sandbox/merlin/src/test/org/apache/avalon/playground/
>> You will find the file: StandardComponent.xinfo.  This component is 
>> doing exactly the same thing except its declaring that it wants to 
>> use a custom context interface.  If you run the merlin demo you will 
>> see it working:
>>
>>  $ merlin -profile config/demo.xml
>
>
> I get the following error:


Fixed - I had some experimental stuff in there using soureresolver that 
I have removed pending the resolution of a test-case for the 
sourceresolver package.

Do a CVS update and all should be fine.

Cheers, Steve.

-- 

Stephen J. McConnell
mailto:mcconnell@apache.org
http://www.osm.net




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


Mime
View raw message