1 18 package org.apache.geronimo.interop.naming; 19 20 import java.util.HashMap ; 21 import javax.naming.NamingException ; 22 23 import org.apache.geronimo.interop.adapter.Adapter; 24 25 public class NameService { 26 private static NameService ns = null; 27 28 public static synchronized NameService getInstance() { 29 if (ns == null) { 30 ns = new NameService(); 31 ns.init(); 32 33 } 34 return ns; 35 } 36 37 private org.apache.geronimo.interop.naming.InitialContext context; 38 39 42 public void bindAdapter(Adapter adp) { 43 NamingContext.getInstance(NameService.class).bindAdapter(adp); 44 } 45 46 public void unbindAdapter(Adapter adp) { 47 NamingContext.getInstance(NameService.class).unbindAdapter(adp); 48 } 49 50 public static org.apache.geronimo.interop.naming.InitialContext getInitialContext() { 51 return getInstance().context; 52 } 53 54 public HashMap getMap() { 55 return context.getMap(); 56 } 57 58 public Object lookup(String name) throws NamingException { 59 return context.lookup(name); 60 } 61 62 protected void init() { 63 context = new org.apache.geronimo.interop.naming.InitialContext(null); 64 } 65 } 66 | Popular Tags |