hivemind-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Jakarta HiveMind Wiki] New: PrototypeBeanFactory
Date Tue, 06 Jul 2004 21:50:55 GMT
   Date: 2004-07-06T14:50:55
   Editor: <>
   Wiki: Jakarta HiveMind Wiki
   Page: PrototypeBeanFactory

   no comment

New Page:

= Problem Description =

July 6 2004, 1.0beta

The BeanFactory ([])
from the HiveMind library is able to produce plain java beans of a certain type. What it is
missing is the possibility to use all the rich configuration options, that are available to
services that use the BuilderFactory. 
This would close the missing gap to springs prototype beans and for example could be used
for creating prototyped struts actions (sorry to all you tapestry folks) or command beans,
that realize a command design pattern.

= Proposed Solution =

Add a new PrototypeBeanFactory which uses a contribution schema that supports most of the
options of BuilderFactory. 


{{{service-point (id=TestPrototypeBeanFactory 
  invoke-factory (service-id=hivemind.exlib.PrototypeBeanFactoryBuilder)
    factory (vend-class=org.apache.hivemind.factory.PrototypeBean 

configuration-point (id=SimpleBeanFactory 

contribution (configuration-id=SimpleBeanFactory)
  bean (name=bean1 class=org.apache.hivemind.factory.PrototypeBean)
    set(property=property value=testValue1)
    set-service(property=service service-id=foo.businessService)
  bean (name=bean2 class=org.apache.hivemind.factory.PrototypeBean
    service { "foo.businessService" }
    string { "testValue2" }

This example demonstrates the configuration of a factory which builds beans of the type {{{org.apache.hivemind.factory.PrototypeBean}}}.
bean1 is configured by using setter methods, bean2 is configured by using constructor parameters.

Usage of the factory would be like this:

PrototypeBeanFactory factory = (PrototypeBeanFactory) 
PrototypeBean bean1 = (PrototypeBean) factory.get("bean1");
PrototypeBean bean2 = (PrototypeBean) factory.get("bean2");

= Discussion =

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message