db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Dudziak <to...@first.fhg.de>
Subject Re: [RFC] Using IoC for initializing the OJB runtime (OJB 1.1)
Date Tue, 26 Oct 2004 15:25:24 GMT
Leandro Rodrigo Saad Cruz wrote:

>>Right, didn't have the time yet to look at it in detail, but my first 
>>impression was that an easier way to accomplish this is to have the 
>>factory-class handled by the ComponentContainer too. This way, you can 
>>have singleton instances (the factory-method is not required to be 
>>static). Then there would be no need to add the useObjectFactory 
>>attribute and you won't have to wire this factory into OJB. A simple 
>>call to container.getInstance(classDesc.getFactoryClass()) - or better a 
>>variant of this method that creates a singleton if not yet defined - 
>>would suffice, wdyt ?
>>    
>>
>
>The problem is that we don't know into which container environment the
>persistent objects created by OJB should be used (pico, avalon, spring,
>etc) so.. as long as we can handle an *outside* instance of a
>ObjectFactory to the RowReader, we can plug ojb into any framework that
>needs that !
>
>So.. the ComponentContainer acts a object registry handling the
>ObjectFactory to the RowReader as needed, but, the ComponentContainer
>should be able to handle instances of ObjectFactor instantiated outside
>OJB !
>  
>
Hmm, I don't see the problem here ? Say, you specify a class 
SpringIntegration as the factory class of a certain class descriptor A 
and the method createA as the factory method. If now OJB wants to create 
an object of type A, it fetches an instance of SpringIntegration (which 
might or might not be a singleton) from the ComponentContainer and 
invokes createA. The ComponentContainer itself can create the 
SpringIntegration instance or it might have been created outside of OJB 
and then set via 
OJB.getComponentContainer().setSingletonInstance(SpringIntegration.class, 
integrationInstance) or something similar. In this case it does not 
matter whether the ComponentContainer itself uses Pico or Spring or 
whatever since the SpringIntegration is free to do whatever it takes to 
create the A instance.

Tom


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


Mime
View raw message