[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: Scoped Kernels
alesj
do-not-reply at jboss.com
Wed Feb 21 06:06:29 EST 2007
"alesj" wrote :
| 3) While testing, how to get the actual bean / context from bootstrapping kernel / controller, since the real bean / context is present in some scoped child controller.
I've added this:
| private class TestController extends AbstractController
| {
| private AbstractController delegate;
|
| public TestController(AbstractController controller) throws Exception
| {
| this.delegate = controller;
| }
|
| public ControllerContext getContext(Object name, ControllerState state)
| {
| return findContext(delegate, name, state);
| }
|
| private ControllerContext findContext(AbstractController controller, Object name, ControllerState state)
| {
| ControllerContext context = controller.getContext(name, state);
| if (context != null)
| {
| return context;
| }
| else
| {
| for (AbstractController childController : controller.getControllers())
| {
| ControllerContext ctx = findContext(childController, name, state);
| if (ctx != null)
| return ctx;
| }
| }
| return null;
| }
| }
|
I have some public methods in AbstractController that it would be better if they were not public. I'll fix them later - when we decide what to put in SPI.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4019841#4019841
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4019841
More information about the jboss-dev-forums
mailing list