01: package org.concern.controller.jmx;
02:
03: import org.concern.controller.ResourceLocator;
04: import javax.naming.InitialContext;
05: import javax.naming.NamingException;
06: import org.concern.controller.Controller;
07:
08: public class JndiResourceLocator implements ResourceLocator {
09:
10: private Controller controller;
11:
12: private String prefix = "";
13:
14: public JndiResourceLocator() {
15: }
16:
17: public String getPrefix() {
18: return prefix;
19: }
20:
21: public void setPrefix(String prefix) {
22: this .prefix = prefix;
23: }
24:
25: public Object lookup(String name) {
26: try {
27: return new InitialContext().lookup(prefix + name);
28: } catch (NamingException e) {
29: throw new RuntimeException(e);
30: }
31: }
32:
33: public void setController(Controller controller) {
34: this.controller = controller;
35: }
36: }
|