You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hivemind.apache.org by "Stefano Turri (JIRA)" <hi...@jakarta.apache.org> on 2005/01/25 19:07:17 UTC

[jira] Commented: (HIVEMIND-72) BuilderFactory extension

     [ http://issues.apache.org/jira/browse/HIVEMIND-72?page=comments#action_58056 ]
     
Stefano Turri commented on HIVEMIND-72:
---------------------------------------

I've written an ObjectProvider implementation with some of the features (including a simple factory-method guessing algorithm) mentioned in:

http://article.gmane.org/gmane.comp.jakarta.hivemind.user/327

Such an ObjectProvider, in my opinion, is useful to wire together services and/or objects provided by static factory methods, enabling/simplifying the use of legacy code in hivemind configuration.

I'm attacching the implementation and test class (loosely based on ObjectProviders and TestObjectProviders classes). I'm sorry but the test class uses DynaMocks instead of Easymocks, if you find it useful i've no problem changing it to use easymocks.

Best Regards
Stefano


> BuilderFactory extension
> ------------------------
>
>          Key: HIVEMIND-72
>          URL: http://issues.apache.org/jira/browse/HIVEMIND-72
>      Project: HiveMind
>         Type: Improvement
>   Components: framework
>     Reporter: Istvan Orban
>     Priority: Minor
>  Attachments: FactoryObjectProvider.java, FactoryObjectProviderTest.java
>
> Hi,
> I asked about this thing on the mailing list, since it was not a bad idea I though it's best to create here. 
> If you have a service (B) which can only be instanciated by an other
> factory service (A). you have to write your own factory class which
> implements the
> ServiceImplementationFactory. I have seen some example of doing it.
> I think this is a general problem that. the BuilderFactory should not
> instance the class by calling it's contructor but to call an other
> service's method.
> would extending the BuilderFactory be a good idea on the following way.
>       <invoke-factory service-id="hiveMind:BuilderFactory">
>             <construct class="MyServiceB"
> contructor-service-id="MySerciceA" constructor-method="createServiceB">
>               .....
>               <event-listener
> service-id="hivemind.ShutdownCoordinator"/>
>             </construct>
>        </invoke-factory>
> with these extra tags one could specify which method of the MyServiceA
> returns an instance of the MyServiceB
> so I can use all the power of the Configuration and Autowite provided
> already by the the BuilderFactory etc.
> I'm asking this because I have seen examples (providing hivernate
> session and transaction stuff) where they just implemented the
> 'ServiceImplementationFactory' but then you have to write again all the
> cool function which does the autowite and all other cool stuff for you.... 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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