[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: GenericBeanFactory and install methods (Repost)
scott.stark@jboss.org
do-not-reply at jboss.com
Thu Apr 10 01:41:21 EDT 2008
Which has now expanded to:
| /**
| * Factory for the BeanMetaData describing component instances.
| * @author Scott.Stark at jboss.org
| * @version $Revision:$
| */
| public interface ComponentBeanMetaDataFactory
| {
| /**
| * Create the beans that will be created together as a component.
| *
| * @param baseName - base name used to derive unique bean name
| * @param compID - component id used to derive unique bean name
| * @param nameBuilder - transformer used to derive unique bean name from baseName/compID
| * @param visitor - optional visitor that may augment BeanMetaData
| * @return list of beans describing the component
| */
| public List<BeanMetaData> getBeans(String baseName, long compID,
| ComponentNameBuilder nameBuilder, ComponentVisitor visitor);
| }
|
| /**
| * A factory for creating a collection of related mc beans based on a
| * template of BeanMetaData[] from a BeanMetaDataFactory.
| *
| * @author Scott.Stark at jboss.org
| * @version $Revision:$
| */
| public interface ComponentFactory<T>
| {
| /**
| * the factory which defines template BeanMetaData[] for the components
| * @return the BeanMetaDataFactory defining the component beans
| */
| public ComponentBeanMetaDataFactory 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 component context instance information.
| * @throws Throwable - on failure to install the component beans
| */
| public ComponentInstance<T> createComponents(String baseName)
| throws Throwable;
|
| /**
| * Extract the unique component id from a component bean name.
| * @param name - a name previously returned from createComponents.
| * @return the component id portion of the name
| * @throws NumberFormatException - if name is not a valild bean component
| * name with a component id.
| */
| public long getComponentID(String name) throws NumberFormatException;
|
| /**
| * Uninstall the component beans for the given instance
| * @param instance - the ComponentInstance previously returned from createComponents
| * @throws Exception - on failure to uninstall the component beans
| */
| public void destroyComponents(ComponentInstance<T> instance)
| throws Exception;
| }
|
| /**
| * The component context instance. This is the bean that acts as the container
| * for the component bean instances.
| *
| * @author Scott.Stark at jboss.org
| * @version $Revision:$
| */
| public interface ComponentInstance<T>
| {
| /**
| * Get the name of the bean for the component context instance
| * @return
| */
| public String getContextName();
| /**
| * Get the component bean names
| * @return
| */
| public List<String> getComponentNames();
| /**
| * Get the id associated with this component
| * @return
| */
| public long getComponentID();
| /**
| * Get the component context instance
| * @return
| */
| public T getContext();
|
| }
|
| /**
| * Abstraction for building/parsing component names
| *
| * @author Scott.Stark at jboss.org
| * @version $Revision:$
| */
| public interface ComponentNameBuilder
| {
| /**
| * Create a globally unique mc bean name
| * @param baseName - base name used to derive unique bean name
| * @param compName - the component name used to derive unique bean name
| * @param compID - component id used to derive unique bean name
| * @return the unique mc bean name
| */
| public String buildName(String baseName, String compName, long compID);
| /**
| * Parse a mc bean name for the component id
| * @param name - the mc bean name
| * @return the component id
| * @throws NumberFormatException
| */
| public long getComponentID(String name) throws NumberFormatException;
| }
|
| /**
| * A component bean factory visitor plugin that allows for extension of the
| * bean metadata produced by the factory.
| *
| * @author Scott.Stark at jboss.org
| * @version $Revision:$
| */
| public interface ComponentVisitor
| {
| /**
| * Visit callback to allow for augmentation of a components bean metadata.
| * @param builder - the bean metadata build facade to augment the metadata
| * @param baseName - the bean base name
| * @param componentName - the bean component name
| * @param compID - the bean component id
| */
| void visit(BeanMetaDataBuilder builder, String baseName,
| String componentName, long compID);
|
| }
|
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
More information about the jboss-dev-forums
mailing list