1 package org.jboss.cache.transaction; 2 3 import javax.naming.Context; 4 import javax.naming.NamingException; 5 import javax.naming.spi.InitialContextFactory; 6 import java.util.Hashtable; 7 8 /** 9 * @author bela 10 * Date: May 15, 2003 11 * Time: 6:22:02 PM 12 */ 13 public class DummyContextFactory implements InitialContextFactory { 14 15 static Context instance=null; 16 17 public DummyContextFactory() { 18 ; 19 } 20 21 /** 22 * Creates an Initial Context for beginning name resolution. 23 * Special requirements of this context are supplied 24 * using <code>environment</code>. 25 * <p/> 26 * The environment parameter is owned by the caller. 27 * The implementation will not modify the object or keep a reference 28 * to it, although it may keep a reference to a clone or copy. 29 * 30 * @param environment The possibly null environment 31 * specifying information to be used in the creation 32 * of the initial context. 33 * @return A non-null initial context object that implements the Context 34 * interface. 35 * @throws NamingException If cannot create an initial context. 36 */ 37 public Context getInitialContext(Hashtable environment) throws NamingException { 38 if(instance == null) 39 instance=new DummyContext(); 40 return instance; 41 } 42 } 43