KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > spring > kernel > ControllerLocator


1 /**
2  * User: alesj
3  * Date: 18.4.2006
4  * Time: 12:42:33
5  *
6  * (C) Genera Lynx d.o.o.
7  */

8
9 package org.jboss.spring.kernel;
10
11 import org.jboss.dependency.spi.ControllerContext;
12 import org.jboss.kernel.spi.dependency.KernelController;
13
14 /**
15  * @author <a HREF="mailto:ales.justin@genera-lynx.com">Ales Justin</a>
16  */

17 public class ControllerLocator implements Locator
18 {
19
20    private KernelController controller;
21
22    protected ControllerLocator()
23    {
24    }
25
26    public ControllerLocator(KernelController controller)
27    {
28       this.controller = controller;
29    }
30
31    public KernelController getController()
32    {
33       return controller;
34    }
35
36    public Object JavaDoc locateBean(String JavaDoc beanName)
37    {
38       ControllerContext context = getController().getInstalledContext(beanName);
39       if (context == null)
40       {
41          return null;
42       }
43       return context.getTarget();
44    }
45
46 }
47
Popular Tags