[Design the new POJO MicroContainer] - Re: GenericBeanFactory and install methods
by scott.stark@jboss.org
A little more fleshed out:
| /**
| * A factory for creating a collection of related mc beans based on a
| * template of BeanMetaData[] from a BeanMetaDataFactory.
| *
| * @author Scott.Stark(a)jboss.org
| * @version $Revision:$
| */
| public interface ComponentFactory
| {
| /**
| * the factory which defines template BeanMetaData[] for the components
| * @return the BeanMetaDataFactory defining the component beans
| */
| public BeanMetaDataFactory getFactory();
|
| /**
| * Install a collection of mc beans based on the factory metadata.
| *
| * @param baseName - the base bean name used in conjuction wth the factory.getBeans()
| * BeanMetaData instances getName() to build the unique bean name:
| * baseName + bmd.getName() + "#" + compID;
| * @return the list of mc bean names installed.
| */
| public List<String> createComponents(String baseName);
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4142624#4142624
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4142624
18 years
[Design the new POJO MicroContainer] - Re: GenericBeanFactory and install methods
by scott.stark@jboss.org
And going through this again, its probably nothing more than another pattern on top of existing mc notions:
| interface ComponentFactory
| {
| List<String> createComponent(String baseName);
| }
|
| class GenericComponentFactory implements KernelControllerContextAware
| {
| BeanMetaDataFactory componentsFactory;
| int compID;
|
| List<String> createComponent(String baseName)
| {
| int nextID = incCompID();
| KernelController controller = ...;
| List<BeanMetaData> compBeans = componentsFactory.getBeans();
| for(BeanMetaData bmd : compBeans)
| {
| String beanName = baseName + bmd.getName() + "#" + nextID;
| controller.install(beanName, bmd); // Ignoring there is no install taking the bean name
| compNames.add(beanName);
| }
| return compNames;
| }
| }
|
The ComponentFactory/GenericComponentFactory would be used similar to how BeanFactory/GenericBeanFactory are currently.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4142612#4142612
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4142612
18 years
[Design the new POJO MicroContainer] - GenericBeanFactory and install methods
by scott.stark@jboss.org
An issue I have with creating a custom BeanFactoryMetaData instance that models an ejb container is that I want to have the ejb interceptors added to the ejb bean context via install methods. The custom BeanFactoryMetaData (org.jboss.test.kernel.deployment.support.container.BeanContextFactory) creates 4+ BeanMetaDatas:
1. GenericBeanFactory(BeanContext) - is the bean factory for creating the bean component consisting of:
2 - bean context
3 - + bean instance
4 - + 0 or more bean interceptors
The BeanMetaData for the interceptors wants to install the interceptor bean into the BeanContext by calling the addInterceptor method. However, the BeanMetaData for the BeanContext if the GenericBeanFactory. There is no notion of the GenericBeanFactory acting as a proxy for the BeanContext instances in terms of install/uninstall callbacks.
Its not obvious how this can be supported in the current impl as the GenericBeanFactory.createBean instances are themselves not mc beans with a name that could be used with the interceptor install metadata.
Ideas on how to do this, add support for it?
See the org.jboss.test.kernel.deployment.test.BeanContainerUsageTestCaseMD.testComponentBeanFactory for the current wiring.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4142548#4142548
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4142548
18 years