[Design the new POJO MicroContainer] - Re: Scoped beans deployment
by alesj
"adrian(a)jboss.org" wrote :
| 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(InstanceScope annotation)
| | {
| | return new ScopeKey(CommonLevels.INSTANCE, annotation.value());
| | }
| | }
| |
| | @ScopeFactory(class=InstanceScopeFactory.class)
| | public @interface InstanceScope
| | {
| | /** The bean name */
| | String value();
| | }
| |
For the last example we probably need new annotation with the same name as ScopeFactory interface.
Any other possible name or diff package?
I'm currently putting these things into org.jboss.metadata.spi.scope and org.jboss.metadata.plugins.scope in Container.
What about in the case when Scope annotation doesn't have a factory determining annotation? Ok, since we are the ones that will be providing these scope annotations, we can throw an exception or should presume some default ScopeKey?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4013145#4013145
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4013145
19 years, 2 months
[Design the new POJO MicroContainer] - Re: Scoped beans deployment
by adrian@jboss.org
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
19 years, 2 months