1 45 package org.exolab.jms.server; 46 47 import java.util.Hashtable ; 48 49 import javax.naming.Context ; 50 import javax.naming.InitialContext ; 51 import javax.naming.NamingException ; 52 53 import org.exolab.jms.config.Configuration; 54 import org.exolab.jms.config.JndiConfiguration; 55 import org.exolab.jms.config.Property; 56 import org.exolab.jms.server.EmbeddedNameService; 57 58 59 67 public class NamingHelper { 68 69 78 public static Context getInitialContext(Configuration config) 79 throws NamingException { 80 Context initial = null; 81 82 if (config.getServerConfiguration().getEmbeddedJNDI()) { 83 initial = EmbeddedNameService.getInstance().getInitialContext(); 84 } else { 85 Hashtable environment = new Hashtable (); 86 Property[] properties = 87 config.getJndiConfiguration().getProperty(); 88 for (int index = 0; index < properties.length; ++index) { 89 environment.put(properties[index].getName(), 90 properties[index].getValue()); 91 } 92 initial = new InitialContext (environment); 93 } 94 return initial; 95 } 96 97 } | Popular Tags |