All, An idea came to me during my morning walk today. It's amazing what a little exercise will do for your brain. Anyway, in HiveMind, dependency injection should be free (and I do mean as in beer). If someone wants to write a custom service implementation factory, they shouldn't be worried about the dependency injection part and they shouldn't have to use BuilderFactory to get it. Here's my idea:
<service-point id="MyService" interface="com.myco.MyService"> <instance class="com.myco.MyServiceImpl"> <assembly autowire="true"> <!-- autowire would be on by default --> <set property="myDao" value="service:MyDao" /> <set property="myConfig" value="config:ConfigurationParameters" /> <listener service-id="MyEventSource" /> </assembly> </instance> </service-point> Now, this is for the trivial case where we're not using a "factory", but here's the syntax for that: <service-point id="MyService" interface="org.hibernate.SessionFactory"> <instance factory-id="HibernateSessionFactoryFactory"> <configuration> <mapping file="yadda yadda" /> </configuration> <assembly autowire="false"> <set property="myDao" value="service:MyDao" /> <set property="myConfig" value="config:ConfigurationParameters" /> <listener service-id="MyEventSource" /> </assembly> </instance> </service-point> So, within any <instance> element you can give it "assembly instructions" and HiveMind will wire it together accordingly. So, the <instance> element tells us to either instantiate a class directly (using reflection or we can generate instantiator classes using Javassist if we really want) or call a ServiceImplementationFactory to get the instance. This way, a user can create their own ServiceImplementationFactory and not worry about the dependencies at all. HiveMind will take care of that. If you want to do constructor-based dependency injection, you would have to use the "hivemind.CbdiFactory" factory, which would allow parameters to tell it what constructor to use and what parameters (no params means find the "longest" possible constructor and use that). And <implementation> elements can contain exactly the same thing as <service-point> elements just like we do now. So, what do you think? James --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]