1 6 7 package org.jfox.jndi; 8 9 import java.net.URL ; 10 import java.util.Hashtable ; 11 import javax.naming.Context ; 12 import javax.naming.Name ; 13 import javax.naming.NamingException ; 14 import javax.naming.Reference ; 15 16 19 20 21 public class InitialContextFactoryImpl implements javax.naming.spi.InitialContextFactory , javax.naming.spi.ObjectFactory { 22 23 public Context getInitialContext(Hashtable env) throws NamingException { 24 if(env == null) { 25 env = JNDIProperties.getDefaultEnvironment(); 26 } 27 else { 28 env = JNDIProperties.mergeEnvironment(env); 29 } 30 31 return new ContextImpl("/", env); 32 } 33 34 public Object getObjectInstance(Object obj, Name name, Context ctx, Hashtable environment) throws Exception { 36 Reference ref = (Reference ) obj; 38 String url_string = (String ) ref.get("URL").getContent(); 39 URL url = new URL (url_string); 40 return url.getContent(); 41 } 42 43 public static void main(String [] args) { 44 45 } 46 } 47 | Popular Tags |