[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Scoped beans deployment

adrian@jboss.org do-not-reply at jboss.com
Thu Feb 8 11:35:34 EST 2007


The scopes/annotations still need to be defined.
I have no idea what they should look like without delving deeper into use cases.

For our tests you could just create the simple ones so you can do something like:

  | <!-- Deploy shared metadata -->
  | <policy>
  |    <scope>@org.jboss.metadata.spi.annotations.JVMScope</scope>
  |    <binding>...</binding>
  | </policy>
  | 
  | <!-- Deploy bean level metadata -->
  | <policy>
  |    <scope>@org.jboss.metadata.spi.annotations.InstanceScope("BeanName")</scope>
  |    <binding>...</binding>
  | </policy>
  | 
  |   | 
  |   | To make this work for generic scopes, the annotation will need to be meta-annotated
  |   | so we know what it means:
  |   | 
  |   | 
  |   |   | public interface ScopeFactory<T extends Annotation>
  |   |   | {
  |   |   |    ScopeKey create(T annotation);
  |   |   | }
  |   |   | 
  |   |   | public class InstanceScopeFactory<InstanceScope annotation>
  |   |   | {
  |   |   |    public ScopeKey create(T annotation)
  |   |   |    {
  |   |   |       return new ScopeKey(CommonLevels.INSTANCE, annotation.value());
  |   |   |    }
  |   |   | }
  |   |   | 
  |   |   | @ScopeFactory(class=InstanceScopeFactory.class)
  |   |   | public @interface InstanceScope
  |   |   | {
  |   |   |    /** The bean name */
  |   |   |    String value();
  |   |   | }
  |   |   | 
  |   | 
  |   | You can also provide something that doesn't use annotations for common 
  |   | simple cases,
  |   | e.g.
  |   | 
  |   |   |    <scope level="Instance" qualifier="BeanName"/>
  |   |   | 
  |   | 
  |   | In general, your are going to have something more qualified like:
  |   | 
  |   |   |    <scope level="Application" qualifier="MyDeployment.ear"/>
  |   |   |    <scope level="Deployment" qualifier="MyWeb.war"/>
  |   |   |    <scope level="Instance" qualifier="MyServlet"/>
  |   |   | 
  |   | 
  |   | This is all very speculative until we have gone through the use cases
  |   | for how this will be used in real life.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4013118#4013118

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4013118



More information about the jboss-dev-forums mailing list