1 22 package org.jboss.iiop.naming; 23 24 import java.util.Hashtable ; 25 import javax.naming.Context ; 26 import javax.naming.Name ; 27 import javax.naming.NamingException ; 28 import org.jnp.interfaces.NamingContextFactory; 29 import org.omg.CORBA.ORB ; 30 31 38 public class ORBInitialContextFactory extends NamingContextFactory 39 { 40 public static final String ORB_INSTANCE = "java.naming.corba.orb"; 41 42 43 private static ORB orb; 44 45 50 public static void setORB(ORB orb) 51 { 52 ORBInitialContextFactory.orb = orb; 53 } 54 55 public Context getInitialContext(Hashtable env) throws NamingException 56 { 57 insertORB(env); 58 return super.getInitialContext(env); 59 } 60 61 public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception 62 { 63 insertORB(environment); 64 return super.getObjectInstance(obj, name, nameCtx, environment); 65 } 66 67 protected void insertORB(Hashtable environment) 68 { 69 if (orb != null && environment.containsKey(ORB_INSTANCE) == false) 70 environment.put(ORB_INSTANCE, orb); 71 } 72 } 73 | Popular Tags |