"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#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...