[Design the new POJO MicroContainer] - Re: Scoped beans deployment
by adrian@jboss.org
"bill.burke(a)jboss.com" wrote :
| In MC land, this would translate to describing each bean deployed to a particular scope and this meta cloned to a new kernel that finally installs the beans.
|
The same feature has also been requested by jbpm.
Although there it is more related to scoped factory references that pass under the wire.
And there are multiple runtime scopes e.g. a process is long running
but can have subtasks that override the process with different factories.
The basic code would then look something like:
| // Get the current metadata
| MetaData metaData = MetaDataStack.peek();
|
| // Get the controller
| KernelController controller = metaData.getMetaData(Kernel.class).getController();
|
| // Get the factories and create the objects
| SomeFactory factory1 = controller.getInstance("SomeFactory").getTarget();
| MyObject1 object = factory1.create();
| AnotherFactory factory2 = controller.getInstance("AnotherFactory").getTarget();
| MyObject2 object = factory2.create();
|
Incidently, it would look much nicer if the scope included a MetaDataLoader
that just delegated to the local kernel, i.e. it did the wiring above inside the
MetaDataLoader.
| // Get the current metadata
| MetaData metaData = MetaDataStack.peek();
|
| // Get the factories and create the objects
| SomeFactory factory1 = metaData.getMetaData(SomeFactory.class);
| MyObject1 object = factory1.create();
| AnotherFactory factory1 = metaData.getMetaData(AnotherFactory.class);
| MyObject2 object = factory2.create();
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4008912#4008912
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4008912
17 years, 11 months